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

Add confighttp.WithOtelHTTPOptions #11769

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

yurishkuro
Copy link
Member

@yurishkuro yurishkuro commented Nov 28, 2024

Description

Add ability to provide OTel HTTP intrumentation options to ToServer() function.

Link to tracking issue

Fixes #11770
Related to jaegertracing/jaeger#6265

Testing

Added unit test

@yurishkuro yurishkuro requested a review from a team as a code owner November 28, 2024 04:36
Copy link

linux-foundation-easycla bot commented Nov 28, 2024

CLA Signed

@yurishkuro yurishkuro changed the title Withotelhttpoption Add confighttp.WithOtelHTTPOptions Nov 28, 2024
Copy link

codecov bot commented Nov 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.45%. Comparing base (33264a5) to head (c6a0538).

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11769   +/-   ##
=======================================
  Coverage   91.45%   91.45%           
=======================================
  Files         447      449    +2     
  Lines       23721    23735   +14     
=======================================
+ Hits        21694    21708   +14     
  Misses       1653     1653           
  Partials      374      374           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@mx-psi mx-psi left a comment

Choose a reason for hiding this comment

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

otelhttp is not 1.0 and has no plans to be 1.0 in the foreseeable future. Introducing this as part of the public API of confighttp would prevent us from marking it as 1.0 until otelhttp is marked as 1.0.

Is there a way to introduce this so that WithOtelHTTPOptions either does not depend on a symbol in otelhttp or is not in the confighttp package?

@yurishkuro
Copy link
Member Author

yurishkuro commented Nov 28, 2024

Introducing this as part of the public API of confighttp would prevent us from marking it as 1.0 until otelhttp is marked as 1.0.

  • The chance that otelhttp would change the "options" concept is near zero.
  • If they do, we can always deprecate the new option here or make it no-op.
  • This module depends on plenty of other 0.x modules, both internal and external e.g. github.com/golang/snappy v0.0.4

@yurishkuro
Copy link
Member Author

/easycla

Copy link

linux-foundation-easycla bot commented Nov 28, 2024

CLA Not Signed

@yurishkuro
Copy link
Member Author

/easycla

@mx-psi
Copy link
Member

mx-psi commented Nov 28, 2024

Introducing this as part of the public API of confighttp would prevent us from marking it as 1.0 until otelhttp is marked as 1.0.

  • The chance that otelhttp would change the "options" concept is near zero.

Agreed

  • If they do, we can always deprecate the new option here or make it no-op.

Worst case scenario is that the concept is removed altogether. I think this is extremely unlikely, but we wouldn't have a non-breaking way of dealing with it.

  • This module depends on plenty of other 0.x modules, both internal and external e.g. github.com/golang/snappy v0.0.4

The particular rule we are breaking is this one from the VERSIONING.md doc:

Dependency updates. Updating dependencies is not considered a breaking change except when their types are part of the public API or the update may change the behavior of applications in an incompatible way.

I am fine accepting this change if we first amend VERSIONING.md to reflect the new policy we are following.

@yurishkuro
Copy link
Member Author

Dependency updates. Updating dependencies is not considered a breaking change except when their types are part of the public API or the update may change the behavior of applications in an incompatible way.

Hm, I don't know how we can do this without exposing otelhttp.Option type. We could fully duplicate their options and translate, but that feels like a massive overkill.

@mx-psi
Copy link
Member

mx-psi commented Nov 28, 2024

One way of doing this without changing VERSIONING.md is to move this option to a separate module. It feels like an overkill to have a separate module for just one option but I guess modules are free 🤷 This is basically the pattern we have here: https://pkg.go.dev/go.opentelemetry.io/collector/pipeline/pipelineprofiles

@yurishkuro
Copy link
Member Author

to move this option to a separate module

don't think it will work, the options operate on a private struct in confighttp

@mx-psi
Copy link
Member

mx-psi commented Nov 29, 2024

to move this option to a separate module

don't think it will work, the options operate on a private struct in confighttp

The way to do this is to move the struct to an internal package, define all options in that internal package and re-export them in the appropriate module (the otelhttp one in a separate module, the others in confighttp)

@yurishkuro
Copy link
Member Author

I don't follow that. Internal package would have to be in some module, so another module would not be able to reference it.

But if we do it in the same module with an experimental sub-package then it could work, e.g confighttp.confighttpx.WithOtelHTTPOptions

@mx-psi
Copy link
Member

mx-psi commented Nov 29, 2024

@yurishkuro Here is a more explicit explanation of the pattern: https://dmathieu.com/en/development/go-architecture-semver/stable-experimental-modules/ I think we are talking about the same thing

Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
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.

Allow confighttp.ToServer() to accept options for otelhttp instrumentation
2 participants