Skip to content

access_log: add OTLP/HTTP exporter to OpenTelemetry access logger#42445

Merged
wbpcode merged 2 commits intoenvoyproxy:mainfrom
codefromthecrypt:otlp-http-access-logs
Jan 10, 2026
Merged

access_log: add OTLP/HTTP exporter to OpenTelemetry access logger#42445
wbpcode merged 2 commits intoenvoyproxy:mainfrom
codefromthecrypt:otlp-http-access-logs

Conversation

@codefromthecrypt
Copy link
Contributor

@codefromthecrypt codefromthecrypt commented Dec 7, 2025

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)

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)

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
Screenshot 2025-12-17 at 12 24 10 PM
Screenshot 2025-12-17 at 12 23 51 PM

@repokitteh-read-only
Copy link

As a reminder, PRs marked as draft will not be automatically assigned reviewers,
or be handled by maintainer-oncall triage.

Please mark your PR as ready when you want it to be reviewed!

🐱

Caused by: #42445 was opened by codefromthecrypt.

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 @mattklein123
CC @envoyproxy/api-watchers: FYI only for changes made to (api/envoy/|docs/root/api-docs/).

🐱

Caused by: #42445 was opened by codefromthecrypt.

see: more, trace.

@codefromthecrypt codefromthecrypt force-pushed the otlp-http-access-logs branch 3 times, most recently from 8831406 to 3664f4e Compare December 7, 2025 03:23
@codefromthecrypt codefromthecrypt marked this pull request as ready for review December 7, 2025 03:46
@codefromthecrypt
Copy link
Contributor Author

@wbpcode @Kludex fyi this is for extending otel logging from grpc-only in envoy to also http as many backends prefer or only support http OTLP

@codefromthecrypt codefromthecrypt marked this pull request as draft December 7, 2025 04:44
@codefromthecrypt codefromthecrypt force-pushed the otlp-http-access-logs branch 2 times, most recently from a50beca to 7adc68b Compare December 7, 2025 06:17
resource_detectors:
- name: envoy.tracers.opentelemetry.resource_detectors.environment
typed_config:
"@type": type.googleapis.com/envoy.extensions.tracers.opentelemetry.resource_detectors.v3.EnvironmentResourceDetectorConfig
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok this now uses the current practice with is resource detectors, not a one-off, even though the one-off in grpc+accesslog is retained for deprecation

@codefromthecrypt codefromthecrypt marked this pull request as ready for review December 7, 2025 06:19
@codefromthecrypt codefromthecrypt force-pushed the otlp-http-access-logs branch 4 times, most recently from e8271a1 to 0e06aa1 Compare December 7, 2025 15:41
@mattklein123 mattklein123 assigned wbpcode and unassigned mattklein123 Dec 8, 2025
@codefromthecrypt codefromthecrypt force-pushed the otlp-http-access-logs branch 3 times, most recently from ed98708 to 2b7c12d Compare December 10, 2025 04:14
@codefromthecrypt
Copy link
Contributor Author

noticed other examples use httpbingo not httpbin, since no one has reviewed yet I switched to the former and updated the screenshots🤞

@codefromthecrypt
Copy link
Contributor Author

@TAOXUY this might be interesting to you. I'm happy to continue and do metrics after this once merged

@codefromthecrypt codefromthecrypt marked this pull request as ready for review December 24, 2025 03:03
@yanavlasov
Copy link
Contributor

Thanks for working on this @codefromthecrypt Please merge main.

Would it be possible to make test/extensions/access_loggers/open_telemetry/access_log_integration_test.cc test both HTTP and gRPC exporter? This will make it easier to reason that two exporters behave the same.

/wait

@codefromthecrypt
Copy link
Contributor Author

@yanavlasov added a commit that I think gets what you are saying. thanks for the tip

public HttpIntegrationTest {
enum class ExporterType { GRPC, HTTP };

struct TransportDriver {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wasn't quite sure style, but this is how I was thinking about parameterizing so it is easy to see if these behave the same except the different parts. thanks for the idea @yanavlasov as it found a bug I fixed!

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
@yanavlasov
Copy link
Contributor

LGTM. Will wait for @mattklein123 for API review.

/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.

LGTM. Thanks.

@wbpcode wbpcode merged commit 6718965 into envoyproxy:main Jan 10, 2026
26 checks passed
@codefromthecrypt codefromthecrypt deleted the otlp-http-access-logs branch January 14, 2026 04:45
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
Copy link
Contributor Author

thanks all #43001 completes the otlp http transport by supporting metrics (we already supported traces, and this PR did access logs, only left was metrics)

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>
nacx pushed a commit to envoyproxy/ai-gateway that referenced this pull request Jan 15, 2026
**Description**

Switches OTLP default transport from HTTP to gRPC in test fixtures and
examples.

This prepares for Envoy Gateway integration which currently only
supports OTLP/gRPC for access logs. Once Envoy Gateway exposes OTLP/HTTP
(pending upstream changes in Envoy), we can switch back.

**Related Issues/PRs (if applicable)**

- envoyproxy/envoy#42445 (OTLP/HTTP access logs in Envoy)
- envoyproxy/gateway#7674 (OTLP headers support)

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

5 participants