Documentation
¶
Index ¶
- Constants
- func AddCondorMetricEventToBatch(metricEvent V4Event, batch *EventBatch, registryKey string, ...) error
- func ExitMetricInit()
- func GetOrgGUID() string
- func GetStatusText(statusCode string) string
- type APIMetric
- func (a *APIMetric) GetAPIInfo() (string, string)
- func (a *APIMetric) GetAppInfo() (string, string)
- func (a *APIMetric) GetAssetResourceID() string
- func (a *APIMetric) GetCount() int64
- func (a *APIMetric) GetEventID() string
- func (a *APIMetric) GetLogFields() logrus.Fields
- func (a *APIMetric) GetObservation() *models.ObservationDetails
- func (a *APIMetric) GetProductInfo() (string, string)
- func (a *APIMetric) GetProductPlanID() string
- func (a *APIMetric) GetQuotaID() string
- func (a *APIMetric) GetResponseMetrics() *ResponseMetrics
- func (a *APIMetric) GetStartTime() time.Time
- func (a *APIMetric) GetStatus() string
- func (a *APIMetric) GetSubscriptionID() string
- func (a *APIMetric) GetType() string
- type AppUsage
- type CentralMetricBuilder
- func (b *CentralMetricBuilder) Build() *centralMetric
- func (a CentralMetricBuilder) GetAPIInfo() (string, string)
- func (a CentralMetricBuilder) GetAppInfo() (string, string)
- func (a CentralMetricBuilder) GetAssetResourceID() string
- func (a CentralMetricBuilder) GetCount() int64
- func (a CentralMetricBuilder) GetEventID() string
- func (a CentralMetricBuilder) GetLogFields() logrus.Fields
- func (a CentralMetricBuilder) GetObservation() *models.ObservationDetails
- func (a CentralMetricBuilder) GetProductInfo() (string, string)
- func (a CentralMetricBuilder) GetProductPlanID() string
- func (a CentralMetricBuilder) GetQuotaID() string
- func (a CentralMetricBuilder) GetResponseMetrics() *ResponseMetrics
- func (a CentralMetricBuilder) GetStartTime() time.Time
- func (a CentralMetricBuilder) GetStatus() string
- func (a CentralMetricBuilder) GetSubscriptionID() string
- func (a CentralMetricBuilder) GetType() string
- func (b *CentralMetricBuilder) SetAPI(api *models.APIResourceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetAPICDeployment(d string) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetAPIServiceRevision(r *models.ResourceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetApp(app *models.ApplicationResourceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetAssetResource(asset *models.ResourceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetEnvironmentRuntimeType(t string) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetEventID(id string) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetMarketplace(marketplace *models.MarketplaceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetObservation(obs *models.ObservationDetails) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetProduct(product *models.ProductResourceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetProductPlan(plan *models.ResourceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetQuota(quota *models.ResourceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetReporter(r *Reporter) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetSubscription(sub *models.ResourceReference) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetUnits(units *Units) *CentralMetricBuilder
- func (b *CentralMetricBuilder) SetVersion(v string) *CentralMetricBuilder
- type Collector
- type CondorMetricEvent
- type Data
- type Detail
- type EnvironmentInfo
- type EventBatch
- func (b *EventBatch) ACK()
- func (b *EventBatch) AddEvent(event beatPub.Event, registryKey string, counters map[string]*counter, ...)
- 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 (
ISO8601 = "2006-01-02T15:04:00Z07:00"
)
ISO8601 - time format
Variables ¶
This section is empty.
Functions ¶
func AddCondorMetricEventToBatch ¶
func AddCondorMetricEventToBatch(metricEvent V4Event, batch *EventBatch, registryKey string, counters map[string]*counter, group groupedMetrics) error
AddCondorMetricEventToBatch - creates the condor metric event and adds to the batch
func ExitMetricInit ¶ added in v1.1.58
func ExitMetricInit()
func GetOrgGUID ¶ added in v1.1.146
func GetOrgGUID() string
GetOrgGUID parses the provider org GUID from the central auth token JWT. Returns empty string if the token is unavailable or the claim is absent.
func GetStatusText ¶ added in v1.1.121
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"`
// APIServiceRevisionID is populated by the agents-controller via CentralMetricBuilder.SetAPIServiceRevision.
APIServiceRevisionID string `json:"-"`
}
APIMetric - struct to hold metric aggregated for subscription,application,api,statuscode
func (*APIMetric) GetAPIInfo ¶ added in v1.1.113
func (*APIMetric) GetAppInfo ¶ added in v1.1.113
func (*APIMetric) GetAssetResourceID ¶ added in v1.1.113
func (*APIMetric) GetEventID ¶ added in v1.1.73
GetType - Returns APIMetric
func (*APIMetric) GetLogFields ¶ added in v1.1.80
func (*APIMetric) GetObservation ¶ added in v1.1.113
func (a *APIMetric) GetObservation() *models.ObservationDetails
func (*APIMetric) GetProductInfo ¶ added in v1.1.113
func (*APIMetric) GetProductPlanID ¶ added in v1.1.113
func (*APIMetric) GetQuotaID ¶ added in v1.1.113
func (*APIMetric) GetResponseMetrics ¶ added in v1.1.113
func (a *APIMetric) GetResponseMetrics() *ResponseMetrics
func (*APIMetric) GetStartTime ¶
GetStartTime - Returns the start time for subscription metric
func (*APIMetric) GetSubscriptionID ¶ added in v1.1.113
type AppUsage ¶
type AppUsage struct {
App models.AppDetails `json:"app"`
Count int64 `json:"count"`
}
AppUsage - struct to hold metric specific for app usage
type CentralMetricBuilder ¶ added in v1.1.113
type CentralMetricBuilder struct {
// contains filtered or unexported fields
}
func NewCentralMetricBuilder ¶ added in v1.1.113
func NewCentralMetricBuilder() *CentralMetricBuilder
func (*CentralMetricBuilder) Build ¶ added in v1.1.113
func (b *CentralMetricBuilder) Build() *centralMetric
func (CentralMetricBuilder) GetAPIInfo ¶ added in v1.1.113
func (CentralMetricBuilder) GetAppInfo ¶ added in v1.1.113
func (CentralMetricBuilder) GetAssetResourceID ¶ added in v1.1.113
func (a CentralMetricBuilder) GetAssetResourceID() string
func (CentralMetricBuilder) GetCount ¶ added in v1.1.113
func (a CentralMetricBuilder) GetCount() int64
func (CentralMetricBuilder) GetEventID ¶ added in v1.1.113
func (a CentralMetricBuilder) GetEventID() string
GetType - Returns APIMetric
func (CentralMetricBuilder) GetLogFields ¶ added in v1.1.113
func (CentralMetricBuilder) GetObservation ¶ added in v1.1.113
func (a CentralMetricBuilder) GetObservation() *models.ObservationDetails
func (CentralMetricBuilder) GetProductInfo ¶ added in v1.1.113
func (CentralMetricBuilder) GetProductPlanID ¶ added in v1.1.113
func (a CentralMetricBuilder) GetProductPlanID() string
func (CentralMetricBuilder) GetQuotaID ¶ added in v1.1.113
func (a CentralMetricBuilder) GetQuotaID() string
func (CentralMetricBuilder) GetResponseMetrics ¶ added in v1.1.113
func (a CentralMetricBuilder) GetResponseMetrics() *ResponseMetrics
func (CentralMetricBuilder) GetStartTime ¶ added in v1.1.113
GetStartTime - Returns the start time for subscription metric
func (CentralMetricBuilder) GetStatus ¶ added in v1.1.113
func (a CentralMetricBuilder) GetStatus() string
func (CentralMetricBuilder) GetSubscriptionID ¶ added in v1.1.113
func (a CentralMetricBuilder) GetSubscriptionID() string
func (CentralMetricBuilder) GetType ¶ added in v1.1.113
func (a CentralMetricBuilder) GetType() string
GetType - Returns APIMetric
func (*CentralMetricBuilder) SetAPI ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetAPI(api *models.APIResourceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetAPICDeployment ¶ added in v1.1.146
func (b *CentralMetricBuilder) SetAPICDeployment(d string) *CentralMetricBuilder
func (*CentralMetricBuilder) SetAPIServiceRevision ¶ added in v1.1.146
func (b *CentralMetricBuilder) SetAPIServiceRevision(r *models.ResourceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetApp ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetApp(app *models.ApplicationResourceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetAssetResource ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetAssetResource(asset *models.ResourceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetEnvironmentRuntimeType ¶ added in v1.1.146
func (b *CentralMetricBuilder) SetEnvironmentRuntimeType(t string) *CentralMetricBuilder
func (*CentralMetricBuilder) SetEventID ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetEventID(id string) *CentralMetricBuilder
func (*CentralMetricBuilder) SetMarketplace ¶ added in v1.1.123
func (b *CentralMetricBuilder) SetMarketplace(marketplace *models.MarketplaceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetObservation ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetObservation(obs *models.ObservationDetails) *CentralMetricBuilder
func (*CentralMetricBuilder) SetProduct ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetProduct(product *models.ProductResourceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetProductPlan ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetProductPlan(plan *models.ResourceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetQuota ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetQuota(quota *models.ResourceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetReporter ¶ added in v1.1.146
func (b *CentralMetricBuilder) SetReporter(r *Reporter) *CentralMetricBuilder
func (*CentralMetricBuilder) SetSubscription ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetSubscription(sub *models.ResourceReference) *CentralMetricBuilder
func (*CentralMetricBuilder) SetUnits ¶ added in v1.1.113
func (b *CentralMetricBuilder) SetUnits(units *Units) *CentralMetricBuilder
func (*CentralMetricBuilder) SetVersion ¶ added in v1.1.146
func (b *CentralMetricBuilder) SetVersion(v string) *CentralMetricBuilder
type Collector ¶
type Collector interface {
AddMetric(apiDetails models.APIDetails, statusCode string, duration, bytes int64, appName string)
AddCustomMetricDetail(metric models.CustomMetricDetail)
AddMetricDetail(metricDetail Detail)
AddAPIMetricDetail(metric MetricDetail)
AddAPIMetric(apiMetric *APIMetric)
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 EnvironmentInfo ¶ added in v1.1.146
type EnvironmentInfo struct {
RuntimeType string `json:"runtimeType,omitempty"`
}
EnvironmentInfo holds the environment runtime classification for metric v3 events.
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, registryKey string, counters map[string]*counter, group groupedMetrics)
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
Duration int64 `json:"duration,omitempty"`
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"`
Org string `json:"org,omitempty"`
App string `json:"app,omitempty"`
Version string `json:"version"`
Distribution *V4EventDistribution `json:"distribution"`
Data V4Data `json:"data"`
Session *V4Session `json:"session,omitempty"`
}
V4Event is the top-level event envelope sent to the insights pipeline.
type V4EventDistribution ¶
type V4EventDistribution struct {
Environment string `json:"environment"`
}
V4EventDistribution - represents V4 distribution