Open scirner22 opened 1 month ago
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/
Thank you! I'll try to make use of this and test the results.
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 multipleoperations
, some examples areservlet.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