Skip to content

Add common OpenTelemetry configurations #903

Description

@obs-gh-peternguyen

Enhancement Request

Requesting feature to add common OpenTelemetry configurations such as:
https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/

OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
OTEL_EXPORTER_OTLP_TRACES_HEADERS
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL

OTEL_EXPORTER_OTLP_METRICS_ENDPOINT
OTEL_EXPORTER_OTLP_METRICS_HEADERS
OTEL_EXPORTER_OTLP_METRICS_PROTOCOL

OTEL_EXPORTER_OTLP_LOGS_ENDPOINT
OTEL_EXPORTER_OTLP_LOGS_HEADERS
OTEL_EXPORTER_OTLP_LOGS_PROTOCOL

OTEL_RESOURCE_ATTRIBUTES

Flags could then be used as follows:

docker run -d --name ktranslate `
  -v /opt/ktranslate/snmp.yaml:/etc/ktranslate/snmp.yaml `
  kentik/ktranslate:next `
--format=otel `
--otel.traces.protocol=http `
--otel.traces.endpoint=https://${ENDPOINT}/v1/traces `
--otel.traces.headers=Authorization=Bearer ${TOKEN} `
--otel.metrics.protocol=http `
--otel.metrics.endpoint=https://${ENDPOINT}/v1/metrics `
--otel.metrics.headers=Authorization=Bearer ${TOKEN} `
--otel.logs.protocol=http `
--otel.logs.endpoint=https://${ENDPOINT}/v1/logs `
--otel.logs.headers=Authorization=Bearer ${TOKEN} `
--otel.resource.attributes=service.name=ktranslate,service.instance.id=docker,service.namespace=default
--snmp=/etc/ktranslate/snmp.yaml `
--sinks=otel `
--metrics=jchf `
--tee_logs=true `
--service_name=snmp `
--max_flows_per_message=100 `
--snmp_discovery_on_start=true `
--snmp_discovery_min=720"

Currently, only these otel flags (for example) appear to work, which limits the data to a single endpoint.

--otel.protocol="http" `
--otel.endpoint="http://host.docker.internal:4318" 

Use Cases

  1. Many external destinations require authentication, so a flag like --otel.headers would be great to have (similar to how --http_header is already working to be able to add multiple headers if needed).
  2. Some systems do not have enough resources to spin up another container to host a local collector, so sending directly to the destination from ktranslate would be preferred
  3. There are instances when logs must be sent to a separate destination for analysis or for security reasons. Having an option to split out where logs, metrics, and traces are sent would help route the data if needed.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions