Documentation
¶
Overview ¶
Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0
Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0
Copyright 2020 New Relic Corporation. All rights reserved. SPDX-License-Identifier: Apache-2.0
Index ¶
- Constants
- Variables
- func VersionFromPayload(raw []byte, forceV2ToV3Upgrade bool) (protocolVersion int, err error)
- func WithAnnotations(a map[string]string) func(EventData)
- func WithAttributes(a map[string]interface{}) func(EventData)
- func WithEntity(e entity.Entity) func(EventData)
- func WithEvents(original EventData) func(EventData)
- func WithIntegrationUser(value string) func(EventData)
- func WithLabels(l map[string]string) func(EventData)
- type Common
- type DataV4
- type Dataset
- type EventData
- type IntegrationMetadata
- type InventoryData
- type Metric
- func (m *Metric) CopyAttrs() map[string]interface{}
- func (m *Metric) GetPrometheusHistogramValue() (PrometheusHistogramValue, error)
- func (m *Metric) GetPrometheusSummaryValue() (PrometheusSummaryValue, error)
- func (m *Metric) IntervalDuration() time.Duration
- func (m *Metric) NumericValue() (float64, error)
- func (m *Metric) SummaryValue() (SummaryValue, error)
- func (m *Metric) Time() time.Time
- type MetricData
- type MetricType
- type PluginDataSet
- type PluginDataSetV3
- type PluginDataV1
- type PluginDataV3
- type PluginOutputIdentifier
- type PluginProtocolVersion
- type PrometheusHistogramValue
- type PrometheusSummaryValue
- type SummaryValue
Constants ¶
const ( V1 = 1 V2 = 2 V3 = 3 V4 = 4 )
Protocol Integration versions.
Variables ¶
var (
EmptyPayloadErr = errors.New("cannot parse empty integration payload")
)
Errors
var (
IntProtocolNotSupportedErr = errors.New("integration protocol version not supported")
)
Functions ¶
func VersionFromPayload ¶
VersionFromPayload determines the protocol version number from integration payload for both inventory and metrics.
func WithAnnotations ¶
Builder for NewEventData constructor will add annotations
func WithAttributes ¶
Builder for NewEventData constructor will add attributes if already exist in the eventData will add it with prefix 'attr.'
func WithEntity ¶
Builder for NewEventData constructor will add 'entityKey' and 'entityID' keys
func WithEvents ¶
Builder for NewEventData copying all event fields.
func WithIntegrationUser ¶
Builder for NewEventData constructor will add 'integrationUser' key
func WithLabels ¶
Builder for NewEventData constructor will add labels with prefix 'label.'
Types ¶
type DataV4 ¶
type DataV4 struct {
PluginProtocolVersion
Integration IntegrationMetadata `json:"integration"`
DataSets []Dataset `json:"data"`
}
type Dataset ¶
type Dataset struct {
Common Common `json:"common"`
Metrics []Metric `json:"metrics"`
Entity entity.Fields `json:"entity"`
Inventory map[string]InventoryData `json:"inventory"`
Events []EventData `json:"events"`
IgnoreEntity bool `json:"ignore_entity"`
}
func NewEventDataset ¶
NewEventDataset creates a dataset with jsut a single event.
type EventData ¶
type EventData map[string]interface{}
EventData is the data type for single shot events
func NewEventData ¶
NewEventData create a new event data from builder func
type IntegrationMetadata ¶
type InventoryData ¶
type InventoryData map[string]interface{}
InventoryData is the data type for inventory data produced by a plugin data source and emitted to the agent's inventory data store
func (InventoryData) SortKey ¶
func (i InventoryData) SortKey() string
type Metric ¶
type Metric struct {
Name string `json:"name"`
Type MetricType `json:"type"`
Timestamp *int64 `json:"timestamp"`
Interval *int64 `json:"interval.ms"`
Attributes map[string]interface{} `json:"attributes"`
Value json.RawMessage `json:"value"`
}
func (*Metric) GetPrometheusHistogramValue ¶
func (m *Metric) GetPrometheusHistogramValue() (PrometheusHistogramValue, error)
func (*Metric) GetPrometheusSummaryValue ¶
func (m *Metric) GetPrometheusSummaryValue() (PrometheusSummaryValue, error)
func (*Metric) IntervalDuration ¶
func (*Metric) NumericValue ¶
func (*Metric) SummaryValue ¶
func (m *Metric) SummaryValue() (SummaryValue, error)
type MetricData ¶
type MetricData map[string]interface{}
MetricData is the data type for events produced by a plugin data source and emitted to the agent's metrics data store
type MetricType ¶
type MetricType string
const ( MetricTypeCount MetricType = "count" MetricTypeSummary MetricType = "summary" MetricTypeGauge MetricType = "gauge" MetricTypeRate MetricType = "rate" MetricTypePrometheusSummary MetricType = "prometheus-summary" MetricTypePrometheusHistogram MetricType = "prometheus-histogram" )
Metric type values
func (MetricType) HasInterval ¶
func (t MetricType) HasInterval() bool
HasInterval does metric type support interval.
type PluginDataSet ¶
type PluginDataSet struct {
Entity entity.Fields `json:"entity"`
Metrics []MetricData `json:"metrics"`
Inventory map[string]InventoryData `json:"inventory"`
Events []EventData `json:"events"`
// this is here for backcompat with the SDK, but is ignored
AddHostname bool `json:"add_hostname"`
}
A collection of data generated by a plugin for a single entity. V2 plugins can produce multiple of these, where V1 produces one per execution.
type PluginDataSetV3 ¶
type PluginDataSetV3 struct {
PluginDataSet
Cluster string `json:"cluster"`
Service string `json:"service"`
}
type PluginDataV1 ¶
type PluginDataV1 struct {
PluginOutputIdentifier
PluginDataSet
}
PluginDataV1 supports a single data set for a single entity
type PluginDataV3 ¶
type PluginDataV3 struct {
PluginOutputIdentifier
DataSets []PluginDataSetV3 `json:"data"`
}
PluginDataV3 supports an array of data sets, each for a different entity. It's also valid for protocol V2, protocol v3 only adds service & cluster
func ParsePayload ¶
func ParsePayload(raw []byte, protocolVersion int) (dataV3 PluginDataV3, err error)
ParsePayload parses a JSON payload using the integration protocol format. Used for all metrics (events) and inventory.
type PluginOutputIdentifier ¶
type PluginOutputIdentifier struct {
Name string `json:"name"`
RawProtocolVersion interface{} `json:"protocol_version"` // Left open-ended for validation purposes
IntegrationVersion string `json:"integration_version"`
Status string `json:"integration_status"`
}
Basic fields which identify the plugin and the version of its output
type PluginProtocolVersion ¶
type PluginProtocolVersion struct {
RawProtocolVersion interface{} `json:"protocol_version"` // Left open-ended for validation purposes
}
Minimum information to determine plugin protocol
type PrometheusHistogramValue ¶
type PrometheusHistogramValue struct {
SampleCount *uint64 `json:"sample_count,omitempty"`
SampleSum *float64 `json:"sample_sum,omitempty"`
// Buckets defines the buckets into which observations are counted. Each
// element in the slice is the upper inclusive bound of a bucket. The
// values must are sorted in strictly increasing order.
Buckets []*bucket `json:"buckets,omitempty"`
}
PrometheusHistogram represents a Prometheus histogram
type PrometheusSummaryValue ¶
type PrometheusSummaryValue struct {
SampleCount float64 `json:"sample_count,omitempty"`
SampleSum float64 `json:"sample_sum,omitempty"`
Quantiles []quantile `json:"quantiles,omitempty"`
}
PrometheusSummary represents a Prometheus summary