Documentation ¶
Index ¶
- Variables
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type AttributeDirection
- type AttributeProtocol
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordSystemNetworkConnectionsDataPoint(ts pcommon.Timestamp, val int64, protocolAttributeValue AttributeProtocol, ...)
- func (mb *MetricsBuilder) RecordSystemNetworkDroppedDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordSystemNetworkDroppedReceiveDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
- func (mb *MetricsBuilder) RecordSystemNetworkDroppedTransmitDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
- func (mb *MetricsBuilder) RecordSystemNetworkErrorsDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordSystemNetworkErrorsReceiveDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
- func (mb *MetricsBuilder) RecordSystemNetworkErrorsTransmitDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
- func (mb *MetricsBuilder) RecordSystemNetworkIoDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordSystemNetworkIoReceiveDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
- func (mb *MetricsBuilder) RecordSystemNetworkIoTransmitDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
- func (mb *MetricsBuilder) RecordSystemNetworkPacketsDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string, ...)
- func (mb *MetricsBuilder) RecordSystemNetworkPacketsReceiveDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
- func (mb *MetricsBuilder) RecordSystemNetworkPacketsTransmitDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsSettings
- type ResourceMetricsOption
Constants ¶
This section is empty.
Variables ¶
var MapAttributeDirection = map[string]AttributeDirection{ "receive": AttributeDirectionReceive, "transmit": AttributeDirectionTransmit, }
MapAttributeDirection is a helper map of string to AttributeDirection attribute value.
var MapAttributeProtocol = map[string]AttributeProtocol{ "tcp": AttributeProtocolTcp, }
MapAttributeProtocol is a helper map of string to AttributeProtocol attribute value.
Functions ¶
func WithStartTime ¶ added in v0.43.0
WithStartTime sets startTime on the metrics builder.
Types ¶
type AttributeDirection ¶ added in v0.39.0
type AttributeDirection int
AttributeDirection specifies the a value direction attribute.
const ( AttributeDirectionReceive AttributeDirection AttributeDirectionTransmit )
func (AttributeDirection) String ¶ added in v0.51.0
func (av AttributeDirection) String() string
String returns the string representation of the AttributeDirection.
type AttributeProtocol ¶ added in v0.39.0
type AttributeProtocol int
AttributeProtocol specifies the a value protocol attribute.
const (
AttributeProtocolTcp AttributeProtocol
)
func (AttributeProtocol) String ¶ added in v0.51.0
func (av AttributeProtocol) String() string
String returns the string representation of the AttributeProtocol.
type MetricSettings ¶ added in v0.43.0
type MetricSettings struct {
Enabled bool `mapstructure:"enabled"`
}
MetricSettings provides common settings for a particular metric.
type MetricsBuilder ¶ added in v0.43.0
type MetricsBuilder struct {
// contains filtered or unexported fields
}
MetricsBuilder provides an interface for scrapers to report metrics while taking care of all the transformations required to produce metric representation defined in metadata and user settings.
func NewMetricsBuilder ¶ added in v0.43.0
func NewMetricsBuilder(settings MetricsSettings, buildInfo component.BuildInfo, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶ added in v0.43.0
func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
Emit returns all the metrics accumulated by the metrics builder and updates the internal state to be ready for recording another set of metrics. This function will be responsible for applying all the transformations required to produce metric representation defined in metadata and user settings, e.g. delta or cumulative.
func (*MetricsBuilder) EmitForResource ¶ added in v0.48.0
func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
EmitForResource saves all the generated metrics under a new resource and updates the internal state to be ready for recording another set of data points as part of another resource. This function can be helpful when one scraper needs to emit metrics from several resources. Otherwise calling this function is not required, just `Emit` function can be called instead. Resource attributes should be provided as ResourceMetricsOption arguments.
func (*MetricsBuilder) RecordSystemNetworkConnectionsDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordSystemNetworkConnectionsDataPoint(ts pcommon.Timestamp, val int64, protocolAttributeValue AttributeProtocol, stateAttributeValue string)
RecordSystemNetworkConnectionsDataPoint adds a data point to system.network.connections metric.
func (*MetricsBuilder) RecordSystemNetworkDroppedDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordSystemNetworkDroppedDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string, directionAttributeValue AttributeDirection)
RecordSystemNetworkDroppedDataPoint adds a data point to system.network.dropped metric.
func (*MetricsBuilder) RecordSystemNetworkDroppedReceiveDataPoint ¶ added in v0.55.0
func (mb *MetricsBuilder) RecordSystemNetworkDroppedReceiveDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
RecordSystemNetworkDroppedReceiveDataPoint adds a data point to system.network.dropped.receive metric.
func (*MetricsBuilder) RecordSystemNetworkDroppedTransmitDataPoint ¶ added in v0.55.0
func (mb *MetricsBuilder) RecordSystemNetworkDroppedTransmitDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
RecordSystemNetworkDroppedTransmitDataPoint adds a data point to system.network.dropped.transmit metric.
func (*MetricsBuilder) RecordSystemNetworkErrorsDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordSystemNetworkErrorsDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string, directionAttributeValue AttributeDirection)
RecordSystemNetworkErrorsDataPoint adds a data point to system.network.errors metric.
func (*MetricsBuilder) RecordSystemNetworkErrorsReceiveDataPoint ¶ added in v0.55.0
func (mb *MetricsBuilder) RecordSystemNetworkErrorsReceiveDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
RecordSystemNetworkErrorsReceiveDataPoint adds a data point to system.network.errors.receive metric.
func (*MetricsBuilder) RecordSystemNetworkErrorsTransmitDataPoint ¶ added in v0.55.0
func (mb *MetricsBuilder) RecordSystemNetworkErrorsTransmitDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
RecordSystemNetworkErrorsTransmitDataPoint adds a data point to system.network.errors.transmit metric.
func (*MetricsBuilder) RecordSystemNetworkIoDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordSystemNetworkIoDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string, directionAttributeValue AttributeDirection)
RecordSystemNetworkIoDataPoint adds a data point to system.network.io metric.
func (*MetricsBuilder) RecordSystemNetworkIoReceiveDataPoint ¶ added in v0.55.0
func (mb *MetricsBuilder) RecordSystemNetworkIoReceiveDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
RecordSystemNetworkIoReceiveDataPoint adds a data point to system.network.io.receive metric.
func (*MetricsBuilder) RecordSystemNetworkIoTransmitDataPoint ¶ added in v0.55.0
func (mb *MetricsBuilder) RecordSystemNetworkIoTransmitDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
RecordSystemNetworkIoTransmitDataPoint adds a data point to system.network.io.transmit metric.
func (*MetricsBuilder) RecordSystemNetworkPacketsDataPoint ¶ added in v0.43.0
func (mb *MetricsBuilder) RecordSystemNetworkPacketsDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string, directionAttributeValue AttributeDirection)
RecordSystemNetworkPacketsDataPoint adds a data point to system.network.packets metric.
func (*MetricsBuilder) RecordSystemNetworkPacketsReceiveDataPoint ¶ added in v0.55.0
func (mb *MetricsBuilder) RecordSystemNetworkPacketsReceiveDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
RecordSystemNetworkPacketsReceiveDataPoint adds a data point to system.network.packets.receive metric.
func (*MetricsBuilder) RecordSystemNetworkPacketsTransmitDataPoint ¶ added in v0.55.0
func (mb *MetricsBuilder) RecordSystemNetworkPacketsTransmitDataPoint(ts pcommon.Timestamp, val int64, deviceAttributeValue string)
RecordSystemNetworkPacketsTransmitDataPoint adds a data point to system.network.packets.transmit metric.
func (*MetricsBuilder) Reset ¶ added in v0.43.0
func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
Reset resets metrics builder to its initial state. It should be used when external metrics source is restarted, and metrics builder should update its startTime and reset it's internal state accordingly.
type MetricsSettings ¶ added in v0.43.0
type MetricsSettings struct { SystemNetworkConnections MetricSettings `mapstructure:"system.network.connections"` SystemNetworkDropped MetricSettings `mapstructure:"system.network.dropped"` SystemNetworkDroppedReceive MetricSettings `mapstructure:"system.network.dropped.receive"` SystemNetworkDroppedTransmit MetricSettings `mapstructure:"system.network.dropped.transmit"` SystemNetworkErrors MetricSettings `mapstructure:"system.network.errors"` SystemNetworkErrorsReceive MetricSettings `mapstructure:"system.network.errors.receive"` SystemNetworkErrorsTransmit MetricSettings `mapstructure:"system.network.errors.transmit"` SystemNetworkIo MetricSettings `mapstructure:"system.network.io"` SystemNetworkIoReceive MetricSettings `mapstructure:"system.network.io.receive"` SystemNetworkIoTransmit MetricSettings `mapstructure:"system.network.io.transmit"` SystemNetworkPackets MetricSettings `mapstructure:"system.network.packets"` SystemNetworkPacketsReceive MetricSettings `mapstructure:"system.network.packets.receive"` SystemNetworkPacketsTransmit MetricSettings `mapstructure:"system.network.packets.transmit"` }
MetricsSettings provides settings for hostmetricsreceiver/network metrics.
func DefaultMetricsSettings ¶ added in v0.43.0
func DefaultMetricsSettings() MetricsSettings
type ResourceMetricsOption ¶ added in v0.52.0
type ResourceMetricsOption func(pmetric.ResourceMetrics)
ResourceMetricsOption applies changes to provided resource metrics.
func WithStartTimeOverride ¶ added in v0.52.0
func WithStartTimeOverride(start pcommon.Timestamp) ResourceMetricsOption
WithStartTimeOverride overrides start time for all the resource metrics data points. This option should be only used if different start time has to be set on metrics coming from different resources.