obsreport

package
Version: v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: Apache-2.0 Imports: 13 Imported by: 39

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildProcessorCustomMetricName

func BuildProcessorCustomMetricName(configType, metric string) string

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 added in v0.23.0

type Exporter struct {
	// contains filtered or unexported fields
}

Exporter is a helper to add observability to a component.Exporter.

func NewExporter added in v0.23.0

func NewExporter(cfg ExporterSettings) *Exporter

NewExporter creates a new Exporter.

func (*Exporter) EndLogsOp added in v0.28.0

func (exp *Exporter) EndLogsOp(ctx context.Context, numLogRecords int, err error)

EndLogsOp completes the export operation that was started with StartLogsOp.

func (*Exporter) EndMetricsOp added in v0.28.0

func (exp *Exporter) EndMetricsOp(ctx context.Context, numMetricPoints int, err error)

EndMetricsOp completes the export operation that was started with StartMetricsOp.

func (*Exporter) EndTracesOp added in v0.28.0

func (exp *Exporter) EndTracesOp(ctx context.Context, numSpans int, err error)

EndTracesOp completes the export operation that was started with StartTracesOp.

func (*Exporter) StartLogsOp added in v0.28.0

func (exp *Exporter) StartLogsOp(ctx context.Context) context.Context

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 added in v0.28.0

func (exp *Exporter) StartMetricsOp(ctx context.Context) context.Context

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.

func (*Exporter) StartTracesOp added in v0.28.0

func (exp *Exporter) StartTracesOp(ctx context.Context) context.Context

StartTracesOp 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 added in v0.24.0

type ExporterSettings struct {
	Level                  configtelemetry.Level
	ExporterID             config.ComponentID
	ExporterCreateSettings component.ExporterCreateSettings
}

ExporterSettings are settings for creating an Exporter.

type Processor added in v0.23.0

type Processor struct {
	// contains filtered or unexported fields
}

Processor is a helper to add observability to a component.Processor.

func NewProcessor added in v0.23.0

func NewProcessor(cfg ProcessorSettings) *Processor

NewProcessor creates a new Processor.

func (*Processor) LogsAccepted added in v0.23.0

func (por *Processor) LogsAccepted(ctx context.Context, numRecords int)

LogsAccepted reports that the logs were accepted.

func (*Processor) LogsDropped added in v0.23.0

func (por *Processor) LogsDropped(ctx context.Context, numRecords int)

LogsDropped reports that the logs were dropped.

func (*Processor) LogsRefused added in v0.23.0

func (por *Processor) LogsRefused(ctx context.Context, numRecords int)

LogsRefused reports that the logs were refused.

func (*Processor) MetricsAccepted added in v0.23.0

func (por *Processor) MetricsAccepted(ctx context.Context, numPoints int)

MetricsAccepted reports that the metrics were accepted.

func (*Processor) MetricsDropped added in v0.23.0

func (por *Processor) MetricsDropped(ctx context.Context, numPoints int)

MetricsDropped reports that the metrics were dropped.

func (*Processor) MetricsRefused added in v0.23.0

func (por *Processor) MetricsRefused(ctx context.Context, numPoints int)

MetricsRefused reports that the metrics were refused.

func (*Processor) TracesAccepted added in v0.23.0

func (por *Processor) TracesAccepted(ctx context.Context, numSpans int)

TracesAccepted reports that the trace data was accepted.

func (*Processor) TracesDropped added in v0.23.0

func (por *Processor) TracesDropped(ctx context.Context, numSpans int)

TracesDropped reports that the trace data was dropped.

func (*Processor) TracesRefused added in v0.23.0

func (por *Processor) TracesRefused(ctx context.Context, numSpans int)

TracesRefused reports that the trace data was refused.

type ProcessorSettings added in v0.23.0

type ProcessorSettings struct {
	Level                   configtelemetry.Level
	ProcessorID             config.ComponentID
	ProcessorCreateSettings component.ProcessorCreateSettings
}

ProcessorSettings are settings for creating a Processor.

type Receiver added in v0.28.0

type Receiver struct {
	// contains filtered or unexported fields
}

Receiver is a helper to add observability to a component.Receiver.

func NewReceiver added in v0.28.0

func NewReceiver(cfg ReceiverSettings) *Receiver

NewReceiver creates a new Receiver.

func (*Receiver) EndLogsOp added in v0.28.0

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 added in v0.28.0

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 added in v0.28.0

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 added in v0.28.0

func (rec *Receiver) StartLogsOp(operationCtx context.Context) context.Context

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 added in v0.28.0

func (rec *Receiver) StartMetricsOp(operationCtx context.Context) context.Context

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.

func (*Receiver) StartTracesOp added in v0.28.0

func (rec *Receiver) StartTracesOp(operationCtx context.Context) context.Context

StartTracesOp 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 added in v0.28.0

type ReceiverSettings struct {
	ReceiverID config.ComponentID
	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 component.ReceiverCreateSettings
}

ReceiverSettings are settings for creating an Receiver.

type Scraper added in v0.29.0

type Scraper struct {
	// contains filtered or unexported fields
}

Scraper is a helper to add observability to a component.Scraper.

func NewScraper added in v0.29.0

func NewScraper(cfg ScraperSettings) *Scraper

NewScraper creates a new Scraper.

func (*Scraper) EndMetricsOp added in v0.29.0

func (s *Scraper) EndMetricsOp(
	scraperCtx context.Context,
	numScrapedMetrics int,
	err error,
)

EndMetricsOp completes the scrape operation that was started with StartMetricsOp.

func (*Scraper) StartMetricsOp added in v0.29.0

func (s *Scraper) StartMetricsOp(ctx context.Context) context.Context

StartMetricsOp is called when a scrape operation is started. The returned context should be used in other calls to the obsreport functions dealing with the same scrape operation.

type ScraperSettings added in v0.29.0

type ScraperSettings struct {
	ReceiverID             config.ComponentID
	Scraper                config.ComponentID
	ReceiverCreateSettings component.ReceiverCreateSettings
}

ScraperSettings are settings for creating a Scraper.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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