traefik/docs/content/observability/metrics/opentelemetry.md
2024-09-27 11:58:05 +02:00

9.3 KiB

title description
Traefik OpenTelemetry Documentation Traefik supports several metrics backends, including OpenTelemetry. Learn how to implement it for observability in Traefik Proxy. Read the technical documentation.

OpenTelemetry

To enable the OpenTelemetry metrics:

metrics:
  otlp: {}
[metrics]
  [metrics.otlp]
--metrics.otlp=true

!!! info "Default protocol"

The OpenTelemetry exporter will export metrics to the collector using HTTP by default to https://localhost:4318/v1/metrics, see the [gRPC Section](#grpc-configuration) to use gRPC.

addEntryPointsLabels

Optional, Default=true

Enable metrics on entry points.

metrics:
  otlp:
    addEntryPointsLabels: true
[metrics]
  [metrics.otlp]
    addEntryPointsLabels = true
--metrics.otlp.addEntryPointsLabels=true

addRoutersLabels

Optional, Default=false

Enable metrics on routers.

metrics:
  otlp:
    addRoutersLabels: true
[metrics]
  [metrics.otlp]
    addRoutersLabels = true
--metrics.otlp.addRoutersLabels=true

addServicesLabels

Optional, Default=true

Enable metrics on services.

metrics:
  otlp:
    addServicesLabels: true
[metrics]
  [metrics.otlp]
    addServicesLabels = true
--metrics.otlp.addServicesLabels=true

explicitBoundaries

Optional, Default=".005, .01, .025, .05, .1, .25, .5, 1, 2.5, 5, 10"

Explicit boundaries for Histogram data points.

metrics:
  otlp:
    explicitBoundaries:
      - 0.1
      - 0.3
      - 1.2
      - 5.0
[metrics]
  [metrics.otlp]
    explicitBoundaries = [0.1,0.3,1.2,5.0]
--metrics.otlp.explicitBoundaries=0.1,0.3,1.2,5.0

pushInterval

Optional, Default=10s

Interval at which metrics are sent to the OpenTelemetry Collector.

metrics:
  otlp:
    pushInterval: 10s
[metrics]
  [metrics.otlp]
    pushInterval = "10s"
--metrics.otlp.pushInterval=10s

serviceName

Optional, Default="traefik"

OTEL service name to use.

metrics:
  otlp:
    serviceName: name
[metrics]
  [metrics.otlp]
    serviceName = "name"
--metrics.otlp.serviceName=name

HTTP configuration

Optional

This instructs the exporter to send the metrics to the OpenTelemetry Collector using HTTP.

metrics:
  otlp:
    http: {}
[metrics]
  [metrics.otlp.http]
--metrics.otlp.http=true

endpoint

Required, Default="http://localhost:4318/v1/metrics", Format="<scheme>://<host>:<port><path>"

URL of the OpenTelemetry Collector to send metrics to.

metrics:
  otlp:
    http:
      endpoint: http://localhost:4318/v1/metrics
[metrics]
  [metrics.otlp.http]
    endpoint = "http://localhost:4318/v1/metrics"
--metrics.otlp.http.endpoint=http://localhost:4318/v1/metrics

headers

Optional, Default={}

Additional headers sent with metrics by the exporter to the OpenTelemetry Collector.

metrics:
  otlp:
    http:
      headers:
        foo: bar
        baz: buz
[metrics]
  [metrics.otlp.http.headers]
    foo = "bar"
    baz = "buz"
--metrics.otlp.http.headers.foo=bar --metrics.otlp.http.headers.baz=buz

tls

Optional

Defines the Client TLS configuration used by the exporter to send metrics to the OpenTelemetry Collector.

ca

Optional

ca is the path to the certificate authority used for the secure connection to the OpenTelemetry Collector, it defaults to the system bundle.

metrics:
  otlp:
    http:
      tls:
        ca: path/to/ca.crt
[metrics.otlp.http.tls]
  ca = "path/to/ca.crt"
--metrics.otlp.http.tls.ca=path/to/ca.crt
cert

Optional

cert is the path to the public certificate used for the secure connection to the OpenTelemetry Collector. When using this option, setting the key option is required.

metrics:
  otlp:
    http:
      tls:
        cert: path/to/foo.cert
        key: path/to/foo.key
[metrics.otlp.http.tls]
  cert = "path/to/foo.cert"
  key = "path/to/foo.key"
