Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions config/_default/menus/main.en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,37 +607,37 @@ menu:
parent: otel-instrumentation
weight: 302
- name: Java
url: /opentelemetry/instrument/api_support/java
url: /opentelemetry/instrument/api_support/java/traces
parent: otel-api-dd-sdk
weight: 3021
identifier: otel_api_java
- name: Python
url: /opentelemetry/instrument/api_support/python
url: /opentelemetry/instrument/api_support/python/traces
parent: otel-api-dd-sdk
weight: 3022
identifier: otel_api_python
- name: Ruby
url: /opentelemetry/instrument/api_support/ruby
url: /opentelemetry/instrument/api_support/ruby/traces
parent: otel-api-dd-sdk
weight: 3023
identifier: otel_api_ruby
- name: Go
url: /opentelemetry/instrument/api_support/go
url: /opentelemetry/instrument/api_support/go/traces
parent: otel-api-dd-sdk
weight: 3024
identifier: otel_api_go
- name: Node.js
url: /opentelemetry/instrument/api_support/nodejs
url: /opentelemetry/instrument/api_support/nodejs/traces
parent: otel-api-dd-sdk
weight: 3025
identifier: otel_api_nodejs
- name: PHP
url: /opentelemetry/instrument/api_support/php
url: /opentelemetry/instrument/api_support/php/traces
parent: otel-api-dd-sdk
weight: 3026
identifier: otel_api_php
- name: .NET
url: /opentelemetry/instrument/api_support/dotnet
url: /opentelemetry/instrument/api_support/dotnet/traces
parent: otel-api-dd-sdk
weight: 3027
identifier: otel_api_dotnet
Expand Down
3 changes: 3 additions & 0 deletions config/_default/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ code_language_ids:
real_time_rule: "Real-Time Rule"
scheduled_rule: "Scheduled Rule"
historical_job: "Historical Job"
traces: "Traces"
metrics: "Metrics"
logs: "Logs"
kubernetes_daemonset: "Kubernetes (DaemonSet)"
kubernetes_gateway: "Kubernetes (Gateway)"
branch: ""
Expand Down
67 changes: 60 additions & 7 deletions content/en/opentelemetry/config/environment_variable_support.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Using OpenTelemetry Environment Variables with Datadog SDKs
title: OpenTelemetry Environment Variables Interoperability
aliases:
- /opentelemetry/interoperability/environment_variable_support
further_reading:
Expand Down Expand Up @@ -29,11 +29,23 @@ further_reading:
text: 'Ruby SDK Configuration'
---

Datadog SDKs implement the OpenTelemetry Tracing APIs, allowing you to use OpenTelemetry environment variables to configure Datadog tracing for your applications. Replace the OpenTelemetry SDK with the Datadog SDK in your application to receive traces and additional Datadog telemetry with minimal changes to your existing configuration.
This page describes the OpenTelemetry SDK options Datadog supports.
Datadog SDKs implement the OpenTelemetry APIs for traces, metrics, and logs. This allows you to use standard OpenTelemetry environment variables to configure your application while receiving additional Datadog telemetry with minimal changes to your existing configuration.

This page describes the environment variables Datadog supports for OpenTelemetry interoperability.

<div class="alert alert-info">If both Datadog and OpenTelemetry environment variables are set, Datadog takes precedence. Datadog defaults also override OpenTelemetry defaults. See the relevant <a href="/tracing/trace_collection/library_config/">SDK Configuration page</a> for default values and more information.</div>

## Datadog SDK configuration
These environment variables enable the Datadog SDK to ingest OpenTelemetry Metrics and Logs API data. For guides on how to instrument your application, see the [language-specific instrumentation documentation][14].

`DD_METRICS_OTEL_ENABLED`
: **Description**: Enables the automatic instrumentation components of the Datadog SDK to collect and emit metrics generated by the OTel Metrics API. <br>
**Default**: `false`

`DD_LOGS_OTEL_ENABLED`
: **Description**: Enables the automatic instrumentation components of the Datadog SDK to collect and emit logs generated by the OTel Logs API. <br>
**Default**: `false`

## General SDK configuration
Datadog SDKs support the following general OpenTelemetry SDK options. For more information, see the related [OpenTelemetry documentation][9].

