census-instrumentation/opencensus-go

Construct a Span with manually populated SpanData

Closed this issue · 4 comments

Is your feature request related to a problem? Please describe.
I need to construct a Span with manually filled SpanData (I have all necessary information in code, and I need to provide it as-is for the Span: start time, end time, span kind, and attributes). Is this currently possible?

Describe the solution you'd like
I'd like to be able to construct a Span and SpanData manually and then instead of using trace.StartSpan/span.End() I'd like to be able to call something like trace.TraceSpan(span) passing in the manually constructed Span object.

Describe alternatives you've considered
Right now I'm not finding a way to achieve this.

Additional context
I've developing a telemetry solution which utilizes opencensus-go SDK to send data, so I need to construct spans manually from telemetry data that I already have.

Hi @tokaplan,

Is the reason to construct a Span just to pass it to the exporter or you need to add more data to the Span later? You can try to pass it directly to the exporter, does that work for you?

If I just pass it in, what would I be losing functionality-wise? Can you please show me a rough sample? I'm very new to this.

I think I figured it out. Indeed looks like this is exactly what I'm looking for. Thanks!

Existing functionality meets the requirement. So closing it.