Documentation ¶
Overview ¶
Package obsreport provides unified and consistent observability signals ( metrics, tracing, etc) for components of the OpenTelemetry collector.
The function Configure is used to control which signals are going to be generated. It provides functions for the typical operations of receivers, processors, and exporters.
Receivers should use the respective start and end according to the data type being received, ie.:
Traces receive operations should use the pair: StartTracesOp/EndTracesOp
Metrics receive operations should use the pair: StartMetricsOp/EndMetricsOp
Logs receive operations should use the pair: StartLogsOp/EndLogsOp
Similar for exporters:
Traces export operations should use the pair: StartTracesOp/EndTracesOp
Metrics export operations should use the pair: StartMetricsOp/EndMetricsOp
Metrics export operations should use the pair: StartLogsOp/EndLogsOp
The package is capable of generating legacy metrics by using the observability package allowing a controlled transition from legacy to the new metrics. The goal is to eventually remove the legacy metrics and use only the new metrics.
The main differences regarding the legacy metrics are:
1. "Amount of metric data" is measured as metric points (ie.: a single value in time), contrast it with number of time series used legacy. Number of metric data points is a more general concept regarding various metric formats.
2. Exporters measure the number of items, ie.: number of spans or metric points, that were sent and the ones for which the attempt to send failed. For more information about this see Notes below about reporting data loss.
3. All measurements of "amount of data" used in the new metrics for receivers and exporters should reflect their native formats, not the internal format used in the Collector. This is to facilitate reconciliation between Collector, client and backend. For instance: certain metric formats do not provide direct support for histograms and have predefined conventions to represent those, this conversion may end with a different number of time series and data points than the internal Collector format.
Notes:
* Data loss should be recorded only when the component itself remove the data from the pipeline. Legacy metrics for receivers used "dropped" in their names but these could be non-zero under normal operations and reflected no actual data loss when exporters with "sending_queue" are used. New metrics were renamed to avoid this misunderstanding. Here are the general recommendations to report data loss:
Receivers reporting errors to clients typically result in the client re-sending the same data so it is more correct to report "receive errors", not actual data loss.
Exporters need to report individual failures to send data, but on typical production pipelines processors usually take care of retries, so these should be reported as "send errors".
Data "filtered out" should have its own metrics and not be confused with dropped data.
Naming Convention for New Metrics ¶
Common Metrics: Metrics shared by different components should follow the convention below:
`<component>/<metric_name>`
As a label the metric should have at least `{<component>="<name>"}` where `<name>` is the name used in the configuration for the instance of the component, eg.:
`receiver/accepted_spans{receiver="otlp",...}` `exporter/sent_spans{exporter="otlp/prod",...}`
Component Specific Metrics: These metrics are implemented by specific components, eg.: batch processor. The general pattern is the same as the common metrics but with the addition of the component type (as it appears in the configuration) before the actual metric:
`<component>/<type>/<metric_name>`
Even metrics exclusive to a single type should follow the conventions above and also include the type (as written in the configuration) as part of the metric name since there could be multiple instances of the same type in different pipelines, eg.:
`processor/batch/batch_size_trigger_send{processor="batch/dev",...}`
Index ¶
- func BuildProcessorCustomMetricName(configType, metric string) string
- type Exporter
- func (exp *Exporter) EndLogsOp(ctx context.Context, numLogRecords int, err error)
- func (exp *Exporter) EndMetricsOp(ctx context.Context, numMetricPoints int, err error)
- func (exp *Exporter) EndTracesOp(ctx context.Context, numSpans int, err error)
- func (exp *Exporter) StartLogsOp(ctx context.Context) context.Context
- func (exp *Exporter) StartMetricsOp(ctx context.Context) context.Context
- func (exp *Exporter) StartTracesOp(ctx context.Context) context.Context
- type ExporterSettings
- type Processor
- func (por *Processor) LogsAccepted(ctx context.Context, numRecords int)
- func (por *Processor) LogsDropped(ctx context.Context, numRecords int)
- func (por *Processor) LogsRefused(ctx context.Context, numRecords int)
- func (por *Processor) MetricsAccepted(ctx context.Context, numPoints int)
- func (por *Processor) MetricsDropped(ctx context.Context, numPoints int)
- func (por *Processor) MetricsRefused(ctx context.Context, numPoints int)
- func (por *Processor) TracesAccepted(ctx context.Context, numSpans int)
- func (por *Processor) TracesDropped(ctx context.Context, numSpans int)
- func (por *Processor) TracesRefused(ctx context.Context, numSpans int)
- type ProcessorSettings
- type Receiver
- func (rec *Receiver) EndLogsOp(receiverCtx context.Context, format string, numReceivedLogRecords int, ...)
- func (rec *Receiver) EndMetricsOp(receiverCtx context.Context, format string, numReceivedPoints int, err error)
- func (rec *Receiver) EndTracesOp(receiverCtx context.Context, format string, numReceivedSpans int, err error)
- func (rec *Receiver) StartLogsOp(operationCtx context.Context) context.Context
- func (rec *Receiver) StartMetricsOp(operationCtx context.Context) context.Context
- func (rec *Receiver) StartTracesOp(operationCtx context.Context) context.Context
- type ReceiverSettings
- type Scraper
- type ScraperSettings
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildProcessorCustomMetricName ¶
BuildProcessorCustomMetricName is used to be build a metric name following the standards used in the Collector. The configType should be the same value used to identify the type on the config.
Types ¶
type Exporter ¶
type Exporter struct {
// contains filtered or unexported fields
}
Exporter is a helper to add observability to a component.Exporter.
func NewExporter ¶
func NewExporter(cfg ExporterSettings) (*Exporter, error)
NewExporter creates a new Exporter.
func (*Exporter) EndLogsOp ¶
EndLogsOp completes the export operation that was started with StartLogsOp.
func (*Exporter) EndMetricsOp ¶
EndMetricsOp completes the export operation that was started with StartMetricsOp.
func (*Exporter) EndTracesOp ¶
EndTracesOp completes the export operation that was started with StartTracesOp.
func (*Exporter) StartLogsOp ¶
StartLogsOp is called at the start of an Export operation. The returned context should be used in other calls to the Exporter functions dealing with the same export operation.
func (*Exporter) StartMetricsOp ¶
StartMetricsOp is called at the start of an Export operation. The returned context should be used in other calls to the Exporter functions dealing with the same export operation.
type ExporterSettings ¶
type ExporterSettings struct { ExporterID component.ID ExporterCreateSettings exporter.CreateSettings }
ExporterSettings are settings for creating an Exporter.
type Processor ¶
type Processor struct {
// contains filtered or unexported fields
}
Processor is a helper to add observability to a component.Processor.
func NewProcessor ¶
func NewProcessor(cfg ProcessorSettings) (*Processor, error)
NewProcessor creates a new Processor.
func (*Processor) LogsAccepted ¶
LogsAccepted reports that the logs were accepted.
func (*Processor) LogsDropped ¶
LogsDropped reports that the logs were dropped.
func (*Processor) LogsRefused ¶
LogsRefused reports that the logs were refused.
func (*Processor) MetricsAccepted ¶
MetricsAccepted reports that the metrics were accepted.
func (*Processor) MetricsDropped ¶
MetricsDropped reports that the metrics were dropped.
func (*Processor) MetricsRefused ¶
MetricsRefused reports that the metrics were refused.
func (*Processor) TracesAccepted ¶
TracesAccepted reports that the trace data was accepted.
func (*Processor) TracesDropped ¶
TracesDropped reports that the trace data was dropped.
type ProcessorSettings ¶
type ProcessorSettings struct { ProcessorID component.ID ProcessorCreateSettings processor.CreateSettings }
ProcessorSettings are settings for creating a Processor.
type Receiver ¶
type Receiver struct {
// contains filtered or unexported fields
}
Receiver is a helper to add observability to a receiver.Receiver.
func NewReceiver ¶
func NewReceiver(cfg ReceiverSettings) (*Receiver, error)
NewReceiver creates a new Receiver.
func (*Receiver) EndLogsOp ¶
func (rec *Receiver) EndLogsOp( receiverCtx context.Context, format string, numReceivedLogRecords int, err error, )
EndLogsOp completes the receive operation that was started with StartLogsOp.
func (*Receiver) EndMetricsOp ¶
func (rec *Receiver) EndMetricsOp( receiverCtx context.Context, format string, numReceivedPoints int, err error, )
EndMetricsOp completes the receive operation that was started with StartMetricsOp.
func (*Receiver) EndTracesOp ¶
func (rec *Receiver) EndTracesOp( receiverCtx context.Context, format string, numReceivedSpans int, err error, )
EndTracesOp completes the receive operation that was started with StartTracesOp.
func (*Receiver) StartLogsOp ¶
StartLogsOp is called when a request is received from a client. The returned context should be used in other calls to the obsreport functions dealing with the same receive operation.
func (*Receiver) StartMetricsOp ¶
StartMetricsOp is called when a request is received from a client. The returned context should be used in other calls to the obsreport functions dealing with the same receive operation.
type ReceiverSettings ¶
type ReceiverSettings struct { ReceiverID component.ID Transport string // LongLivedCtx when true indicates that the context passed in the call // outlives the individual receive operation. // Typically the long lived context is associated to a connection, // eg.: a gRPC stream, for which many batches of data are received in individual // operations without a corresponding new context per operation. LongLivedCtx bool ReceiverCreateSettings receiver.CreateSettings }
ReceiverSettings are settings for creating an Receiver.
type Scraper ¶
type Scraper struct {
// contains filtered or unexported fields
}
Scraper is a helper to add observability to a component.Scraper.
func NewScraper ¶
func NewScraper(cfg ScraperSettings) (*Scraper, error)
NewScraper creates a new Scraper.
func (*Scraper) EndMetricsOp ¶
EndMetricsOp completes the scrape operation that was started with StartMetricsOp.
type ScraperSettings ¶
type ScraperSettings struct { ReceiverID component.ID Scraper component.ID ReceiverCreateSettings receiver.CreateSettings }
ScraperSettings are settings for creating a Scraper.