- Notifications
You must be signed in to change notification settings - Fork1.2k
Datadog SDK OTel Metrics and Logs API Support: Phase 1#32610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@zacharycmontoya can you also give this a review
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
| 1. Install the Datadog SDK: | ||
| ```sh | ||
| [Code example] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@link04 can you fill this in
content/en/opentelemetry/instrument/api_support/dotnet/metrics.md OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
content/en/opentelemetry/instrument/api_support/nodejs/metrics.md OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
content/en/opentelemetry/instrument/api_support/python/metrics.md OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
| ``` | ||
| 4. Instrument your application: | ||
| ```py | ||
| [Code example] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We published docs for metrics:https://ddtrace.readthedocs.io/en/latest/api.html?highlight=opentelemetry#metrics
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I can also fill this out in a bit
Co-authored-by: Munir Abdinur <munir.abdinur@datadoghq.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is looking good - I left a few comments.
To avoid confusion I think it would be good to also have the Metrics/Logs tabs on the other languages and say 'coming soon' with a link to contact support for more details.
| ##Setup | ||
| The setup for OpenTelemetry metrics and logs support depends on your language, specifically whether you need to install a separate OpenTelemetry Exporter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Do you think it's necessary to explain the fact that some languages need the exporter and some don't on this page?
You'll get the correct instructions on each language page, so I'm wondering if it's confusing to explain this here. Or another way: it's not going to affect any choice you make from this page.
(Also I think for Python the Exporter is only required for Logs/Metrics not Traces, so arguably it's confusing to say you need the Exporter for Python here.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Good point! I agree that it's better to omit this. It adds unnecessary confusion when a user would just be guided to their specific page anyways.
| ##Prerequisites | ||
| -**Datadog SDK**: dd-trace-py version 3.18.0 or later. | ||
| -**OpenTelemetry SDK**: The standard opentelemetry-sdk package for Python. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We have steps in the setup for installing the SDK and Exporter, so it could be confusing to have them as prerequisites as well?
We also say in a note in the Overview section that you need the SDK and Exporter - I'm not sure we need that note either. (The note makes sense for the other languages where we're sayingnot to install the SDK/Exporter)
| This example shows how logs emitted within an active Datadog span are automatically correlated. | ||
| ```python |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
(Example needs completing)
| `OTEL_EXPORTER_OTLP_LOGS_PROTOCOL` | ||
| : **Description**: Specifies the OTLP transport protocol. Takes precedence over `OTEL_EXPORTER_OTLP_PROTOCOL`. | ||
| : **Accepted values**: `grpc`, `http/protobuf`, `http/json` | ||
| : **Default**: (SDK-dependent) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Can we show the default for Python here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I ended up removing this content from the language-specific pages in favor of the centralized environment variable config page (to avoid duplicating). What do you think? (We could add the details per SDK here too).
| ### Existing Datadog log injection | ||
| If you are currently using `DD_LOGS_INJECTION=true` and an Agent to tail log files: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Should this also say to configure the Agent to not tail the application log file? Otherwise the logs will be duplicated - we say this on the .NET page.
| ##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` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We should also includeDD_TRACE_OTEL_ENABLED in this section
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Added! Is the default for this true since it maps to !OTEL_SDK_DISABLED, which is false by default?
Note: Also applied your other suggestions to the config page. Thanks!
| :**Datadog convention**:`DD_TAGS` <br> | ||
| **Description**: Key-value pairs to be used as resource attributes. <br> | ||
| **Notes**: Datadog-defined configurations take precedence. | ||
| -`deployment.environment.name` (maps to`DD_ENV`): Resolved with the following precedence: <br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I like this breakdown for ENV and VERSION. Can we also include SERVICE here in this same block? TheOTEL_SERVICE_NAME environment variable still deserves a mention but I think having the key UST info all here would be more clear.
| `OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE` | ||
| :**Description**: Specifies the aggregation`temporality` to use for each instrument kind. <br> | ||
| **Accepted values**:`Cumulative`,`Delta`,`LowMemory`. <br> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
What do you think of linking out to OpenTelemetry to describe this? With this specific page linked:https://opentelemetry.io/docs/specs/otel/metrics/sdk_exporters/otlp/#additional-environment-variable-configuration
| **Accepted values**:`Cumulative`,`Delta`,`LowMemory`. <br> | |
| **Accepted values**:`Cumulative`,`Delta`,`LowMemory`.For more details, see the[OpenTelemetry specification][Link#].<br> |
| :**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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
We should link to our documentation for why it's the Datadog-recommended configuration:https://docs.datadoghq.com/opentelemetry/guide/otlp_delta_temporality/
| **Notes**: This default value is Datadog's recommended configuration and differs from the OpenTelemetry specification's default. | |
| **Notes**: This default value`delta`is[Datadog's recommended configuration][Link#] and differs from the OpenTelemetry specification's default. |
| :****Datadog convention****:`DD_SERVICE`<br> | ||
| Sets the service name<br> | ||
| **Notes**: If`service.name` is also provided in`OTEL_RESOURCE_ATTRIBUTES`, then`OTEL_SERVICE_NAME` takes precedence<br> | ||
| `service.name` (Resource Attribute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think we should revert to the previous description while also adding theservice.name resource attribute info to theOTEL_RESOURCE_ATTRIBUTES description later.
This is resolved as a resource attribute, not from
OTEL_SERVICE_NAME.
I'm not sure where this info came from, butOTEL_SERVICE_NAMEis responsible for setting theservice.nameresource attribute. It's a little weird because in our traces we don't really use resource attributes, but in our metrics and logs we do.
Uh oh!
There was an error while loading.Please reload this page.
What does this PR do? What is the motivation?
Document phase 1 of OTel Metrics and Logs API support for:
Previews
Changes
content/en/opentelemetry/instrument/api_support/_index.mdto include metrics and logs details.layouts/shortcodes/otel-config-precedence.en.md: Config precedence content.layouts/shortcodes/otel-overview-exporter.en.md: Exporter-based setup overview content.layouts/shortcodes/otel-overview-native.en.md: Native-based setup overview content.content/en/opentelemetry/config/environment_variable_support.md.Merge instructions
Merge readiness:
For Datadog employees:
Your branch name MUST follow the
<name>/<description>convention and include the forward slash (/). Without this format, your pull request will not pass CI, the GitLab pipeline will not run, and you won't get a branch preview. Getting a branch preview makes it easier for us to check any issues with your PR, such as broken links.If your branch doesn't follow this format, rename it or create a new branch and PR.
[6/5/2025] Merge queue has been disabled on the documentation repo. If you have write access to the repo, the PR has been reviewed by a Documentation team member, and all of the required checks have passed, you can use theSquash and Merge button to merge the PR. If you don't have write access, or you need help, reach out in the #documentation channel in Slack.
Additional notes