metadata

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Type                     = "newrelicapm"
	TracesToMetricsStability = component.StabilityLevelDevelopment
	TracesToLogsStability    = component.StabilityLevelDevelopment
)

Variables

This section is empty.

Functions

func WithStartTime

func WithStartTime(startTime pcommon.Timestamp) metricBuilderOption

WithStartTime sets startTime on the metrics builder.

Types

type MetricConfig

type MetricConfig struct {
	Enabled bool `mapstructure:"enabled"`
	// contains filtered or unexported fields
}

MetricConfig provides common config for a particular metric.

func (*MetricConfig) Unmarshal

func (ms *MetricConfig) Unmarshal(parser *confmap.Conf) error

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 config.

func NewMetricsBuilder

func NewMetricsBuilder(mbc MetricsBuilderConfig, settings receiver.CreateSettings, options ...metricBuilderOption) *MetricsBuilder

func (*MetricsBuilder) Emit

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 config, e.g. delta or cumulative.

func (*MetricsBuilder) EmitForResource

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) RecordApmServiceApdexDataPoint

func (mb *MetricsBuilder) RecordApmServiceApdexDataPoint(ts pcommon.Timestamp, val float64)

RecordApmServiceApdexDataPoint adds a data point to apm.service.apdex metric.

func (*MetricsBuilder) RecordApmServiceErrorCountDataPoint

func (mb *MetricsBuilder) RecordApmServiceErrorCountDataPoint(ts pcommon.Timestamp, val float64)

RecordApmServiceErrorCountDataPoint adds a data point to apm.service.error.count metric.

func (*MetricsBuilder) RecordApmServiceTransactionDurationDataPoint

func (mb *MetricsBuilder) RecordApmServiceTransactionDurationDataPoint(ts pcommon.Timestamp, val float64)

RecordApmServiceTransactionDurationDataPoint adds a data point to apm.service.transaction.duration 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 MetricsBuilderConfig

type MetricsBuilderConfig struct {
	Metrics MetricsConfig `mapstructure:"metrics"`
}

MetricsBuilderConfig is a configuration for newrelicapm metrics builder.

func DefaultMetricsBuilderConfig

func DefaultMetricsBuilderConfig() MetricsBuilderConfig

type MetricsConfig

type MetricsConfig struct {
	ApmServiceApdex               MetricConfig `mapstructure:"apm.service.apdex"`
	ApmServiceErrorCount          MetricConfig `mapstructure:"apm.service.error.count"`
	ApmServiceTransactionDuration MetricConfig `mapstructure:"apm.service.transaction.duration"`
}

MetricsConfig provides config for newrelicapm metrics.

func DefaultMetricsConfig

func DefaultMetricsConfig() MetricsConfig

type ResourceMetricsOption

type ResourceMetricsOption func(pmetric.ResourceMetrics)

ResourceMetricsOption applies changes to provided resource metrics.

func WithResource

func WithResource(res pcommon.Resource) ResourceMetricsOption

WithResource sets the provided resource on the emitted ResourceMetrics. It's recommended to use ResourceBuilder to create the resource.

func WithStartTimeOverride

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL