connector

package module
v0.110.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: Apache-2.0 Imports: 7 Imported by: 83

README

Connectors

A connector is both an exporter and receiver. As the name suggests a Connector connects two pipelines: it emits data as an exporter at the end of one pipeline and consumes data as a receiver at the start of another pipeline. It may consume and emit data of the same data type, or of different data types. A connector may generate and emit data to summarize the consumed data, or it may simply replicate or route data.

Supported Data Types

Each type of connector is designed to work with one or more pairs of data types and may only be used to connect pipelines accordingly. (Recall that every pipeline is associated with a single data type, either traces, metrics, or logs.)

For example, the count connector counts traces, metrics, and logs, and reports the counts as a metric. Therefore, it may be used to connect the following types of pipelines.

Exporter Pipeline Type Receiver Pipeline Type
traces metrics
metrics metrics
logs metrics

Another example, the router connector, is useful for routing data onto the appropriate pipeline so that it may be processed in distinct ways and/or exported to an appropriate backend. It does not alter the data it consumes in any ways, nor does it produce any additional data. Therefore, it may be used to connect the following types of pipelines.

Exporter Pipeline Type Receiver Pipeline Type
traces traces
metrics metrics
logs logs

Configuration

Declaration

Connectors are defined within a dedicated connectors section at the top level of the collector config.

The count connector may be used with default settings.

receivers:
  foo:
exporters:
  bar:
connectors:
  count:
  router:
Usage

Recall that a connector is an exporter and a receiver and that each connector MUST be used as both, in separate pipelines.

receivers:
  foo:
exporters:
  bar:
connectors:
  count:
service:
  pipelines:
    traces:
      receivers: [foo]
      exporters: [count]
    metrics:
      receivers: [count]
      exporters: [bar]

Connectors can be used alongside traditional exporters.

receivers:
  foo:
exporters:
  bar/traces_backend:
  bar/metrics_backend:
connectors:
  count:
service:
  pipelines:
    traces:
      receivers: [foo]
      exporters: [bar/traces_backend, count]
    metrics:
      receivers: [count]
      exporters: [bar/metrics_backend]

Connectors can be used alongside traditional receivers.

receivers:
  foo/traces:
  foo/metrics:
exporters:
  bar:
connectors:
  count:
service:
  pipelines:
    traces:
      receivers: [foo/traces]
      exporters: [count]
    metrics:
      receivers: [foo/metrics, count]
      exporters: [bar]

A connector can be an exporter in multiple pipelines.

receivers:
  foo/traces:
  foo/metrics:
  foo/logs:
exporters:
  bar/traces_backend:
  bar/metrics_backend:
  bar/logs_backend:
connectors:
  count:
service:
  pipelines:
    traces:
      receivers: [foo/traces]
      exporters: [bar/traces_backend, count]
    metrics:
      receivers: [foo/metrics]
      exporters: [bar/metrics_backend, count]
    logs:
      receivers: [foo/logs]
      exporters: [bar/logs_backend, count]
    metrics/counts:
      receivers: [count]
      exporters: [bar/metrics_backend]

A connector can be a receiver in multiple pipelines.

receivers:
  foo/traces:
  foo/metrics:
exporters:
  bar/traces_backend:
  bar/metrics_backend:
  bar/metrics_backend/2:
connectors:
  count:
service:
  pipelines:
    traces:
      receivers: [foo/traces]
      exporters: [bar/traces_backend, count]
    metrics:
      receivers: [count]
      exporters: [bar/metrics_backend]
    metrics/2:
      receivers: [count]
      exporters: [bar/metrics_backend/2]

Multiple connectors can be used in sequence.

receivers:
  foo:
exporters:
  bar:
connectors:
  count:
  count/the_counts:
service:
  pipelines:
    traces:
      receivers: [foo]
      exporters: [count]
    metrics:
      receivers: [count]
      exporters: [bar/metrics_backend, count/the_counts]
    metrics/count_the_counts:
      receivers: [count/the_counts]
      exporters: [bar]

A connector can only be used in a pair of pipelines when it supports the combination of Exporter Pipeline Type and Receiver Pipeline Type.

receivers:
  foo:
exporters:
  bar:
connectors:
  count:
service:
  pipelines:
    traces:
      receivers: [foo]
      exporters: [count]
    logs:
      receivers: [count] # Invalid. The count connector does not support traces -> logs.
      exporters: [bar]
Exporter Pipeline Type

