opentelemetry-python icon indicating copy to clipboard operation
opentelemetry-python copied to clipboard

export unclosed span

Open LilyHolms opened this issue 2 years ago • 8 comments

We are using BatchSpanProcessor to batch spans and pushes them to jaeger exporter. We noticed a span is exported only when it ends.

However, our system have root span which runs across different microservice, and we hope to query span attributes from db before the span finishes.

Is there a way for us to export span once it starts, and update the span on any change in attributes or span status?

LilyHolms avatar Jun 09 '22 19:06 LilyHolms

That's not possible

srikanthccv avatar Jun 09 '22 21:06 srikanthccv

Well, is it possible to attach extra attributes after a span ends?

LilyHolms avatar Jun 10 '22 04:06 LilyHolms

is it possible to attach extra attributes after a span ends

No, they are discarded after it ends.

srikanthccv avatar Jun 10 '22 04:06 srikanthccv

Is there a way for us to export span once it starts, and update the span on any change in attributes or span status?

I'm curious if Jaeger even supports this

However, our system have root span which runs across different microservice, and we hope to query span attributes from db before the span finishes.

If you don't mind expanding a bit, what does the downstream service do with those attributes? I wouldn't count on the root span being queryable from Jaeger before the second downstream microservice queries it.

Have you looked into Baggage? This is good way to propagate some attributes downstream.

aabmass avatar Jun 10 '22 18:06 aabmass

@aabmass @srikanthccv I have the same question. What's the recommended way to keep track of the on-going spans if a span is going to take long time to end?

bigqi0812 avatar Jun 10 '22 23:06 bigqi0812

@bigqi0812 What's your use case? How long does it take to complete?

The best option I can think of is zpages but we don't have that as of today https://github.com/open-telemetry/opentelemetry-specification/blob/main/experimental/trace/zpages.md#overview

srikanthccv avatar Jun 22 '22 00:06 srikanthccv

What Lily is asking is similar to https://github.com/open-telemetry/opentelemetry-specification/issues/373

without that - we is there a way for us to view "current/inflight/inprogress" spans? @srikanthccv

simingy avatar Jul 11 '22 17:07 simingy

No, currently there is no way to do that other than what I previously mentioned.

srikanthccv avatar Jul 11 '22 19:07 srikanthccv

One can probably build a custom span processor + exporter combination to achieve but not something supported. Please raise a feature request in https://github.com/open-telemetry/opentelemetry-specification.

srikanthccv avatar Feb 04 '23 20:02 srikanthccv