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

Merged
merged 17 commits into from
Dec 11, 2024

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
@yurishkuro yurishkuro requested a review from atoulme 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.58%. Comparing base (751768f) to head (34127ed).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11769   +/-   ##
=======================================
  Coverage   91.58%   91.58%           
=======================================
  Files         446      448    +2     
  Lines       23741    23755   +14     
=======================================
+ Hits        21743    21757   +14     
  Misses       1623     1623           
  Partials      375      375           

☔ 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 Signed

The committers listed above are authorized under a signed CLA.

@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.

@mx-psi mx-psi requested a review from bogdandrutu November 28, 2024 16:58
@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]>
@yurishkuro
Copy link
Member Author

@mx-psi I move it to new experimental module, lmk if any concerns

@yurishkuro
Copy link
Member Author

/easycla

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.

This looks good to me (modulo solving the EasyCLA thing), but as I commented on #11779 I think we should settle in a convention for experimental module names by opening a PR here. I personally like the exp suffix better

@jarias-lfx
Copy link

/easycla

@yurishkuro
Copy link
Member Author

@mx-psi #11783

yurishkuro and others added 7 commits December 11, 2024 00:24
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]>
Signed-off-by: Yuri Shkuro <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
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.

Can you update the changelog to reference that this is in xcongihttp? LGTM otherwise :)

Signed-off-by: Yuri Shkuro <[email protected]>
@mx-psi mx-psi enabled auto-merge December 11, 2024 14:53
@mx-psi mx-psi added this pull request to the merge queue Dec 11, 2024
Merged via the queue into open-telemetry:main with commit 98f403f Dec 11, 2024
50 checks passed
@github-actions github-actions bot added this to the next release milestone Dec 11, 2024
@yurishkuro yurishkuro deleted the withotelhttpoption branch December 11, 2024 15:27
HongChenTW pushed a commit to HongChenTW/opentelemetry-collector that referenced this pull request Dec 19, 2024
#### Description
Add ability to provide OTel HTTP intrumentation options to `ToServer()`
function.

#### Link to tracking issue
Fixes open-telemetry#11770
Related to jaegertracing/jaeger#6265

#### Testing

Added unit test

---------

Signed-off-by: Yuri Shkuro <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Feb 10, 2025
#### Description
This PR deletes the TODO comment that sparked #9382. The original intent
is a bit unclear, but it is probably addressed by #11769. See tracking
issue for discussion and related PRs.

#### Link to tracking issue
Resolves #9382
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
4 participants