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

othttp: add WithSpanFormatter option #617

Merged
merged 7 commits into from
Apr 6, 2020

Conversation

marwan-at-work
Copy link
Contributor

Fixes #616

@Aneurysm9
Copy link
Member

This looks good to me, though I'd like to see tests for the WithSpanFormatter option. Are there any formatters that would make sense to include in the plugin beyond the defaultFormatter?

@marwan-at-work
Copy link
Contributor Author

@Aneurysm9 I added a test case for WithSpanFormatter

As for other cases, I imagine a formatter that always returns r.URL.Path would be handy. Happy to add that if need be

Copy link
Member

@Aneurysm9 Aneurysm9 left a comment

Choose a reason for hiding this comment

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

LGTM


tracer trace.Tracer
props propagation.Propagators
spanStartOptions []trace.StartOption
readEvent bool
writeEvent bool
filters []Filter
spanFormatter func(*http.Request) string
Copy link
Member

Choose a reason for hiding this comment

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

I think that Handler should preserve the operation member and the span formatter should receive the operation name string as a parameter too, otherwise the operation parameter in the NewHandler function becomes useless if we pass a custom span formatter.

Also, shouldn't it be called spanNameFormatter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@krnowak the way I thought about it is that if a user passes "othttp.WithSpanFormatter", then they can assume "operation" is overwritten, but I will change that into your suggestion.

Also, spanNameFormatter sounds good, should we also change the option name from othttp.WithSpanFormatter into othttp.WithSpanNameFormatter?

Copy link
Member

Choose a reason for hiding this comment

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

Also, spanNameFormatter sounds good, should we also change the option name from othttp.WithSpanFormatter into othttp.WithSpanNameFormatter?

Yes, please.

internal/trace/mock_tracer.go Outdated Show resolved Hide resolved
@marwan-at-work
Copy link
Contributor Author

@krnowak I updated the PR with your suggestions, but I'm happy to backtrack or make further changes. Thanks

internal/trace/mock_tracer.go Outdated Show resolved Hide resolved
plugin/othttp/handler_test.go Show resolved Hide resolved
marwan-at-work and others added 2 commits April 6, 2020 11:11
Co-Authored-By: Rahul Patel <rghetia@yahoo.com>
@rghetia rghetia merged commit 6489b07 into open-telemetry:master Apr 6, 2020
@pellared pellared added this to the untracked milestone Nov 8, 2024
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.

othttp: Allow dynamic span name based on URL Path or a functional option
5 participants