Expand Down Expand Up @@ -76,9 +88,9 @@ Trace exporter to be used<br>
**Notes**: Only a value of `none` is accepted<br>

`OTEL_METRICS_EXPORTER`
: ****Datadog convention****: `DD_RUNTIME_METRICS_ENABLED=false` <br>
Metrics exporter to be used<br>
**Notes**: only a value of `none` is accepted<br>
: **Description**: Specifies the metrics exporter to be used. <br>
**Notes**: The only accepted values are `otlp` and `none`. A value of `none` disables the emission of OTel metrics, as well as APM runtime metrics (equivalent to `DD_RUNTIME_METRICS_ENABLED=false`) <br>
**Default**: `otlp`

`OTEL_RESOURCE_ATTRIBUTES`
: ****Datadog convention****: `DD_TAGS` <br>
Expand All @@ -88,7 +100,6 @@ Key-value pairs to be used as resource attributes. See [Resource semantic conven
`service.name` maps to the `DD_SERVICE` environment variable<br>
`service.version` maps to the `DD_VERSION` environment variable<br>


`OTEL_SDK_DISABLED`
: ****Datadog convention****: `!DD_TRACE_OTEL_ENABLED` <br>
Disable the SDK for all signals<br>
Expand All @@ -97,6 +108,46 @@ Disable the SDK for all signals<br>
- `false`|`true`<br>
**Ruby & Go SDKs**: The OpenTelemetry SDK activates automatically upon import and configuration, so this setting is not applicable.

## OTLP Exporter configuration
Datadog SDKs support the following [OpenTelemetry OTLP Exporter][13] options.

`OTEL_EXPORTER_OTLP_PROTOCOL`
: **Description**: Specifies the transport protocol to use. Signal-specific variables (like `OTEL_EXPORTER_OTLP_METRICS_PROTOCOL`) are also supported. <br>
**Accepted values**: `grpc`, `http/protobuf`, `http/json`. <br>
**Default**: SDK-dependent, either `http/protobuf` or `grpc`.

`OTEL_EXPORTER_OTLP_ENDPOINT`
: **Description**: Specifies the URL for sending OTLP data. <br>
**Default (gRPC)**: `http://localhost:4317`. <br>
**Default (HTTP)**: `http://localhost:4318/v1/metrics`.

`OTEL_EXPORTER_OTLP_HEADERS`
: **Description**: Specifies a comma-separated list of key-value pairs to be used as headers on all outgoing OTLP requests (for example, `api-key=key,other-config=value`). Signal-specific headers (like `OTEL_EXPORTER_OTLP_METRICS_HEADERS`) take precedence.

`OTEL_EXPORTER_OTLP_TIMEOUT`
: **Description**: Specifies the timeout (in milliseconds) for a single outgoing OTLP request. <br>
**Default**: `10000` (10s).

## OpenTelemetry Metrics SDK configuration

Datadog SDKs support the following OpenTelemetry Metrics SDK options.

`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`
: **Description**: Specifies the aggregation `temporality` to use for each instrument kind. <br>
**Accepted values**: `Cumulative`, `Delta`, `LowMemory`. <br>
**Default**: `delta` <br>
**Notes**: This default value is Datadog's recommended configuration and differs from the OpenTelemetry specification's default.

`OTEL_METRIC_EXPORT_INTERVAL`
: **Description**: Specifies the time interval (in milliseconds) between metric export attempts. <br>
**Default**: `10000` (10s) <br>
**Notes**: This default value is Datadog's recommended configuration and differs from the OpenTelemetry specification's default of 60000ms.

`OTEL_METRIC_EXPORT_TIMEOUT`
: **Description**: Specifies the maximum allowed time (in milliseconds) to collect and export metrics. <br>
**Default**: `7500` (7.5s) <br>
**Notes**: This default value is Datadog's recommended configuration and differs from the OpenTelemetry specification's default of 30000ms.

## Java-specific configuration
Datadog SDKs support the following Java-specific OpenTelemetry configuration options. For more information, see the [OpenTelemetry documentation on Java agent configuration][10].

Expand Down Expand Up @@ -156,3 +207,5 @@ A comma-separated list of paths to extension jar files, or folders containing ja
[10]: https://opentelemetry.io/docs/zero-code/java/agent/configuration/#configuring-the-agent
[11]: https://opentelemetry.io/docs/specs/semconv/resource/#semantic-attributes-with-dedicated-environment-variable
[12]: /tracing/trace_collection/library_config/_index
[13]: https://opentelemetry.io/docs/specs/otel/protocol/exporter/
[14]: /opentelemetry/instrument/api_support/
20 changes: 13 additions & 7 deletions content/en/opentelemetry/instrument/api_support/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,28 +20,34 @@ algolia:
tags: ['otel custom instrumentation']
---

Datadog tracing libraries provide an implementation of the [OpenTelemetry API][1] for instrumenting your code. This means you can maintain vendor-neutral instrumentation of your services, while still taking advantage of Datadog's native implementation, features, and products.
Datadog SDKs provide an implementation of the [OpenTelemetry API][1] for traces, metrics, and logs. This means you can maintain vendor-neutral instrumentation of your services, while still taking advantage of Datadog's native implementation, features, and products.

{{< img src="/opentelemetry/setup/otel-api-dd-sdk.png" alt="Diagram: OpenTelemetry API with DD tracing libraries sends data through OTLP protocol to the Datadog Agent, which forwards to Datadog's platform." style="width:100%;" >}}
The telemetry produced by your running code can be processed, analyzed, and monitored alongside Datadog's native telemetry, allowing you to take advantage of Datadog's unified platform and products like [Continuous Profiler][3], [Data Streams Monitoring][4], [App and API Protection][5], and [Live Processes][6].

{{< img src="/opentelemetry/setup/otel-api-dd-sdk.png" alt="Diagram: OpenTelemetry API with Datadog SDKs sends telemetry data through the OTLP protocol to the Datadog Agent, which forwards to Datadog's platform." style="width:100%;" >}}

**Note:** You can also send your OpenTelemetry API instrumented traces to Datadog using the [OTel Collector][7].

By [instrumenting your code with OpenTelemetry APIs][2], your code:

- Remains free of vendor-specific API calls.
- Does not depend on Datadog tracing libraries at compile time (only runtime).
- Does not depend on Datadog SDKs at compile time (only runtime).

## Setup

The setup for OpenTelemetry metrics and logs support depends on your language, specifically whether you need to install a separate OpenTelemetry Exporter.

Replace the OpenTelemetry SDK with the Datadog tracing library in the instrumented application, and the traces produced by your running code can be processed, analyzed, and monitored alongside Datadog traces and in Datadog proprietary products such as [Continuous Profiler][3], [Data Streams Monitoring][4], [App and API Protection][5], and [Live Processes][6].
- Java, PHP, Node.js, and .NET (Direct implementation): The Datadog SDKs handles OTLP export automatically. You do not need to install a separate OpenTelemetry Exporter.
- Python, Ruby, and Go (Exporter-based): The Datadog SDKs require you to also install and configure the standard OpenTelemetry OTLP Exporter package to send data.
- Rust (Manual): The Datadog SDK does not handle OTLP export or configuration for metrics and logs. You must manually install and configure the standard OpenTelemetry SDK and OTLP Exporter. The `DD_METRICS_OTEL_ENABLED` and `DD_LOGS_OTEL_ENABLED` flags do not apply.

To learn more, follow the link for your language:

{{< partial name="apm/otel-instrumentation.html" >}}

<br>

<div class="alert alert-info">To see which Datadog features are supported with this setup, see the <a href="/opentelemetry/compatibility/">feature compatibility table</a> under <b>OTel API with Datadog SDK and Agent</b>.</div>


<div class="alert alert-info">To see which Datadog features are supported with this setup, see the <a href="/opentelemetry/compatibility/">feature compatibility table.</a></div>

## Further reading

Expand Down
5 changes: 0 additions & 5 deletions content/en/opentelemetry/instrument/api_support/dotnet.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: .NET
type: multi-code-lang
external_redirect: /opentelemetry/instrument/api_support/dotnet/traces
---
32 changes: 32 additions & 0 deletions content/en/opentelemetry/instrument/api_support/dotnet/logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: .NET OpenTelemetry Logs API Support
code_lang: logs
type: multi-code-lang
code_lang_weight: 2
further_reading:
- link: opentelemetry/correlate/logs_and_traces
tag: Documentation
text: Correlate OpenTelemetry Traces and Logs
---

## Overview

{{% otel-overview-native lang=".NET" signal="Logs" sdk_name="dd-trace-dotnet" %}}

## Prerequisites

## Setup

## Examples

## Supported configuration

### Tag and resource attribute precedence

{{% otel-config-precedence %}}

## Migrate from other setups

## Further reading

{{< partial name="whats-next/whats-next.html" >}}
102 changes: 102 additions & 0 deletions content/en/opentelemetry/instrument/api_support/dotnet/metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
title: .NET OpenTelemetry Metrics API Support
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-native lang=".NET" signal="Metrics" sdk_name="dd-trace-dotnet" %}}