--metrics.otlp.http.tls.cert=path/to/foo.cert
--metrics.otlp.http.tls.key=path/to/foo.key
key

Optional

key is the path to the private key used for the secure connection to the OpenTelemetry Collector. When using this option, setting the cert option is required.

metrics:
  otlp:
    http:
      tls:
        cert: path/to/foo.cert
        key: path/to/foo.key
[metrics.otlp.http.tls]
  cert = "path/to/foo.cert"
  key = "path/to/foo.key"
--metrics.otlp.http.tls.cert=path/to/foo.cert
--metrics.otlp.http.tls.key=path/to/foo.key
insecureSkipVerify

Optional, Default=false

If insecureSkipVerify is true, the TLS connection to the OpenTelemetry Collector accepts any certificate presented by the server regardless of the hostnames it covers.

metrics:
  otlp:
    http:
      tls:
        insecureSkipVerify: true
[metrics.otlp.http.tls]
  insecureSkipVerify = true
--metrics.otlp.http.tls.insecureSkipVerify=true

gRPC configuration

Optional

This instructs the exporter to send metrics to the OpenTelemetry Collector using gRPC.

metrics:
  otlp:
    grpc: {}
[metrics]
  [metrics.otlp.grpc]
--metrics.otlp.grpc=true

endpoint

Required, Default="localhost:4317", Format="<host>:<port>"

Address of the OpenTelemetry Collector to send metrics to.

metrics:
  otlp:
    grpc:
      endpoint: localhost:4317
[metrics]
  [metrics.otlp.grpc]
    endpoint = "localhost:4317"
--metrics.otlp.grpc.endpoint=localhost:4317

insecure

Optional, Default=false

Allows exporter to send metrics to the OpenTelemetry Collector without using a secured protocol.

metrics:
  otlp:
    grpc:
      insecure: true
[metrics]
  [metrics.otlp.grpc]
    insecure = true
--metrics.otlp.grpc.insecure=true

headers

Optional, Default={}

Additional headers sent with metrics by the exporter to the OpenTelemetry Collector.

metrics:
  otlp:
    grpc:
      headers:
        foo: bar
        baz: buz
[metrics]
  [metrics.otlp.grpc.headers]
    foo = "bar"
    baz = "buz"
--metrics.otlp.grpc.headers.foo=bar --metrics.otlp.grpc.headers.baz=buz

tls

Optional

Defines the Client TLS configuration used by the exporter to send metrics to the OpenTelemetry Collector.

ca

Optional

ca is the path to the certificate authority used for the secure connection to the OpenTelemetry Collector, it defaults to the system bundle.

metrics:
  otlp:
    grpc:
      tls:
        ca: path/to/ca.crt
[metrics.otlp.grpc.tls]
  ca = "path/to/ca.crt"
--metrics.otlp.grpc.tls.ca=path/to/ca.crt
cert

Optional

cert is the path to the public certificate used for the secure connection to the OpenTelemetry Collector. When using this option, setting the key option is required.

metrics:
  otlp:
    grpc:
      tls:
        cert: path/to/foo.cert
        key: path/to/foo.key
[metrics.otlp.grpc.tls]
  cert = "path/to/foo.cert"
  key = "path/to/foo.key"
--metrics.otlp.grpc.tls.cert=path/to/foo.cert
--metrics.otlp.grpc.tls.key=path/to/foo.key
key

Optional

key is the path to the private key used for the secure connection to the OpenTelemetry Collector. When using this option, setting the cert option is required.

metrics:
  otlp:
    grpc:
      tls:
        cert: path/to/foo.cert
        key: path/to/foo.key
[metrics.otlp.grpc.tls]
  cert = "path/to/foo.cert"
  key = "path/to/foo.key"
--metrics.otlp.grpc.tls.cert=path/to/foo.cert
--metrics.otlp.grpc.tls.key=path/to/foo.key
insecureSkipVerify

Optional, Default=false

If insecureSkipVerify is true, the TLS connection to the OpenTelemetry Collector accepts any certificate presented by the server regardless of the hostnames it covers.

metrics:
  otlp:
    grpc:
      tls:
        insecureSkipVerify: true
[metrics.otlp.grpc.tls]
  insecureSkipVerify = true
--metrics.otlp.grpc.tls.insecureSkipVerify=true