Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Controlling operation drop down in Datadog APM #115

Open
scirner22 opened this issue Oct 1, 2024 · 1 comment
Open

Controlling operation drop down in Datadog APM #115

scirner22 opened this issue Oct 1, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@scirner22
Copy link

Related Problems?

Reference: https://github.com/open-telemetry/opentelemetry-rust-contrib/blob/main/opentelemetry-datadog/src/exporter/mod.rs#L312C14-L312C35

I'm unsure if this is a feature request or lack of documentation/examples that show this, but I'm trying to control the operation that's passed on Datadog APM. It appears that this value is always static and not configurable, but it is a field that's meant to be configurable from a Datadog APM perspective. As an example, if you auto instrument a Java webservice with the trace agent you'll end up with multiple operations, some examples are servlet.request, redis, grpc.client, etc. I'm interested in configuring something similar to that from this rust library.

What component are you working with?

opentelemetry-datadog

Describe the solution you'd like:

Controllable, or instructions on how to control, the operation field.

Considered Alternatives

No response

Additional Context

No response

@scirner22 scirner22 added the enhancement New feature or request label Oct 1, 2024
@Hartigan
Copy link
Contributor

Hi

It's tricky, because require deep dive into source code and docs of tracing, tracing_subscriber, tracing_opentelemetry and opentelemetry crates. For my case tracing -> tracing_subscriber -> tracing_opentelemetry -> opentelemetry -> opentelemetry_datadog I use traces like this:

tracing::info_span!("any name", operation = "kafka.consume", otel.name = "my.awesome.topic", span.kind = "consumer", ...);

and overrides for operation name in builder:

    .with_name_mapping(|span, _| {
        span
            .attributes
            .iter()
            .find(|k| k.key.as_str() == "operation")
            .and_then(|kv| match &kv.value {
                Value::String(v) => Some(v.as_str()),
                _ => None,
            })
            .unwrap_or("fallback_operation_name")
    })

and overrides for resource name:

    .with_resource_mapping(|span, _| &span.name)

In result I have traces in APM with operation - kafka.consume, kind - CONSUMER and resource name - my.awesome.topic.

You also may pass error status and message: https://docs.rs/tracing-opentelemetry/latest/tracing_opentelemetry/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants