Description
Describe the bug
Figuring out the manner in which traces are supposed to be recorded has been a bit difficult because it's changed so much, but the last thing I've tried is the (new?) trace
method. But the problem is that no Span
has the root ID (indeed, nothing but tests invoke the SpanId.root()
method).
Consequently, the span that should be marked as root is instead marked as invalid and Grafana shows:
And there doesn't seem to be a "way in" such that I can manually override or control the ID of the span.
Steps to reproduce
I'm just doing:
final tracer = globalTracerProvider.getTracer('my_app');
return trace(
'span_name',
() async { /* code here */ },
tracer: tracer,
spanKind: SpanKind.client,
);
I also tried specifying newRoot: true
, but it made no difference (nor did I expect it to based on the current code).
What did you expect to see?
I don't know if my expectations are off, but I expected the library to just make sure the first span for the context is marked as the root span. I don't think any kind of manual intervention should be required.
What did you see instead?
No span is marked as root. What should be the root span instead has the invalid ID.
What version and what artifacts are you using?
`opentelemetry: 0.18.9`
My bootstrap logic looks like:
final tracerProvider = TracerProviderBase(
processors: [
BatchSpanProcessor(
CollectorExporter(Uri.parse('http://localhost:4318/v1/traces')),
),
SimpleSpanProcessor(ConsoleExporter()),
],
);
registerGlobalTracerProvider(tracerProvider);
registerGlobalTextMapPropagator(W3CTraceContextPropagator());
Environment
Dart Version: 3.7.0
OS: Windows 10