routingconnector

package module
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 15 Imported by: 2

README

Routing Connector

Status
Distributions contrib
Issues Open issues Closed issues
Code Owners @jpkrohling, @mwear

Supported Pipeline Types

Exporter Pipeline Type Receiver Pipeline Type Stability Level
traces traces alpha
metrics metrics alpha
logs logs alpha

Routes logs, metrics or traces based on resource attributes to specific pipelines using OpenTelemetry Transformation Language (OTTL) statements as routing conditions.

Configuration

If you are not already familiar with connectors, you may find it helpful to first visit the Connectors README.

The following settings are available:

  • table (required): the routing table for this connector.
  • table.statement (required): the routing condition provided as the OTTL statement.
  • table.pipelines (required): the list of pipelines to use when the routing condition is met.
  • default_pipelines (optional): contains the list of pipelines to use when a record does not meet any of specified conditions.
  • error_mode (optional): determines how errors returned from OTTL statements are handled. Valid values are propagate, ignore and silent. If ignore or silent is used and a statement's condition has an error then the payload will be routed to the default pipelines. When silent is used the error is not logged. If not supplied, propagate is used.
  • match_once (optional, default: false): determines whether the connector matches multiple statements or not. If enabled, the payload will be routed to the first pipeline in the table whose routing condition is met.

Example:

receivers:
    otlp:

exporters:
  jaeger:
    endpoint: localhost:14250
  jaeger/acme:
    endpoint: localhost:24250
  jaeger/ecorp:
    endpoint: localhost:34250

connectors:
  routing:
    default_pipelines: [traces/jaeger]
    error_mode: ignore
    match_once: false
    table:
      - statement: route() where attributes["X-Tenant"] == "acme"
        pipelines: [traces/jaeger-acme]
      - statement: delete_key(attributes, "X-Tenant") where IsMatch(attributes["X-Tenant"], ".*corp")
        pipelines: [traces/jaeger-ecorp]

  routing/match_once:
    default_pipelines: [traces/jaeger]
    error_mode: ignore
    match_once: true
    table:
      - statement: route() where attributes["X-Tenant"] == "acme"
        pipelines: [traces/jaeger-acme]
      - statement: route() where attributes["X-Tenant"] == ".*acme"
        pipelines: [traces/jaeger-ecorp]

service:
  pipelines:
    traces/in:
      receivers: [otlp]
      exporters: [routing]
    traces/jaeger:
      receivers: [routing]
      exporters: [jaeger]
    traces/jaeger-acme:
      receivers: [routing]
      exporters: [jaeger/acme]
    traces/jaeger-ecorp:
      receivers: [routing]
      exporters: [jaeger/ecorp]

A signal may get matched by routing conditions of more than one routing table entry. In this case, the signal will be routed to all pipelines of matching routes. Respectively, if none of the routing conditions met, then a signal is routed to default pipelines.

Differences between the Routing Connector and Routing Processor

  • The connector will only route using OTTL statements which can only be applied to resource attributes. It does not support matching on context values at this time.
  • The connector routes to pipelines, not exporters as the processor does.
OTTL Limitations
  • Currently, it is not possible to specify boolean statements without function invocation as the routing condition. It is required to provide the NOOP route() or any other supported function as part of the routing statement, see #13545 for more information.
  • Supported OTTL functions:

Additional Settings

The full list of settings exposed for this connector are documented here with detailed sample configuration files:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFactory

func NewFactory() connector.Factory

NewFactory returns a ConnectorFactory.

Types

type Config

type Config struct {
	// DefaultPipelines contains the list of pipelines to use when a more specific record can't be
	// found in the routing table.
	// Optional.
	DefaultPipelines []component.ID `mapstructure:"default_pipelines"`

	// ErrorMode determines how the processor reacts to errors that occur while processing an OTTL
	// condition.
	// Valid values are `ignore` and `propagate`.
	// `ignore` means the processor ignores errors returned by conditions and continues on to the
	// next condition. This is the recommended mode. If `ignore` is used and a statement's
	// condition has an error then the payload will be routed to the default exporter. `propagate`
	// means the processor returns the error up the pipeline.  This will result in the payload being
	// dropped from the collector.
	// The default value is `propagate`.
	ErrorMode ottl.ErrorMode `mapstructure:"error_mode"`

	// Table contains the routing table for this processor.
	// Required.
	Table []RoutingTableItem `mapstructure:"table"`

	// MatchOnce determines whether the connector matches multiple statements.
	// Optional.
	MatchOnce bool `mapstructure:"match_once"`
}

Config defines configuration for the Routing processor.

func (*Config) Validate

func (c *Config) Validate() error

Validate checks if the processor configuration is valid.

type RoutingTableItem

type RoutingTableItem struct {
	// Statement is a OTTL statement used for making a routing decision.
	// Required when 'Value' isn't provided.
	Statement string `mapstructure:"statement"`

	// Pipelines contains the list of pipelines to use when the value from the FromAttribute field
	// matches this table item. When no pipelines are specified, the ones specified under
	// DefaultPipelines are used, if any.
	// The routing processor will fail upon the first failure from these pipelines.
	// Optional.
	Pipelines []component.ID `mapstructure:"pipelines"`
}

RoutingTableItem specifies how data should be routed to the different pipelines

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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