The type of pipeline in which a connector is used as an exporter.

Receiver Pipeline Type

The type of pipeline in which the connector is used as a receiver.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeFactoryMap

func MakeFactoryMap(factories ...Factory) (map[component.Type]Factory, error)

MakeFactoryMap takes a list of connector factories and returns a map with factory type as keys. It returns a non-nil error when there are factories with duplicate type.

Types

type CreateLogsToLogsFunc

type CreateLogsToLogsFunc = internal.CreateLogsToLogsFunc

CreateLogsToLogsFunc is the equivalent of Factory.CreateLogsToLogs().

type CreateLogsToMetricsFunc

type CreateLogsToMetricsFunc = internal.CreateLogsToMetricsFunc

CreateLogsToMetricsFunc is the equivalent of Factory.CreateLogsToMetrics().

type CreateLogsToTracesFunc

type CreateLogsToTracesFunc = internal.CreateLogsToTracesFunc

CreateLogsToTracesFunc is the equivalent of Factory.CreateLogsToTraces().

type CreateMetricsToLogsFunc

type CreateMetricsToLogsFunc = internal.CreateMetricsToLogsFunc

CreateMetricsToLogsFunc is the equivalent of Factory.CreateMetricsToLogs().

type CreateMetricsToMetricsFunc

type CreateMetricsToMetricsFunc = internal.CreateMetricsToMetricsFunc

CreateMetricsToMetricsFunc is the equivalent of Factory.CreateMetricsToTraces().

type CreateMetricsToTracesFunc

type CreateMetricsToTracesFunc = internal.CreateMetricsToTracesFunc

CreateMetricsToTracesFunc is the equivalent of Factory.CreateMetricsToTraces().

type CreateTracesToLogsFunc

type CreateTracesToLogsFunc = internal.CreateTracesToLogsFunc

CreateTracesToLogsFunc is the equivalent of Factory.CreateTracesToLogs().

type CreateTracesToMetricsFunc

type CreateTracesToMetricsFunc = internal.CreateTracesToMetricsFunc

CreateTracesToMetricsFunc is the equivalent of Factory.CreateTracesToMetrics().

type CreateTracesToTracesFunc

type CreateTracesToTracesFunc = internal.CreateTracesToTracesFunc

CreateTracesToTracesFunc is the equivalent of Factory.CreateTracesToTraces().

type Factory

type Factory = internal.Factory

Factory is factory interface for connectors.

This interface cannot be directly implemented. Implementations must use the NewFactory to implement it.

func NewFactory

func NewFactory(cfgType component.Type, createDefaultConfig component.CreateDefaultConfigFunc, options ...FactoryOption) Factory

NewFactory returns a Factory.

type FactoryOption

type FactoryOption = internal.FactoryOption

FactoryOption applies changes to Factory.

func WithLogsToLogs

func WithLogsToLogs(createLogsToLogs CreateLogsToLogsFunc, sl component.StabilityLevel) FactoryOption

WithLogsToLogs overrides the default "error not supported" implementation for WithLogsToLogs and the default "undefined" stability level.

func WithLogsToMetrics

func WithLogsToMetrics(createLogsToMetrics CreateLogsToMetricsFunc, sl component.StabilityLevel) FactoryOption

WithLogsToMetrics overrides the default "error not supported" implementation for WithLogsToMetrics and the default "undefined" stability level.

func WithLogsToTraces

func WithLogsToTraces(createLogsToTraces CreateLogsToTracesFunc, sl component.StabilityLevel) FactoryOption

WithLogsToTraces overrides the default "error not supported" implementation for WithLogsToTraces and the default "undefined" stability level.

func WithMetricsToLogs

func WithMetricsToLogs(createMetricsToLogs CreateMetricsToLogsFunc, sl component.StabilityLevel) FactoryOption

WithMetricsToLogs overrides the default "error not supported" implementation for WithMetricsToLogs and the default "undefined" stability level.

func WithMetricsToMetrics

func WithMetricsToMetrics(createMetricsToMetrics CreateMetricsToMetricsFunc, sl component.StabilityLevel) FactoryOption

WithMetricsToMetrics overrides the default "error not supported" implementation for WithMetricsToMetrics and the default "undefined" stability level.

func WithMetricsToTraces

func WithMetricsToTraces(createMetricsToTraces CreateMetricsToTracesFunc, sl component.StabilityLevel) FactoryOption

