Python SDK: opentelemetry metrics not exporting

Hello!

We’ve got a DataDog agent that we’d like to send Temporal SDK metrics to via its support for OpenTelemetry ingestion.

We’re trying to follow the “How to emit metrics using the Python SDK” guide; this is our code to create the runtime:

from temporalio.runtime import OpenTelemetryConfig, Runtime, TelemetryConfig

runtime = Runtime (
    telemetry=TelemetryConfig(
        metrics=OpenTelemetryConfig(url=f"http://{DD_AGENT_HOST}:4318/v1/metrics")
    )
)

and we provide this runtime when we create the client, as described.

However, we’re not seeing any metrics being sent to our DataDog agent. I’ve also set an OpenTelemetry collector up in my local development environment and tried to get the SDK to export metrics to that. No luck there either.

Any leads? I noticed that OpenTelemetryConfig isn’t mentioned on the guide I linked above, so maybe this feature isn’t supported yet?

Thanks!!

This is expected to be an OTLP endpoint (a gRPC endpoint) and therefore a path on the URL doesn’t make sense. Maybe http://{DD_AGENT_HOST}:4317? Can you confirm the sample works for you using the local container with OTLP collector? This will confirm whether the issue is with Datadog specifically.

Also, due to DD issues w/ default OTel temporality, you may want to set the metric_temporality to OpenTelemetryMetricTemporality.CUMULATIVE in that OTel config.