Skip to content

New OpenTelemetry HTTP support doesn't honour HTTP(S)_PROXY values #18822

@wadawe

Description

@wadawe

Relevant telegraf.conf

[[outputs.opentelemetry]]
  service_address = "https://{{ metrics_fqdn }}/otlp/v1/metrics"
  timeout = "10s"
  tls_cert = "/etc/mtls.pem"
  tls_key = "/etc/mtls.key"
  tls_ca = "/etc/mtls.pem"

Logs from Telegraf

Error writing to outputs.opentelemetry: Post "https://{{ metrics_fqdn }}/otlp/v1/metrics": context deadline exceeded

System info

Telegraf 1.38.2, Docker 19.03.13, Rhel 7.8

Docker

No response

Steps to reproduce

  1. Configure Telegraf to use the opentelemetry output via grpc; with relevant tls configuration.
  2. Deploy a Telegraf docker container with HTTPS_PROXY and HTTP_PROXY set.
  3. Metrics are sent.
  4. Configure Telegraf with the same config; but switch to http instead of grpc.
  5. Deploy a Telegraf docker container with HTTPS_PROXY and HTTP_PROXY set.
  6. Metrics are not sent, and are instead buffered.
    ...

Expected behavior

outputs.opentelemetry should respect HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables when using either OTLP or HTTP, including when TLS options such as tls_ca, tls_cert, and tls_key are configured.

Actual behavior

When using outputs.opentelemetry over HTTP, the plugin does not appear to respect HTTP_PROXY / HTTPS_PROXY when TLS is enabled. Instead of routing through the proxy, Telegraf attempts a direct connection to the endpoint and eventually fails.

In contrast, switching the same configuration to gRPC works as expected... Metrics are successfully delivered, suggesting that connectivity, TLS configuration, and the endpoint itself are all valid.

This means there's inconsistency between the two protocols: gRPC honours proxy environment variables, while HTTP does not...

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugunexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions