Skip to content

opentelemetry tracer: add OTLP/HTTP exporter#29207

Merged
wbpcode merged 49 commits intoenvoyproxy:mainfrom
dynatrace-oss-contrib:otlp-http-exporter-continue
Oct 18, 2023
Merged

opentelemetry tracer: add OTLP/HTTP exporter#29207
wbpcode merged 49 commits intoenvoyproxy:mainfrom
dynatrace-oss-contrib:otlp-http-exporter-continue

Conversation

@joaopgrassi
Copy link
Contributor

@joaopgrassi joaopgrassi commented Aug 23, 2023

Commit Message:
Add OTLP/HTTP exporter to OpenTelemetry Tracer

Co-authored-by: Alex Ellis ellisonjtk@gmail.com

Additional Description: This PR refactors the OpenTelemetry tracer, allowing it to export OTLP data via HTTP. It refactors the existing gRPC exporter into a general exporter, so the functionality can be shared between the gRPC and the new HTTP exporters. The HTTP exporter is relatively simple: it accesses the thread local cluster for the configured cluster, then sends the OTLP request.

Risk Level: Low (new, optional functionality for existing tracing extension)

Testing: Unit test and manual tests performed, exporting spans to a local OTel collector and a public/external back-end via OTLP/HTTP. Also performed tests exporting to a local OTel collector via gRPC to ensure the existing feature is unaffected.

Fixes #26352

Note: This is a continuation of #28454 as previously discussed and agreed with @AlexanderEllis and @htuch.

For posterity, here's how a "full" configuration looks like:

tracing:
  provider:
    name: envoy.tracers.opentelemetry
    typed_config:
      "@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig
      service_name: envoy-HTTP-exporter
      http_config:
        cluster_name: my_backend
        traces_path: "/api/otlp/v1/traces"
        hostname: "my-backend.com"
        headers:
          - key: "Authorization"
            value: "auth-token"
          - key: "x-custom-header"
            value: "something-custom"
        timeout: 5s

AlexanderEllis and others added 16 commits August 23, 2023 10:08
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Alex Ellis <ellisonjtk@gmail.com>
Signed-off-by: Joao Grassi <joao.grassi@dynatrace.com>
Signed-off-by: Joao Grassi <joao.grassi@dynatrace.com>
@joaopgrassi joaopgrassi requested a review from htuch as a code owner August 23, 2023 08:15
@repokitteh-read-only
Copy link

Hi @joaopgrassi, welcome and thank you for your contribution.

We will try to review your Pull Request as quickly as possible.

In the meantime, please take a look at the contribution guidelines if you have not done so already.

🐱

Caused by: #29207 was opened by joaopgrassi.

see: more, trace.

@repokitteh-read-only
Copy link

CC @envoyproxy/api-shepherds: Your approval is needed for changes made to (api/envoy/|docs/root/api-docs/).
envoyproxy/api-shepherds assignee is @adisuissa
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #29207 was opened by joaopgrassi.

see: more, trace.

Signed-off-by: Joao Grassi <joao.grassi@dynatrace.com>
@phlax
Copy link
Member

phlax commented Aug 29, 2023

@AlexanderEllis @htuch @adisuissa seems this is wating on further review/feedback

/wait-any

Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Some new comments are added.

Signed-off-by: Joao Grassi <joao.grassi@dynatrace.com>
@joaopgrassi joaopgrassi requested a review from wbpcode October 17, 2023 15:47
@joaopgrassi
Copy link
Contributor Author

@wbpcode tried addressing the "copy" of headers. Please let me know what you think! thank you 🙌

wbpcode
wbpcode previously approved these changes Oct 18, 2023
Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@wbpcode wbpcode added this to the 1.28.0 milestone Oct 18, 2023
Signed-off-by: Joao Grassi <joao.grassi@dynatrace.com>
Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

@wbpcode wbpcode enabled auto-merge (squash) October 18, 2023 06:40
@wbpcode wbpcode merged commit 767cb40 into envoyproxy:main Oct 18, 2023
@joaopgrassi joaopgrassi deleted the otlp-http-exporter-continue branch October 18, 2023 08:28
codefromthecrypt added a commit to codefromthecrypt/envoy that referenced this pull request Dec 7, 2025
Adds HTTP transport support to the OpenTelemetry access logger, complementing
envoyproxy#29207 (OTLP/HTTP tracing). This enables direct OTLP log export to backends
that only accept HTTP (Dynatrace, Datadog, Logfire), without requiring an
intermediate collector sidecar.

Changes:
- Add http_service field for OTLP/HTTP transport configuration
- Add top-level grpc_service, log_name, buffer_flush_interval, buffer_size_bytes,
  filter_state_objects_to_log, and custom_tags fields to match tracer config pattern
- Add field_migrate.oneof_promotion annotations for future oneof migration
- Add helper functions getLogName() and getGrpcService() with fallback to common_config
- Add transport validation (exactly one transport must be configured)
- Deprecate common_config field (still functional for backward compatibility)
- Extract shared utilities (otlp_log_utils) from duplicated HTTP/gRPC code

Fixes envoyproxy#26352 (access logs portion)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/envoy that referenced this pull request Dec 7, 2025
Adds HTTP transport support to the OpenTelemetry access logger, complementing
envoyproxy#29207 (OTLP/HTTP tracing). This enables direct OTLP log export to backends
that only accept HTTP (Dynatrace, Datadog, Logfire), without requiring an
intermediate collector sidecar.

Changes:
- Add http_service field for OTLP/HTTP transport configuration
- Add top-level grpc_service, log_name, buffer_flush_interval, buffer_size_bytes,
  filter_state_objects_to_log, and custom_tags fields to match tracer config pattern
- Add field_migrate.oneof_promotion annotations for future oneof migration
- Add helper functions getLogName() and getGrpcService() with fallback to common_config
- Add transport validation (exactly one transport must be configured)
- Deprecate common_config field (still functional for backward compatibility)
- Extract shared utilities (otlp_log_utils) from duplicated HTTP/gRPC code

Fixes envoyproxy#26352 (access logs portion)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/envoy that referenced this pull request Dec 7, 2025
Adds HTTP transport support to the OpenTelemetry access logger, complementing
envoyproxy#29207 (OTLP/HTTP tracing). This enables direct OTLP log export to backends
that only accept HTTP (Dynatrace, Datadog, Logfire), without requiring an
intermediate collector sidecar.

Changes:
- Add http_service field for OTLP/HTTP transport configuration
- Add top-level grpc_service, log_name, buffer_flush_interval, buffer_size_bytes,
  filter_state_objects_to_log, and custom_tags fields to match tracer config pattern
- Add field_migrate.oneof_promotion annotations for future oneof migration
- Add helper functions getLogName() and getGrpcService() with fallback to common_config
- Add transport validation (exactly one transport must be configured)
- Deprecate common_config field (still functional for backward compatibility)
- Extract shared utilities (otlp_log_utils) from duplicated HTTP/gRPC code

Fixes envoyproxy#26352 (access logs portion)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
wbpcode pushed a commit that referenced this pull request Jan 10, 2026
…2445)

**Commit Message**: access_log: add OTLP/HTTP exporter to OpenTelemetry
access logger

**Additional Description**: Adds HTTP transport support to the
OpenTelemetry access logger, complementing #29207 (OTLP/HTTP tracing).
This enables direct OTLP log export to backends that only accept HTTP
(Dynatrace, Datadog, Logfire), without requiring an intermediate
collector sidecar.

Also refactors the config to match the tracer pattern:
- Add top-level `http_service` field for OTLP/HTTP transport
- Add top-level `grpc_service` and `log_name` fields
- Deprecate `common_config` field (still functional for backward
compatibility)
- Extract shared utilities (`otlp_log_utils`) for HTTP and gRPC
implementations

**Risk Level**: Low (new optional feature, backward compatible)

**Testing**: Unit tests, integration test, manual testing with OTel
collector

**Docs Changes**: Proto documentation updated

**Release Notes**: Added

Fixes #26352 (access logs portion)


**Example Configuration (OTLP/HTTP with resource_attributes)**
```yaml
access_log:
- name: envoy.access_loggers.open_telemetry
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.access_loggers.open_telemetry.v3.OpenTelemetryAccessLogConfig
    http_service:
      http_uri:
        uri: "http://localhost:4318/v1/logs"
        cluster: otel_collector
        timeout: 1s
    log_name: envoy_access_log
    resource_attributes:
      values:
      - key: "service.name"
        value:
          string_value: "my-service"
    body:
      string_value: "%REQ(:METHOD)% %REQ(:PATH)% %RESPONSE_CODE%"
```

**Example Configuration (OTLP/gRPC - top-level field)**
```yaml
access_log:
- name: envoy.access_loggers.open_telemetry
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.access_loggers.open_telemetry.v3.OpenTelemetryAccessLogConfig
    grpc_service:
      envoy_grpc:
        cluster_name: otel_collector
    log_name: envoy_access_log
    body:
      string_value: "%REQ(:METHOD)% %REQ(:PATH)% %RESPONSE_CODE%"
```

---

**Screenshots**
<img width="1620" height="756" alt="Screenshot 2025-12-17 at 12 24
10 PM"
src="https://github.com/user-attachments/assets/17422675-615b-45b0-a55f-143926c169b8"
/>
<img width="1625" height="729" alt="Screenshot 2025-12-17 at 12 23
51 PM"
src="https://github.com/user-attachments/assets/4ac1d906-c77c-44a8-a4f3-aabd5f3771d6"
/>

---------

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/envoy that referenced this pull request Jan 14, 2026
Adds HTTP transport support to the OpenTelemetry metrics sink,
complementing envoyproxy#42445 (OTLP/HTTP access logs) and envoyproxy#29207 (OTLP/HTTP
tracing. This enables direct OTLP metrics export to backends that
only accept HTTP (Dynatrace, Datadog, Elastic), without requiring
an intermediate collector sidecar.

- Add  field to  oneof
- Create abstract  base class
- Rename  to
EOF
)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/envoy that referenced this pull request Jan 14, 2026
Adds HTTP transport support to the OpenTelemetry metrics sink,
complementing envoyproxy#42445 (OTLP/HTTP access logs) and envoyproxy#29207 (OTLP/HTTP
tracing. This enables direct OTLP metrics export to backends that
only accept HTTP (Dynatrace, Datadog, Elastic), without requiring
an intermediate collector sidecar.

- Add  field to  oneof
- Create abstract  base class
- Rename  to
EOF
)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
codefromthecrypt added a commit to codefromthecrypt/envoy that referenced this pull request Jan 20, 2026
Adds HTTP transport support to the OpenTelemetry metrics sink,
complementing envoyproxy#42445 (OTLP/HTTP access logs) and envoyproxy#29207 (OTLP/HTTP
tracing. This enables direct OTLP metrics export to backends that
only accept HTTP (Dynatrace, Datadog, Elastic), without requiring
an intermediate collector sidecar.

- Add  field to  oneof
- Create abstract  base class
- Rename  to
EOF
)

Signed-off-by: Adrian Cole <adrian@tetrate.io>
wbpcode added a commit that referenced this pull request Feb 3, 2026
)

**Additional Description**: Adds HTTP transport support to the
OpenTelemetry metrics sink, complementing #42445 (OTLP/HTTP access logs)
and #29207 (OTLP/HTTP tracing). This enables direct OTLP metrics export
to backends that only accept HTTP (Dynatrace, Datadog, Elastic), without
requiring an intermediate collector sidecar.

Also refactors the exporter to use an abstract base class:
- Add `http_service` field to `protocol_specifier` oneof for OTLP/HTTP
transport
- Create abstract `OtlpMetricsExporter` base class
- Rename `OpenTelemetryGrpcSink` to `OpenTelemetrySink` with generic
exporter

**Risk Level**: Low (new optional feature, backward compatible)

**Testing**: Unit tests, integration test, manual testing with OTel
collector

**Docs Changes**: Proto documentation updated

**Release Notes**: Added


**Example Configuration (OTLP/HTTP)**
```yaml
stats_sinks:
- name: envoy.stat_sinks.open_telemetry
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.stat_sinks.open_telemetry.v3.SinkConfig
    http_service:
      http_uri:
        uri: "http://localhost:4318/v1/metrics"
        cluster: otel_collector
        timeout: 1s
    report_counters_as_deltas: true
    report_histograms_as_deltas: true
    emit_tags_as_attributes: true
    use_tag_extracted_name: true
```

**Example Configuration (OTLP/gRPC - unchanged)**
```yaml
stats_sinks:
- name: envoy.stat_sinks.open_telemetry
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.stat_sinks.open_telemetry.v3.SinkConfig
    grpc_service:
      envoy_grpc:
        cluster_name: otel_collector
    report_counters_as_deltas: true
```

Screenshot of metrics from http transport in otel-tui

<img width="1288" height="734" alt="Screenshot 2026-01-14 at 8 46 27 PM"
src="https://github.com/user-attachments/assets/49d57f12-61a4-4b0d-9dbc-8b9ad3339554"
/>

---------

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
Signed-off-by: code <wbphub@gmail.com>
Signed-off-by: wbpcode/wangbaiping <wbphub@gmail.com>
Co-authored-by: code <wbphub@gmail.com>
shane-yuan pushed a commit to shane-yuan/envoy that referenced this pull request Feb 11, 2026
…oyproxy#43001)

**Additional Description**: Adds HTTP transport support to the
OpenTelemetry metrics sink, complementing envoyproxy#42445 (OTLP/HTTP access logs)
and envoyproxy#29207 (OTLP/HTTP tracing). This enables direct OTLP metrics export
to backends that only accept HTTP (Dynatrace, Datadog, Elastic), without
requiring an intermediate collector sidecar.

Also refactors the exporter to use an abstract base class:
- Add `http_service` field to `protocol_specifier` oneof for OTLP/HTTP
transport
- Create abstract `OtlpMetricsExporter` base class
- Rename `OpenTelemetryGrpcSink` to `OpenTelemetrySink` with generic
exporter

**Risk Level**: Low (new optional feature, backward compatible)

**Testing**: Unit tests, integration test, manual testing with OTel
collector

**Docs Changes**: Proto documentation updated

**Release Notes**: Added


**Example Configuration (OTLP/HTTP)**
```yaml
stats_sinks:
- name: envoy.stat_sinks.open_telemetry
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.stat_sinks.open_telemetry.v3.SinkConfig
    http_service:
      http_uri:
        uri: "http://localhost:4318/v1/metrics"
        cluster: otel_collector
        timeout: 1s
    report_counters_as_deltas: true
    report_histograms_as_deltas: true
    emit_tags_as_attributes: true
    use_tag_extracted_name: true
```

**Example Configuration (OTLP/gRPC - unchanged)**
```yaml
stats_sinks:
- name: envoy.stat_sinks.open_telemetry
  typed_config:
    "@type": type.googleapis.com/envoy.extensions.stat_sinks.open_telemetry.v3.SinkConfig
    grpc_service:
      envoy_grpc:
        cluster_name: otel_collector
    report_counters_as_deltas: true
```

Screenshot of metrics from http transport in otel-tui

<img width="1288" height="734" alt="Screenshot 2026-01-14 at 8 46 27 PM"
src="https://github.com/user-attachments/assets/49d57f12-61a4-4b0d-9dbc-8b9ad3339554"
/>

---------

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <64215+codefromthecrypt@users.noreply.github.com>
Signed-off-by: code <wbphub@gmail.com>
Signed-off-by: wbpcode/wangbaiping <wbphub@gmail.com>
Co-authored-by: code <wbphub@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for sending OpenTelemetry Tracing over HTTP/Protobuf endpoint

9 participants