## Prerequisites

- **Datadog SDK**: dd-trace-dotnet version [x.y.z] or later.
- **OpenTelemetry API**: `OpenTelemetry.Api` version [x.y.z] or later. (The Datadog SDK provides the implementation for this API).

## Setup

Follow these steps to enable OTel Metrics API support in your .NET application.

1. Install the Datadog SDK:
```sh
[Code example]
```
2. Enable OTel metrics by setting the following environment variable:
```sh
export DD_METRICS_OTEL_ENABLED=true
```
4. Instrument your application:
```csharp
[Code example]
```

## 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:

```csharp
[Code example]
```

### Create a histogram

This example uses the OTel Metrics API to create a histogram to track request durations:

```csharp
[Code example]
```

## Supported configuration

To enable OTel Metrics support, you must set `DD_METRICS_OTEL_ENABLED=true`. The Datadog SDK also supports the following OpenTelemetry environment variables to customize your configuration:

`DD_METRICS_OTEL_ENABLED`
: **Description**: Enables the automatic instrumentation components of the Datadog SDK to collect and emit metrics generated by the OTel Metrics API. <br>
**Default**: `false`

`OTEL_EXPORTER_OTLP_ENDPOINT`
: **Description**: Specifies the URL for sending OTLP data. <br>
**Default (gRPC)**: `http://localhost:4317`. <br>
**Default (HTTP)**: `http://localhost:4318/v1/metrics`. <br>

`OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE`
: **Description**: Specifies the aggregation `temporality` to use for each instrument kind. <br>
**Accepted values**: `Cumulative`, `Delta`, `LowMemory`. <br>
**Default**: `delta` <br>
**Notes**: This default value is Datadog's recommended configuration and differs from the OpenTelemetry specification's default.

For a complete list of all shared OTLP environment variables, see [OpenTelemetry Environment Variables Interoperability][1].

### Tag and resource attribute precedence

{{% otel-config-precedence %}}

## Migrate from other setups

### Existing OTel setup

If you are already using the OpenTelemetry SDK with a manual OTLP exporter configuration, follow these steps to migrate:

1. Add the Datadog SDK (`dd-trace-dotnet`) to your project and enable its instrumentation.
2. Remove any code that manually configures the `OTLPMetricsExporter`. The Datadog SDK handles this configuration automatically.
3. Remove the `opentelemetry-sdk` and `opentelemetry-exporter-otlp` packages from your project's dependencies.
4. 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.

## Further reading

{{< partial name="whats-next/whats-next.html" >}}

[1]: /opentelemetry/config/environment_variable_support
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: .NET OpenTelemetry Traces API Support
code_lang: traces
type: multi-code-lang
code_lang_weight: 0
---

{{< include-markdown "/tracing/trace_collection/custom_instrumentation/dotnet/otel/" >}}
5 changes: 0 additions & 5 deletions content/en/opentelemetry/instrument/api_support/go.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Go
type: multi-code-lang
external_redirect: /opentelemetry/instrument/api_support/go/traces
---
7 changes: 7 additions & 0 deletions content/en/opentelemetry/instrument/api_support/go/logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: Go OpenTelemetry Logs API Support
code_lang: logs
type: multi-code-lang
code_lang_weight: 2
---
Not supported
Loading
Loading