Comments (3)
How can I test that parent ID is set correctly?
You can replace the OTLP exporter with stdout exporter
let exporter = opentelemetry_stdout::SpanExporterBuilder::default().build();
This will print the span information to stdout and you can inspect the parentSpanId there.
You will also need to keep reference to tracer provider so it doesn't drop when init_observability
function. I recommend to set it as global default by adding this line in the init_observability
function
opentelemetry::global::set_tracer_provider(provider);
I tried this and this is the what I get
{
"resourceSpans": [
{
"resource": {
"attributes": [
{
"key": "telemetry.sdk.language",
"value": {
"stringValue": "rust"
}
},
{
"key": "telemetry.sdk.version",
"value": {
"stringValue": "0.22.1"
}
},
{
"key": "telemetry.sdk.name",
"value": {
"stringValue": "opentelemetry"
}
},
{
"key": "service.name",
"value": {
"stringValue": "unknown_service"
}
}
]
},
"scopeSpans": [
{
"scope": {
"name": "lambda"
},
"spans": [
{
"traceId": "65dc50081561ed7046ffcbcb114af027",
"spanId": "8c7d1cb651742fe8",
"parentSpanId": "b510129166d5a083",
"name": "Handler is called",
"kind": 1,
"startTimeUnixNano": 1710026004438046310,
"startTime": "2024-03-09 23:13:24.438",
"endTimeUnixNano": 1710026004438126497,
"endTime": "2024-03-09 23:13:24.438",
"attributes": [
{
"key": "code.filepath",
"value": {
"stringValue": "examples/tracing-jaeger/src/main.rs"
}
},
{
"key": "code.namespace",
"value": {
"stringValue": "tracing_jaeger"
}
},
{
"key": "code.lineno",
"value": {
"intValue": 54
}
},
{
"key": "thread.id",
"value": {
"intValue": 1
}
},
{
"key": "thread.name",
"value": {
"stringValue": "main"
}
},
{
"key": "busy_ns",
"value": {
"intValue": 0
}
},
{
"key": "idle_ns",
"value": {
"intValue": 0
}
}
],
"droppedAttributesCount": 0,
"droppedEventsCount": 0,
"flags": 1,
"droppedLinksCount": 0,
"status": {}
}
]
}
]
}
]
}
I will close this issue for now as the behavior is intented. Feel free to reopen should you have more questions
from opentelemetry-rust.
set_parent
is a tracing-opentelemetry
method that does not interact with the opentelemetry
structures the way you expect but instead on its own OtelData
.
Basically, you're dealing with two instrumentation APIs: opentelemetry
and tracing
(via tracing-opentelemetry
). It looks like you want to use tracing
for the rest of your instrumentation, so everything should work fine. You will find that the parent ID is correctly set when exporting the traces (example below in Jaeger).
from opentelemetry-rust.
Thank you for trying out my code. I could visualize traces using Jaeger too.
How can I test that parent ID is set correctly?
from opentelemetry-rust.
Related Issues (20)
- Overview of Major blockers for GA/Stable Release
- [Bug]: Span kind is always set to "internal" in v0.22.0 HOT 4
- URL encoded values for `OTEL_EXPORTER_OTLP_HEADERS` are not supported
- Updates opentelemetry registry with Rust ecosystem crates HOT 1
- urlencoding dependency removal HOT 2
- [Bug]: converting from jaeger to otlp does not compile HOT 2
- OTLP Exporter builder issues HOT 9
- [Bug]: OpenTelemetryTracingBridge is waiting a LoggerProvider HOT 2
- Recover Metrics Sum HashMap from Mutex poisoning during lock.
- [Bug]: Missing parent span used in Condvar in Jaeger exports HOT 2
- Metrics - Delta aggregation should not export unless new measurements are reported in current cycle
- Generate semantic conventions for metrics.
- Metrics SDK multi-threaded testing
- [Bug]: the Meter::i64_histogram() api removed HOT 2
- [Bug]: Error sending data to New Relic OTEL service HOT 1
- Replace TestExporter with InMemoryExporter
- [Bug]: opentelemetry-otlp inconsistency between http and grpc export endpoint for traces HOT 1
- [OTEL 0.22] shutdown SdkMeterProvider when built from opentelemetry-otlp? HOT 1
- [Bug]: TracerProvider can be dropped unknowingly HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from opentelemetry-rust.