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

+span implement withSpan() convenience #13

Merged
merged 4 commits into from
Oct 20, 2020
Merged

+span implement withSpan() convenience #13

merged 4 commits into from
Oct 20, 2020

Conversation

ktoso
Copy link
Member

@ktoso ktoso commented Oct 20, 2020

Resolves #4

A missing convenience that definitely is very useful.

This also sets precedence for other libraries to offer their future.withSpan() etc which we do want to encourage.

@ktoso ktoso requested review from slashmo, tomerd and yim-lee October 20, 2020 02:35
@@ -156,9 +156,9 @@ final class OSSignpostSpan: Span {
#if DEBUG
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this entire file will be removed anyway in remove use cases, we should have them in a future extras repo and the examples repos #14

Copy link
Collaborator

@slashmo slashmo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 😎

InstrumentationSystem.bootstrap(tracer)
InstrumentationSystem.bootstrapInternal(tracer)
defer {
InstrumentationSystem.bootstrapInternal(NoOpTracer())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we make the argument optional for bootstrapInternal to reset it in tearDown? Seems like you made the NoOpTracer publicly initializable for that purpose which seems a bit unnecessary to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to provide a NoOpTracer publicly anyway "just in case". The same has come up with logging where people wanted to manually create stuff and default to a NoOp. So pre-empting the same question coming up here;

For reference:

I also believe it is required by otel to provide an no-op, so we might as well play nice there right away.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't we make the argument optional for bootstrapInternal to reset it in tearDown?

Yeah valid point... but I still want to make the init public for the above reasons

@ktoso ktoso merged commit c0213fe into main Oct 20, 2020
@slashmo slashmo deleted the wip-withSpan branch January 27, 2021 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider tracer.withSpan() { ... } convenience APIs
3 participants