WithMetricsToTraces overrides the default "error not supported" implementation for WithMetricsToTraces and the default "undefined" stability level.

func WithTracesToLogs

func WithTracesToLogs(createTracesToLogs CreateTracesToLogsFunc, sl component.StabilityLevel) FactoryOption

WithTracesToLogs overrides the default "error not supported" implementation for WithTracesToLogs and the default "undefined" stability level.

func WithTracesToMetrics

func WithTracesToMetrics(createTracesToMetrics CreateTracesToMetricsFunc, sl component.StabilityLevel) FactoryOption

WithTracesToMetrics overrides the default "error not supported" implementation for WithTracesToMetrics and the default "undefined" stability level.

func WithTracesToTraces

func WithTracesToTraces(createTracesToTraces CreateTracesToTracesFunc, sl component.StabilityLevel) FactoryOption

WithTracesToTraces overrides the default "error not supported" implementation for WithTracesToTraces and the default "undefined" stability level.

type Logs

type Logs = internal.Logs

A Logs connector acts as an exporter from a logs pipeline and a receiver to one or more traces, metrics, or logs pipelines. Logs feeds a consumer.Traces, consumer.Metrics, or consumer.Logs with data.

Examples:

  • Structured logs containing span information could be consumed and emitted as traces.
  • Metrics could be extracted from structured logs that contain numeric data.
  • Logs could be collected in one pipeline and routed to another logs pipeline based on criteria such as attributes or other content of the log. The second pipeline can then process and export the log to the appropriate backend.

type LogsRouterAndConsumer added in v0.92.0

type LogsRouterAndConsumer interface {
	consumer.Logs
	Consumer(...pipeline.ID) (consumer.Logs, error)
	PipelineIDs() []pipeline.ID
	// contains filtered or unexported methods
}

LogsRouterAndConsumer feeds the first consumer.Logs in each of the specified pipelines.

func NewLogsRouter added in v0.92.0

func NewLogsRouter(cm map[pipeline.ID]consumer.Logs) LogsRouterAndConsumer

type Metrics

type Metrics = internal.Metrics

A Metrics connector acts as an exporter from a metrics pipeline and a receiver to one or more traces, metrics, or logs pipelines. Metrics feeds a consumer.Traces, consumer.Metrics, or consumer.Logs with data.

Examples:

  • Latency between related data points could be modeled and emitted as traces.
  • Metrics could be collected in one pipeline and routed to another metrics pipeline based on criteria such as attributes or other content of the metric. The second pipeline can then process and export the metric to the appropriate backend.
  • Metrics could be analyzed by a logs connector that emits events when particular criteria are met.

type MetricsRouterAndConsumer added in v0.92.0

type MetricsRouterAndConsumer interface {
	consumer.Metrics
	Consumer(...pipeline.ID) (consumer.Metrics, error)
	PipelineIDs() []pipeline.ID
	// contains filtered or unexported methods
}

MetricsRouterAndConsumer feeds the first consumer.Metrics in each of the specified pipelines.

func NewMetricsRouter added in v0.92.0

func NewMetricsRouter(cm map[pipeline.ID]consumer.Metrics) MetricsRouterAndConsumer

type Settings added in v0.103.0

type Settings = internal.Settings

Settings configures Connector creators.

type Traces

type Traces = internal.Traces

A Traces connector acts as an exporter from a traces pipeline and a receiver to one or more traces, metrics, or logs pipelines. Traces feeds a consumer.Traces, consumer.Metrics, or consumer.Logs with data.

Examples:

  • Traces could be collected in one pipeline and routed to another traces pipeline based on criteria such as attributes or other content of the trace. The second pipeline can then process and export the trace to the appropriate backend.
  • Traces could be summarized by a metrics connector that emits statistics describing the number of traces observed.
  • Traces could be analyzed by a logs connector that emits events when particular criteria are met.

type TracesRouterAndConsumer added in v0.92.0

type TracesRouterAndConsumer interface {
	consumer.Traces
	Consumer(...pipeline.ID) (consumer.Traces, error)
	PipelineIDs() []pipeline.ID
	// contains filtered or unexported methods
}

TracesRouterAndConsumer feeds the first consumer.Traces in each of the specified pipelines.

func NewTracesRouter added in v0.92.0

func NewTracesRouter(cm map[pipeline.ID]consumer.Traces) TracesRouterAndConsumer

Directories

Path Synopsis
xconnector module

Jump to

Keyboard shortcuts

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