Documentation ¶
Index ¶
- Variables
- func WithResourceAttributesSettings(ras ResourceAttributesSettings) metricBuilderOption
- func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption
- type AttributeMessageState
- type MetricSettings
- type MetricsBuilder
- func (mb *MetricsBuilder) Emit(rmo ...ResourceMetricsOption) pmetric.Metrics
- func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption)
- func (mb *MetricsBuilder) RecordRabbitmqConsumerCountDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordRabbitmqMessageAcknowledgedDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordRabbitmqMessageCurrentDataPoint(ts pcommon.Timestamp, val int64, ...)
- func (mb *MetricsBuilder) RecordRabbitmqMessageDeliveredDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordRabbitmqMessageDroppedDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) RecordRabbitmqMessagePublishedDataPoint(ts pcommon.Timestamp, val int64)
- func (mb *MetricsBuilder) Reset(options ...metricBuilderOption)
- type MetricsSettings
- type ResourceAttributeSettings
- type ResourceAttributesSettings
- type ResourceMetricsOption
Constants ¶
This section is empty.
Variables ¶
var MapAttributeMessageState = map[string]AttributeMessageState{ "ready": AttributeMessageStateReady, "unacknowledged": AttributeMessageStateUnacknowledged, }
MapAttributeMessageState is a helper map of string to AttributeMessageState attribute value.
Functions ¶
func WithResourceAttributesSettings ¶ added in v0.70.0
func WithResourceAttributesSettings(ras ResourceAttributesSettings) metricBuilderOption
WithResourceAttributesSettings sets ResourceAttributeSettings on the metrics builder.
func WithStartTime ¶
WithStartTime sets startTime on the metrics builder.
Types ¶
type AttributeMessageState ¶
type AttributeMessageState int
AttributeMessageState specifies the a value message.state attribute.
const ( AttributeMessageStateReady AttributeMessageState AttributeMessageStateUnacknowledged )
func (AttributeMessageState) String ¶ added in v0.51.0
func (av AttributeMessageState) String() string
String returns the string representation of the AttributeMessageState.
type MetricSettings ¶
type MetricSettings struct { Enabled bool `mapstructure:"enabled"` // contains filtered or unexported fields }
MetricSettings provides common settings for a particular metric.
type MetricsBuilder ¶
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 ¶
func NewMetricsBuilder(ms MetricsSettings, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder
func (*MetricsBuilder) Emit ¶
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) RecordRabbitmqConsumerCountDataPoint ¶
func (mb *MetricsBuilder) RecordRabbitmqConsumerCountDataPoint(ts pcommon.Timestamp, val int64)
RecordRabbitmqConsumerCountDataPoint adds a data point to rabbitmq.consumer.count metric.
func (*MetricsBuilder) RecordRabbitmqMessageAcknowledgedDataPoint ¶
func (mb *MetricsBuilder) RecordRabbitmqMessageAcknowledgedDataPoint(ts pcommon.Timestamp, val int64)
RecordRabbitmqMessageAcknowledgedDataPoint adds a data point to rabbitmq.message.acknowledged metric.
func (*MetricsBuilder) RecordRabbitmqMessageCurrentDataPoint ¶
func (mb *MetricsBuilder) RecordRabbitmqMessageCurrentDataPoint(ts pcommon.Timestamp, val int64, messageStateAttributeValue AttributeMessageState)
RecordRabbitmqMessageCurrentDataPoint adds a data point to rabbitmq.message.current metric.
func (*MetricsBuilder) RecordRabbitmqMessageDeliveredDataPoint ¶
func (mb *MetricsBuilder) RecordRabbitmqMessageDeliveredDataPoint(ts pcommon.Timestamp, val int64)
RecordRabbitmqMessageDeliveredDataPoint adds a data point to rabbitmq.message.delivered metric.
func (*MetricsBuilder) RecordRabbitmqMessageDroppedDataPoint ¶
func (mb *MetricsBuilder) RecordRabbitmqMessageDroppedDataPoint(ts pcommon.Timestamp, val int64)
RecordRabbitmqMessageDroppedDataPoint adds a data point to rabbitmq.message.dropped metric.
func (*MetricsBuilder) RecordRabbitmqMessagePublishedDataPoint ¶
func (mb *MetricsBuilder) RecordRabbitmqMessagePublishedDataPoint(ts pcommon.Timestamp, val int64)
RecordRabbitmqMessagePublishedDataPoint adds a data point to rabbitmq.message.published metric.
func (*MetricsBuilder) Reset ¶
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 ¶
type MetricsSettings struct { RabbitmqConsumerCount MetricSettings `mapstructure:"rabbitmq.consumer.count"` RabbitmqMessageAcknowledged MetricSettings `mapstructure:"rabbitmq.message.acknowledged"` RabbitmqMessageCurrent MetricSettings `mapstructure:"rabbitmq.message.current"` RabbitmqMessageDelivered MetricSettings `mapstructure:"rabbitmq.message.delivered"` RabbitmqMessageDropped MetricSettings `mapstructure:"rabbitmq.message.dropped"` RabbitmqMessagePublished MetricSettings `mapstructure:"rabbitmq.message.published"` }
MetricsSettings provides settings for rabbitmqreceiver metrics.
func DefaultMetricsSettings ¶
func DefaultMetricsSettings() MetricsSettings
type ResourceAttributeSettings ¶ added in v0.70.0
type ResourceAttributeSettings struct { Enabled bool `mapstructure:"enabled"` // contains filtered or unexported fields }
ResourceAttributeSettings provides common settings for a particular metric.
type ResourceAttributesSettings ¶ added in v0.70.0
type ResourceAttributesSettings struct { RabbitmqNodeName ResourceAttributeSettings `mapstructure:"rabbitmq.node.name"` RabbitmqQueueName ResourceAttributeSettings `mapstructure:"rabbitmq.queue.name"` RabbitmqVhostName ResourceAttributeSettings `mapstructure:"rabbitmq.vhost.name"` }
ResourceAttributesSettings provides settings for rabbitmqreceiver metrics.
func DefaultResourceAttributesSettings ¶ added in v0.70.0
func DefaultResourceAttributesSettings() ResourceAttributesSettings
type ResourceMetricsOption ¶ added in v0.52.0
type ResourceMetricsOption func(ResourceAttributesSettings, pmetric.ResourceMetrics)
ResourceMetricsOption applies changes to provided resource metrics.
func WithRabbitmqNodeName ¶ added in v0.48.0
func WithRabbitmqNodeName(val string) ResourceMetricsOption
WithRabbitmqNodeName sets provided value as "rabbitmq.node.name" attribute for current resource.
func WithRabbitmqQueueName ¶ added in v0.48.0
func WithRabbitmqQueueName(val string) ResourceMetricsOption
WithRabbitmqQueueName sets provided value as "rabbitmq.queue.name" attribute for current resource.
func WithRabbitmqVhostName ¶ added in v0.48.0
func WithRabbitmqVhostName(val string) ResourceMetricsOption
WithRabbitmqVhostName sets provided value as "rabbitmq.vhost.name" attribute for current resource.
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.