Documentation ¶
Index ¶
- Constants
- func AddCondorMetricEventToBatch(metricEvent V4Event, batch *EventBatch, histogram metrics.Histogram) error
- func ExitMetricInit()
- type APIMetric
- type AppUsage
- type Collector
- type CondorMetricEvent
- type Data
- type Detail
- type EventBatch
- func (b *EventBatch) ACK()
- func (b *EventBatch) AddEvent(event beatPub.Event, histogram metrics.Histogram)
- func (b *EventBatch) AddEventWithoutHistogram(event beatPub.Event)
- func (b *EventBatch) Cancelled()
- func (b *EventBatch) CancelledEvents(events []beatPub.Event)
- func (b *EventBatch) Drop()
- func (b *EventBatch) Events() []beatPub.Event
- func (b *EventBatch) Publish() error
- func (b *EventBatch) Retry()
- func (b *EventBatch) RetryEvents(events []beatPub.Event)
- type ISO8601Time
- type LighthouseUsageEvent
- type LighthouseUsageReport
- type LighthouseUsageResponse
- type ObservationDetails
- type ResponseMetrics
- type V4Data
- type V4Event
- type V4EventDistribution
- type V4Session
Constants ¶
const (
ISO8601 = "2006-01-02T15:04:00Z07:00"
)
ISO8601 - time format
Variables ¶
This section is empty.
Functions ¶
func AddCondorMetricEventToBatch ¶
func AddCondorMetricEventToBatch(metricEvent V4Event, batch *EventBatch, histogram metrics.Histogram) error
AddCondorMetricEventToBatch - creates the condor metric event and adds to the batch
func ExitMetricInit ¶ added in v1.1.58
func ExitMetricInit()
Types ¶
type APIMetric ¶
type APIMetric struct { Subscription models.Subscription `json:"subscription"` App models.AppDetails `json:"application"` Product models.Product `json:"product,omitempty"` API models.APIDetails `json:"api"` AssetResource models.AssetResource `json:"assetResource,omitempty"` ProductPlan models.ProductPlan `json:"productPlan,omitempty"` Quota models.Quota `json:"quota,omitempty"` StatusCode string `json:"statusCode"` Status string `json:"status"` Count int64 `json:"count"` Response ResponseMetrics `json:"response"` Observation ObservationDetails `json:"observation"` EventID string `json:"eventID"` StartTime time.Time `json:"-"` }
APIMetric - struct to hold metric aggregated for subscription,application,api,statuscode
func (*APIMetric) GetEventID ¶ added in v1.1.73
GetType - Returns APIMetric
func (*APIMetric) GetStartTime ¶
GetStartTime - Returns the start time for subscription metric
type AppUsage ¶
type AppUsage struct { App models.AppDetails `json:"app"` Count int64 `json:"count"` }
AppUsage - struct to hold metric specific for app usage
type Collector ¶
type Collector interface { AddMetric(apiDetails models.APIDetails, statusCode string, duration, bytes int64, appName string) AddMetricDetail(metricDetail Detail) AddAPIMetric(apiMetric *APIMetric) Publish() ShutdownPublish() }
Collector - interface for collecting metrics
func GetMetricCollector ¶
func GetMetricCollector() Collector
GetMetricCollector - Create metric collector
type CondorMetricEvent ¶
type CondorMetricEvent struct { Message string `json:"message"` Fields map[string]interface{} `json:"fields"` Timestamp time.Time `json:"-"` ID string `json:"-"` }
CondorMetricEvent - the condor event format to send metric data
func (*CondorMetricEvent) CreateEvent ¶
func (c *CondorMetricEvent) CreateEvent() (beatPub.Event, error)
CreateEvent - creates the beat event to add to the batch
type Data ¶
type Data struct { APIDetails models.APIDetails StatusCode string Duration int64 UsageBytes int64 AppDetails models.AppDetails TeamName string }
Data - struct for data to report as API Metrics
type Detail ¶
type Detail struct { APIDetails models.APIDetails StatusCode string Duration int64 Bytes int64 AppDetails models.AppDetails }
Detail - holds the details for computing metrics for API and consumer subscriptions
type EventBatch ¶
EventBatch - creates a batch of MetricEvents to send to Condor
func NewEventBatch ¶
func NewEventBatch(c *collector) *EventBatch
NewEventBatch - creates a new batch
func (*EventBatch) ACK ¶
func (b *EventBatch) ACK()
ACK - all events have been acked, cleanup the counters
func (*EventBatch) AddEvent ¶
func (b *EventBatch) AddEvent(event beatPub.Event, histogram metrics.Histogram)
AddEvent - adds an event to the batch
func (*EventBatch) AddEventWithoutHistogram ¶ added in v1.1.64
func (b *EventBatch) AddEventWithoutHistogram(event beatPub.Event)
AddEvent - adds an event to the batch
func (*EventBatch) Cancelled ¶
func (b *EventBatch) Cancelled()
Cancelled - batch has been cancelled
func (*EventBatch) CancelledEvents ¶
func (b *EventBatch) CancelledEvents(events []beatPub.Event)
CancelledEvents - events have been cancelled
func (*EventBatch) Events ¶
func (b *EventBatch) Events() []beatPub.Event
Events - return the events in the batch
func (*EventBatch) Publish ¶
func (b *EventBatch) Publish() error
Publish - connects to the traceability clients and sends this batch of events
func (*EventBatch) RetryEvents ¶
func (b *EventBatch) RetryEvents(events []beatPub.Event)
RetryEvents - certain events sent to retry
type ISO8601Time ¶
ISO8601Time - time
func (*ISO8601Time) UnmarshalJSON ¶
func (t *ISO8601Time) UnmarshalJSON(bytes []byte) error
UnmarshalJSON - unmarshal json for time
type LighthouseUsageEvent ¶
type LighthouseUsageEvent struct { OrgGUID string `json:"-"` EnvID string `json:"envId"` Timestamp ISO8601Time `json:"timestamp"` Granularity int `json:"granularity"` SchemaID string `json:"schemaId"` Report map[string]LighthouseUsageReport `json:"report"` Meta map[string]interface{} `json:"meta"` }
LighthouseUsageEvent -Lighthouse Usage Event
type LighthouseUsageReport ¶
type LighthouseUsageReport struct { Product string `json:"product"` Usage map[string]int64 `json:"usage"` Meta map[string]interface{} `json:"meta"` }
LighthouseUsageReport -Lighthouse Usage report
type LighthouseUsageResponse ¶ added in v1.1.73
type ObservationDetails ¶
type ObservationDetails struct { Start int64 `json:"start,omitempty"` End int64 `json:"end,omitempty"` }
ObservationDetails - Holds start and end timestamp for interval
type ResponseMetrics ¶
type ResponseMetrics struct { Max int64 `json:"max"` Min int64 `json:"min"` Avg float64 `json:"avg"` }
ResponseMetrics - Holds metrics API response
type V4Event ¶
type V4Event struct { ID string `json:"id"` Timestamp int64 `json:"timestamp"` Event string `json:"event"` App string `json:"app,omitempty"` // ORG GUID Version string `json:"version"` Distribution *V4EventDistribution `json:"distribution"` Data V4Data `json:"data"` Session *V4Session `json:"session,omitempty"` }
V4Event - represents V7 event
type V4EventDistribution ¶
type V4EventDistribution struct { Environment string `json:"environment"` Version string `json:"version"` }
V4EventDistribution - represents V4 distribution