#open-telemetry #worker

opentelemetry-datadog-cloudflare

Datadog exporters and propagators for OpenTelemetry for Cloudflare workers

12 releases (breaking)

1.0.0 Feb 8, 2023
0.11.0 Mar 14, 2023
0.10.0 Mar 9, 2023
0.9.0 Nov 22, 2022
0.4.1 Jul 20, 2022

#565 in Debugging

Download history 9/week @ 2024-09-22

2,082 downloads per month

Apache-2.0

39KB
714 lines

OpenTelemetry — An observability framework for cloud-native software.

OpenTelemetry Datadog Cloudflare

Overview

This crate provides additional propagators and exporters for sending telemetry data to Datadog directly without going through the Datadog-agent.

Based on opentelemetry-datadog.

Features

opentelemetry-datadog-cloudflare supports following features:

  • reqwest-client: use the reqwest HTTP client to send spans.

lib.rs:

OpenTelemetry Datadog Exporter for Cloudflare

An OpenTelemetry datadog exporter implementation for Cloudflare

Quirks

There are currently some incompatibilities between Datadog and OpenTelemetry, and this manifests as minor quirks to this exporter.

Firstly Datadog uses operation_name to describe what OpenTracing would call a component. Or to put it another way, in OpenTracing the operation / span name's are relatively granular and might be used to identify a specific endpoint. In datadog, however, they are less granular - it is expected in Datadog that a service will have single primary span name that is the root of all traces within that service, with an additional piece of metadata called resource_name providing granularity. See here

The Datadog Golang API takes the approach of using a resource.name OpenTelemetry attribute to set the resource_name. See here

Unfortunately, this breaks compatibility with other OpenTelemetry exporters which expect a more granular operation name - as per the OpenTracing specification.

This exporter therefore takes a different approach of naming the span with the name of the tracing provider, and using the span name to set the resource_name. This should in most cases lead to the behaviour that users expect.

Datadog additionally has a span_type string that alters the rendering of the spans in the web UI. This can be set as the span.type OpenTelemetry span attribute.

For standard values see here

Bring your own http client

Users can choose appropriate http clients to align with their runtime.

Based on the feature enabled. The only client available is reqwest, feel free to implement other http clients.

Note that async http clients may need specific runtime otherwise it will panic. User should make sure the http client is running in appropriate runime.

Users can always use their own http clients by implementing HttpClient trait.

Dependencies

~4–18MB
~263K SLoC