From 79711d02166f0cd40f31623f7415e7fc5c2c2a8b Mon Sep 17 00:00:00 2001 From: Munir Date: Wed, 31 Dec 2025 18:24:24 -0500 Subject: [PATCH 1/7] chore(ddtrace/otel): document metrics support in rust, php, go --- .../instrument/api_support/rust.md | 5 - .../instrument/api_support/rust/_index.md | 5 + .../instrument/api_support/rust/metrics.md | 121 ++++++++++++++++++ .../instrument/api_support/rust/traces.md | 8 ++ 4 files changed, 134 insertions(+), 5 deletions(-) delete mode 100644 content/en/opentelemetry/instrument/api_support/rust.md create mode 100644 content/en/opentelemetry/instrument/api_support/rust/_index.md create mode 100644 content/en/opentelemetry/instrument/api_support/rust/metrics.md create mode 100644 content/en/opentelemetry/instrument/api_support/rust/traces.md diff --git a/content/en/opentelemetry/instrument/api_support/rust.md b/content/en/opentelemetry/instrument/api_support/rust.md deleted file mode 100644 index 802a6c00e5c..00000000000 --- a/content/en/opentelemetry/instrument/api_support/rust.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Rust Custom Instrumentation using the OpenTelemetry API ---- - -{{< include-markdown "/tracing/trace_collection/custom_instrumentation/rust/" >}} \ No newline at end of file diff --git a/content/en/opentelemetry/instrument/api_support/rust/_index.md b/content/en/opentelemetry/instrument/api_support/rust/_index.md new file mode 100644 index 00000000000..c425f785915 --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/rust/_index.md @@ -0,0 +1,5 @@ +--- +title: Rust +type: multi-code-lang +external_redirect: /opentelemetry/instrument/api_support/rust/traces +--- diff --git a/content/en/opentelemetry/instrument/api_support/rust/metrics.md b/content/en/opentelemetry/instrument/api_support/rust/metrics.md new file mode 100644 index 00000000000..82f26c0f934 --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/rust/metrics.md @@ -0,0 +1,121 @@ +--- +title: Rust OpenTelemetry Metrics API Support +code_lang: metrics +type: multi-code-lang +code_lang_weight: 1 +private: true +further_reading: + - link: opentelemetry/correlate/metrics_and_traces + tag: Documentation + text: Correlate OpenTelemetry Traces and Metrics +--- + +## Overview + +{{% otel-overview-exporter lang="Rust" signal="Metrics" sdk_name="datadog-opentelemetry" %}} + +**Note**: Metrics support will be available in datadog-opentelemetry v0.4.0. + +## Prerequisites + +- **Datadog SDK**: `datadog-opentelemetry` crate version 0.4.0 or later. +- **Rust**: MSRV 1.84 or later. +- **An OTLP-compatible destination**: You must have a destination (Agent or Collector) listening on ports 4317 (gRPC) or 4318 (HTTP) to receive OTel metrics. + +## Setup + +Follow these steps to enable OTel Metrics API support in your Rust application. + +1. Add the Datadog SDK to your Cargo.toml: + ```toml + [dependencies] + datadog-opentelemetry = { version = "0.4.0" } + opentelemetry = { version = "0.31", features = ["metrics"] } + ``` + +2. Enable OTel metrics by setting the following environment variable: + ```sh + export DD_METRICS_OTEL_ENABLED=true + ``` + +3. Configure your application: + ```rust + use std::time::Duration; + + // Enable metrics via environment variable + std::env::set_var("DD_METRICS_OTEL_ENABLED", "true"); + + // Initialize metrics with default configuration + let meter_provider = datadog_opentelemetry::metrics().init(); + + // Your application code here... + + // Shutdown to flush remaining metrics + meter_provider.shutdown().unwrap(); + ``` + +## Examples + +You can use the standard OpenTelemetry API packages to create custom metrics. + +### Create a counter + +This example uses the OTel Metrics API to create a counter that increments every time an item is processed: + +```rust +use opentelemetry::global; +use opentelemetry::metrics::Counter; +use opentelemetry::KeyValue; + +// datadog-opentelemetry automatically configures the MeterProvider +let meter = global::meter("my-service"); +let counter: Counter = meter.u64_counter("requests").build(); +counter.add(1, &[KeyValue::new("method", "GET")]); +``` + +## Supported configuration + +To enable this feature, you must set `DD_METRICS_OTEL_ENABLED=true`. + +All OTLP exporter settings (such as endpoints, protocols, and timeouts), resource attributes, and temporality preferences are configured using a shared set of OpenTelemetry environment variables. + +### Transport Features + +The default feature includes gRPC transport. Additional transport options: + +- For gRPC transport: `features = ["metrics-grpc"]` (default) +- For HTTP transport: `features = ["metrics-http"]` + +**Note**: HTTP/JSON protocol is not supported. Use `grpc` or `http/protobuf` protocols only. + +For a complete list of all shared OTLP environment variables, see [OpenTelemetry Environment Variables Interoperability][1]. + +## Migrate from other setups + +### Existing OTel setup + +If you are using the OTel SDK with your own manual OTLP exporter configuration: + +1. Add the Datadog SDK (`datadog-opentelemetry`) to your project and enable its instrumentation. +2. Remove any code that manually configures the `OTLPMetricsExporter`. The Datadog SDK handles this configuration automatically. +3. Set the `DD_METRICS_OTEL_ENABLED=true` environment variable. + +### Existing DogStatsD setup + +If you are currently using the Datadog DogStatsD client and want to migrate to the OpenTelemetry Metrics API, you need to update your instrumentation code. The main difference is that OTel metrics are configured using environment variables rather than code, and you create `Instrument` objects first. + +**Important**: Runtime and trace metrics continue to be submitted using StatsD. Only custom metrics created through the OpenTelemetry Metrics API are sent using OTLP. The `datadog-opentelemetry` implementation supports exporting OTLP metrics exclusively to a Datadog Agent or OpenTelemetry Collector. Multiple exporters are not supported. + +## Troubleshooting + +{{% otel-api-troubleshooting signal="metrics" %}} +- Verify transport features are enabled. Ensure `metrics-grpc` or `metrics-http` feature is enabled in your Cargo.toml depending on your protocol choice. +- Check protocol configuration. Only `grpc` and `http/protobuf` protocols are supported. HTTP/JSON is not supported. +- Ensure `DD_METRICS_OTEL_ENABLED=true` is set before initializing the meter provider. +{{% /otel-api-troubleshooting %}} + +## Further reading + +{{< partial name="whats-next/whats-next.html" >}} + +[1]: /opentelemetry/config/environment_variable_support diff --git a/content/en/opentelemetry/instrument/api_support/rust/traces.md b/content/en/opentelemetry/instrument/api_support/rust/traces.md new file mode 100644 index 00000000000..b34e1a7507e --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/rust/traces.md @@ -0,0 +1,8 @@ +--- +title: Rust OpenTelemetry Traces API Support +code_lang: traces +type: multi-code-lang +code_lang_weight: 0 +--- + +{{< include-markdown "/tracing/trace_collection/custom_instrumentation/rust/" >}} From 5e304fdcfd6409f1bf26ea0837b43a942614c2fa Mon Sep 17 00:00:00 2001 From: Munir Date: Wed, 31 Dec 2025 18:28:47 -0500 Subject: [PATCH 2/7] comment out metrics tab for now --- .../instrument/api_support/rust/metrics.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/content/en/opentelemetry/instrument/api_support/rust/metrics.md b/content/en/opentelemetry/instrument/api_support/rust/metrics.md index 82f26c0f934..507dd8aa354 100644 --- a/content/en/opentelemetry/instrument/api_support/rust/metrics.md +++ b/content/en/opentelemetry/instrument/api_support/rust/metrics.md @@ -1,9 +1,9 @@ --- title: Rust OpenTelemetry Metrics API Support -code_lang: metrics -type: multi-code-lang -code_lang_weight: 1 -private: true +# Uncomment Metrics tab after dd-trace-rs v0.3.0 is released +# code_lang: metrics +# type: multi-code-lang +# code_lang_weight: 1 further_reading: - link: opentelemetry/correlate/metrics_and_traces tag: Documentation @@ -14,11 +14,11 @@ further_reading: {{% otel-overview-exporter lang="Rust" signal="Metrics" sdk_name="datadog-opentelemetry" %}} -**Note**: Metrics support will be available in datadog-opentelemetry v0.4.0. +**Note**: Metrics support will be available in datadog-opentelemetry v0.3.0. ## Prerequisites -- **Datadog SDK**: `datadog-opentelemetry` crate version 0.4.0 or later. +- **Datadog SDK**: `datadog-opentelemetry` crate version 0.3.0 or later. - **Rust**: MSRV 1.84 or later. - **An OTLP-compatible destination**: You must have a destination (Agent or Collector) listening on ports 4317 (gRPC) or 4318 (HTTP) to receive OTel metrics. @@ -29,7 +29,7 @@ Follow these steps to enable OTel Metrics API support in your Rust application. 1. Add the Datadog SDK to your Cargo.toml: ```toml [dependencies] - datadog-opentelemetry = { version = "0.4.0" } + datadog-opentelemetry = { version = "0.3.0" } opentelemetry = { version = "0.31", features = ["metrics"] } ``` From ce4d5d27b7be01e187da207b95bfc3b37768f232 Mon Sep 17 00:00:00 2001 From: Munir Date: Fri, 2 Jan 2026 12:22:57 -0500 Subject: [PATCH 3/7] clean up imports --- .../en/opentelemetry/instrument/api_support/rust/metrics.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/content/en/opentelemetry/instrument/api_support/rust/metrics.md b/content/en/opentelemetry/instrument/api_support/rust/metrics.md index 507dd8aa354..661f9662343 100644 --- a/content/en/opentelemetry/instrument/api_support/rust/metrics.md +++ b/content/en/opentelemetry/instrument/api_support/rust/metrics.md @@ -40,11 +40,6 @@ Follow these steps to enable OTel Metrics API support in your Rust application. 3. Configure your application: ```rust - use std::time::Duration; - - // Enable metrics via environment variable - std::env::set_var("DD_METRICS_OTEL_ENABLED", "true"); - // Initialize metrics with default configuration let meter_provider = datadog_opentelemetry::metrics().init(); From 20e43073aac7be760712e40be9a541a03de78472 Mon Sep 17 00:00:00 2001 From: Munir Date: Mon, 5 Jan 2026 10:15:24 -0500 Subject: [PATCH 4/7] add placeholders to go and php --- content/en/opentelemetry/instrument/api_support/go.md | 5 ----- content/en/opentelemetry/instrument/api_support/php.md | 5 ----- 2 files changed, 10 deletions(-) delete mode 100644 content/en/opentelemetry/instrument/api_support/go.md delete mode 100644 content/en/opentelemetry/instrument/api_support/php.md diff --git a/content/en/opentelemetry/instrument/api_support/go.md b/content/en/opentelemetry/instrument/api_support/go.md deleted file mode 100644 index 3c732923022..00000000000 --- a/content/en/opentelemetry/instrument/api_support/go.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Go Custom Instrumentation using the OpenTelemetry API ---- - -{{< include-markdown "/tracing/trace_collection/custom_instrumentation/go/otel/" >}} \ No newline at end of file diff --git a/content/en/opentelemetry/instrument/api_support/php.md b/content/en/opentelemetry/instrument/api_support/php.md deleted file mode 100644 index f1439780cc9..00000000000 --- a/content/en/opentelemetry/instrument/api_support/php.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: PHP Custom Instrumentation using the OpenTelemetry API ---- - -{{< include-markdown "/tracing/trace_collection/custom_instrumentation/php/otel/" >}} \ No newline at end of file From cebe0ba80c5e735206fd3f031f5a630f2dd3d5cd Mon Sep 17 00:00:00 2001 From: Munir Date: Mon, 5 Jan 2026 10:16:19 -0500 Subject: [PATCH 5/7] remove ruby.md, it is not needed --- content/en/opentelemetry/instrument/api_support/ruby.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 content/en/opentelemetry/instrument/api_support/ruby.md diff --git a/content/en/opentelemetry/instrument/api_support/ruby.md b/content/en/opentelemetry/instrument/api_support/ruby.md deleted file mode 100644 index 65d7c18584e..00000000000 --- a/content/en/opentelemetry/instrument/api_support/ruby.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Ruby Custom Instrumentation using the OpenTelemetry API ---- - -{{< include-markdown "/tracing/trace_collection/custom_instrumentation/ruby/otel/" >}} \ No newline at end of file From 10ddc8d02373b1c2d43df30be87dc7f7336c21db Mon Sep 17 00:00:00 2001 From: Munir Date: Mon, 5 Jan 2026 10:16:56 -0500 Subject: [PATCH 6/7] add php and go --- .../instrument/api_support/go/_index.md | 5 ++ .../instrument/api_support/go/metrics.md | 50 +++++++++++++++++++ .../instrument/api_support/go/traces.md | 8 +++ .../instrument/api_support/php/_index.md | 5 ++ .../instrument/api_support/php/metrics.md | 50 +++++++++++++++++++ .../instrument/api_support/php/traces.md | 8 +++ 6 files changed, 126 insertions(+) create mode 100644 content/en/opentelemetry/instrument/api_support/go/_index.md create mode 100644 content/en/opentelemetry/instrument/api_support/go/metrics.md create mode 100644 content/en/opentelemetry/instrument/api_support/go/traces.md create mode 100644 content/en/opentelemetry/instrument/api_support/php/_index.md create mode 100644 content/en/opentelemetry/instrument/api_support/php/metrics.md create mode 100644 content/en/opentelemetry/instrument/api_support/php/traces.md diff --git a/content/en/opentelemetry/instrument/api_support/go/_index.md b/content/en/opentelemetry/instrument/api_support/go/_index.md new file mode 100644 index 00000000000..373706a6447 --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/go/_index.md @@ -0,0 +1,5 @@ +--- +title: Go +type: multi-code-lang +external_redirect: /opentelemetry/instrument/api_support/go/traces +--- diff --git a/content/en/opentelemetry/instrument/api_support/go/metrics.md b/content/en/opentelemetry/instrument/api_support/go/metrics.md new file mode 100644 index 00000000000..638c493d9c1 --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/go/metrics.md @@ -0,0 +1,50 @@ +--- +title: Go OpenTelemetry Metrics API Support +# Uncomment Metrics tab when Go metrics support is available +# code_lang: metrics +# type: multi-code-lang +# code_lang_weight: 1 +further_reading: + - link: opentelemetry/correlate/metrics_and_traces + tag: Documentation + text: Correlate OpenTelemetry Traces and Metrics +--- + +## Overview + +{{% otel-overview-exporter lang="Go" signal="Metrics" sdk_name="dd-trace-go" %}} + +**Note**: Go OpenTelemetry Metrics API support is not yet available. + +## Prerequisites + +- **Datadog SDK**: dd-trace-go version TBD. +- **An OTLP-compatible destination**: You must have a destination (Agent or Collector) listening on ports 4317 (gRPC) or 4318 (HTTP) to receive OTel metrics. + +## Setup + +*Documentation will be added when Go metrics support becomes available.* + +## Examples + +*Examples will be added when Go metrics support becomes available.* + +## Supported configuration + +*Configuration details will be added when Go metrics support becomes available.* + +For a complete list of all shared OTLP environment variables, see [OpenTelemetry Environment Variables Interoperability][1]. + +## Migrate from other setups + +*Migration guidance will be added when Go metrics support becomes available.* + +## Troubleshooting + +*Troubleshooting information will be added when Go metrics support becomes available.* + +## Further reading + +{{< partial name="whats-next/whats-next.html" >}} + +[1]: /opentelemetry/config/environment_variable_support diff --git a/content/en/opentelemetry/instrument/api_support/go/traces.md b/content/en/opentelemetry/instrument/api_support/go/traces.md new file mode 100644 index 00000000000..a94304ea235 --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/go/traces.md @@ -0,0 +1,8 @@ +--- +title: Go OpenTelemetry Traces API Support +code_lang: traces +type: multi-code-lang +code_lang_weight: 0 +--- + +{{< include-markdown "/tracing/trace_collection/custom_instrumentation/go/otel/" >}} diff --git a/content/en/opentelemetry/instrument/api_support/php/_index.md b/content/en/opentelemetry/instrument/api_support/php/_index.md new file mode 100644 index 00000000000..ffc8ab27ff8 --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/php/_index.md @@ -0,0 +1,5 @@ +--- +title: PHP +type: multi-code-lang +external_redirect: /opentelemetry/instrument/api_support/php/traces +--- diff --git a/content/en/opentelemetry/instrument/api_support/php/metrics.md b/content/en/opentelemetry/instrument/api_support/php/metrics.md new file mode 100644 index 00000000000..986b4061d34 --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/php/metrics.md @@ -0,0 +1,50 @@ +--- +title: PHP OpenTelemetry Metrics API Support +# Uncomment Metrics tab when PHP metrics support is available +# code_lang: metrics +# type: multi-code-lang +# code_lang_weight: 1 +further_reading: + - link: opentelemetry/correlate/metrics_and_traces + tag: Documentation + text: Correlate OpenTelemetry Traces and Metrics +--- + +## Overview + +{{% otel-overview-exporter lang="PHP" signal="Metrics" sdk_name="dd-trace-php" %}} + +**Note**: PHP OpenTelemetry Metrics API support is not yet available. + +## Prerequisites + +- **Datadog SDK**: dd-trace-php version TBD. +- **An OTLP-compatible destination**: You must have a destination (Agent or Collector) listening on ports 4317 (gRPC) or 4318 (HTTP) to receive OTel metrics. + +## Setup + +*Documentation will be added when PHP metrics support becomes available.* + +## Examples + +*Examples will be added when PHP metrics support becomes available.* + +## Supported configuration + +*Configuration details will be added when PHP metrics support becomes available.* + +For a complete list of all shared OTLP environment variables, see [OpenTelemetry Environment Variables Interoperability][1]. + +## Migrate from other setups + +*Migration guidance will be added when PHP metrics support becomes available.* + +## Troubleshooting + +*Troubleshooting information will be added when PHP metrics support becomes available.* + +## Further reading + +{{< partial name="whats-next/whats-next.html" >}} + +[1]: /opentelemetry/config/environment_variable_support diff --git a/content/en/opentelemetry/instrument/api_support/php/traces.md b/content/en/opentelemetry/instrument/api_support/php/traces.md new file mode 100644 index 00000000000..4c8a8c9d21b --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/php/traces.md @@ -0,0 +1,8 @@ +--- +title: PHP OpenTelemetry Traces API Support +code_lang: traces +type: multi-code-lang +code_lang_weight: 0 +--- + +{{< include-markdown "/tracing/trace_collection/custom_instrumentation/php/otel/" >}} From 8f90b836385aa0c27c57b5bd2c229382d4db1f75 Mon Sep 17 00:00:00 2001 From: Munir Date: Mon, 5 Jan 2026 10:22:44 -0500 Subject: [PATCH 7/7] Revert "remove ruby.md, it is not needed" This reverts commit cebe0ba80c5e735206fd3f031f5a630f2dd3d5cd. --- content/en/opentelemetry/instrument/api_support/ruby.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 content/en/opentelemetry/instrument/api_support/ruby.md diff --git a/content/en/opentelemetry/instrument/api_support/ruby.md b/content/en/opentelemetry/instrument/api_support/ruby.md new file mode 100644 index 00000000000..65d7c18584e --- /dev/null +++ b/content/en/opentelemetry/instrument/api_support/ruby.md @@ -0,0 +1,5 @@ +--- +title: Ruby Custom Instrumentation using the OpenTelemetry API +--- + +{{< include-markdown "/tracing/trace_collection/custom_instrumentation/ruby/otel/" >}} \ No newline at end of file