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 MetricDetail
- type Reporter
- type ResponseMetrics
- type Transactions
- type UnitCount
- type Units
- type UsageEvent
- type UsageReport
- type UsageResponse
- type V4Data
- type V4Event
- type V4EventDistribution
- type V4Session
Constants ¶
const ( Success statusText = "Success" Failure statusText = "Failure" Exception statusText = "Exception" )
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, counters map[string]metrics.Counter) 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,omitempty"` App models.AppDetails `json:"application,omitempty"` 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,omitempty"` Status string `json:"status,omitempty"` Count int64 `json:"count"` Response ResponseMetrics `json:"response,omitempty"` Observation models.ObservationDetails `json:"observation"` EventID string `json:"-"` StartTime time.Time `json:"-"` Unit *models.Unit `json:"unit,omitempty"` }
APIMetric - struct to hold metric aggregated for subscription,application,api,statuscode
func (*APIMetric) GetEventID ¶ added in v1.1.73
GetType - Returns APIMetric
func (*APIMetric) GetLogFields ¶ added in v1.1.80
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 { InitializeBatch() AddMetric(apiDetails models.APIDetails, statusCode string, duration, bytes int64, appName string) AddCustomMetricDetail(metric models.CustomMetricDetail) AddMetricDetail(metricDetail Detail) AddAPIMetricDetail(metric MetricDetail) 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 AppDetails models.AppDetails StatusCode string UnitName string Duration int64 Bytes int64 }
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 acknowledgeded, cleanup the counters
func (*EventBatch) AddEvent ¶
func (b *EventBatch) AddEvent(event beatPub.Event, histogram metrics.Histogram, counters map[string]metrics.Counter)
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 MetricDetail ¶ added in v1.1.86
type MetricDetail struct { APIDetails models.APIDetails AppDetails models.AppDetails StatusCode string Count int64 Response ResponseMetrics Observation models.ObservationDetails }
type ResponseMetrics ¶
type ResponseMetrics struct { Max int64 `json:"max"` Min int64 `json:"min"` Avg float64 `json:"avg"` }
ResponseMetrics - Holds metrics API response
type Transactions ¶ added in v1.1.105
type Transactions struct { UnitCount Response *ResponseMetrics `json:"response,omitempty"` Status string `json:"status,omitempty"` }
type UnitCount ¶ added in v1.1.105
type UnitCount struct { Count int64 `json:"count"` Quota *models.ResourceReference `json:"quota,omitempty"` }
type Units ¶ added in v1.1.105
type Units struct { Transactions *Transactions `json:"transactions,omitempty"` CustomUnits map[string]*UnitCount `json:"-"` }
func (Units) MarshalJSON ¶ added in v1.1.105
type UsageEvent ¶ added in v1.1.80
type UsageEvent struct { OrgGUID string `json:"-"` EnvID string `json:"envId"` Timestamp ISO8601Time `json:"timestamp"` Granularity int `json:"granularity"` SchemaID string `json:"schemaId"` Report map[string]UsageReport `json:"report"` Meta map[string]interface{} `json:"meta"` }
UsageEvent -Lighthouse Usage Event
type UsageReport ¶ added in v1.1.80
type UsageReport struct { Product string `json:"product"` Usage map[string]int64 `json:"usage"` Meta map[string]interface{} `json:"meta"` }
UsageReport -Lighthouse Usage report
type UsageResponse ¶ added in v1.1.80
type V4Data ¶
type V4Data interface { GetStartTime() time.Time GetType() string GetEventID() string GetLogFields() logrus.Fields }
V4Data - Interface for representing the metric data
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