Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Would like to set TraceID and SpanID #173

Closed
ham1 opened this issue Mar 9, 2023 · 10 comments
Closed

Would like to set TraceID and SpanID #173

ham1 opened this issue Mar 9, 2023 · 10 comments
Labels
enhancement New feature or request patch patch semver

Comments

@ham1
Copy link

ham1 commented Mar 9, 2023

We are trying to use this for a complex build pipeline, it works inside jobs (we create a known root span ID and trace ID and then set TRACEPARENT at the start of each job)
However, we can't find a way to send the root span at the end of the pipeline.
If we could specify the trace ID and span ID then this would work for us.
Thank you!

@ham1 ham1 changed the title Can we set the TraceID and SpanID Would like to set TraceID and SpanID Mar 9, 2023
@tobert
Copy link
Collaborator

tobert commented Mar 10, 2023

🤔 This will be a little tricky because opentelemetry-go (by way of the specs) makes it difficult to set your own trace/span id. I like the idea though and will try a few things next week.

@tobert tobert added enhancement New feature or request patch patch semver labels Mar 10, 2023
@wushujames
Copy link

I think it's possible to provide your own ID generator.

https://github.com/open-telemetry/opentelemetry-go/blob/6a95d5770c347859d7b71dc660361f875f3d44fb/sdk/trace/tracer.go#L89

@tobert
Copy link
Collaborator

tobert commented Mar 14, 2023

The PR linked is where I think I will end up, but also I tracked down how to configure the idGenerators. It's a viable approach but also a hack which is why I'm considering the direct-to-protobuf PR in #175.

https://github.com/open-telemetry/opentelemetry-go/blob/6a95d5770c347859d7b71dc660361f875f3d44fb/sdk/trace/provider.go#L329

@ham1
Copy link
Author

ham1 commented Apr 20, 2023

I can see a lot of work on the PR, so thank you, just wanted to check if you had an ETA for this as we'd love to use this feature.
Thank you!

@ham1
Copy link
Author

ham1 commented May 11, 2023

I noticed the PR #175 has been merged, does this now solve this issue?
If so, how and can we please have a release, if not, what more needs doing? We might have some time to help with another PR.

@tobert
Copy link
Collaborator

tobert commented May 12, 2023

@ham1 175 doesn't totally solve the issue, but makes it easy to add what you need. I'm swamped the next couple weeks but will try to get the PR out there, unless you beat me to it.

As for release, I have a few follow-ups to 175 to finish up then I should definitely do a release. Maybe 2 weeks from now? I'm open to cutting v0.4.0 sooner and going incremental if it helps you out.

@tobert
Copy link
Collaborator

tobert commented May 13, 2023

Looks like adding a command-line flag to span.go and conditions to NewProtobufSpanWithConfig()

func NewProtobufSpanWithConfig(c Config) tracepb.Span {

this seems ok:
otel-cli span --span-id ${span_id} --trace-id ${trace_id} --name "root trace" --start "${start_time}" --end "${end_time}"
or should it be a bit more explicit?
otel-cli span --force-span-id $span_id?

I don't like the latter. otel-cli users know wtf they're doing usually. OTel spec doesn't like allowing it. But otel-cli has to make a lot of compromises anyways. I can be convinced.

tobert added a commit that referenced this issue May 23, 2023
* add span options to status command

Useful to test the new --force-span-id and --force-trace-id options.

* add --force-trace-id and --force-span-id and test

As predicted, this was straightforward after #175 :)

* correct option names in comments

* match json key names to command line flags
@tobert
Copy link
Collaborator

tobert commented May 23, 2023

@ham1 I merged #210 so head should let you do what you want. That was the last issue so I'll start work on releasing v0.3.0 this week.

@ham1
Copy link
Author

ham1 commented May 24, 2023

That's great, thank you. Should we add some examples to the README and add them to the table of arguments?

@tobert
Copy link
Collaborator

tobert commented May 26, 2023

release v0.3.0, please reopen if there's still an issue

@tobert tobert closed this as completed May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request patch patch semver
Projects
None yet
Development

No branches or pull requests

3 participants