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

Refactor splunkhttp config processing #40

Closed
wants to merge 1 commit into from
Closed

Refactor splunkhttp config processing #40

wants to merge 1 commit into from

Conversation

pellared
Copy link
Contributor

@pellared pellared commented Apr 15, 2021

Why

#30 (comment)

Make the functional options API more user-friendly.
Currently, sample usage looks like this:

handler = splunkhttp.NewHandler(handler, "server", splunkhttp.WithOTelOpts(otelhttp.WithTracerProvider(provider)), splunkhttp.WithTraceResponseHeader(false))

What

Refactor config processing in splunkhttp package.

The changes allows achieving the following usage:

handler = splunkhttp.NewHandler(handler, "server", otelhttp.WithTracerProvider(provider), splunkhttp.WithTraceResponseHeader(false))

splunkhttp.WithOTelOpts() is no longer needed.

Deeper analysis and comparison to other possible approaches can be found here: open-telemetry/opentelemetry-go-contrib#746

Moreover, some tests were moved to appropriate files (see comments in PR).

@@ -23,23 +23,22 @@ import (
"go.opentelemetry.io/otel/oteltest"
)

func TestTraceResponseHeaderMiddleware(t *testing.T) {
Copy link
Contributor Author

@pellared pellared Apr 15, 2021

Choose a reason for hiding this comment

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

Moved to trace_response_header_test.go

@@ -23,12 +23,13 @@ import (
"go.opentelemetry.io/otel/oteltest"
)

func TestNewHandlerTraceResponseHeaderDisabled(t *testing.T) {
Copy link
Contributor Author

@pellared pellared Apr 15, 2021

Choose a reason for hiding this comment

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

Moved to handler_test.go

@owais
Copy link
Contributor

owais commented Apr 15, 2021

image

Why is the one supposed to be more beautiful highlighted with nice colors and the old one b/w? I see what you did there. I'll remember this trick :D

@owais
Copy link
Contributor

owais commented Apr 15, 2021

Really like the net effect it has on API. Implementation looks fine and can be improve/changed later. 👍

@pellared
Copy link
Contributor Author

pellared commented Apr 15, 2021

@owais @MrAlias
I think we can merge it if you like this PR. All other proposals in open-telemetry/opentelemetry-go-contrib#746 have the same exported API.

Moreover, we could publish the first release of https://github.com/signalfx/splunk-otel-go 😉

However, there are good remarks in open-telemetry/opentelemetry-go-contrib#746 (comment)

@pellared
Copy link
Contributor Author

pellared commented Apr 16, 2021

@owais @MrAlias

I feel convinced to refactor this proposal. I put rationale further down in the issue.

Or we can keep the current design which is already in main.

What do you think?

@pellared pellared marked this pull request as draft April 16, 2021 23:25
@owais
Copy link
Contributor

owais commented Apr 17, 2021

That looks pretty good to me. Only concern is that this works with the HTTP handler. Will it work with other types of instrumentations as easily?

@pellared
Copy link
Contributor Author

pellared commented Apr 17, 2021

That looks pretty good to me. Only concern is that this works with the HTTP handler. Will it work with other types of instrumentations as easily?

This PR and current design on main branch will not.

But this proposal will. I will make a PR on Monday

@owais
Copy link
Contributor

owais commented Apr 17, 2021

Yeah, I meant the proposal. 👍

@pellared
Copy link
Contributor Author

@owais Here is the new PR #41

@pellared pellared closed this Apr 19, 2021
@pellared pellared deleted the refacor-config branch April 19, 2021 18:12
@pellared pellared restored the refacor-config branch April 19, 2021 18:12
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.

2 participants