-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
[extension] Add ModuleInfo to extension.Settings #10888
Conversation
9b2ec15
to
990621c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any test cases we can add? If nothing else maybe a test that demonstrates how it would be used in extension creation?
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #10888 +/- ##
==========================================
+ Coverage 91.60% 91.62% +0.01%
==========================================
Files 404 404
Lines 18980 18990 +10
==========================================
+ Hits 17387 17399 +12
+ Misses 1234 1233 -1
+ Partials 359 358 -1 ☔ View full report in Codecov by Sentry. |
ed1271f
to
82d9fdb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'll recuse myself from approval since I contributed to it.
cc: @open-telemetry/collector-maintainers |
82d9fdb
to
25a5bb6
Compare
@@ -51,6 +51,15 @@ type ConfigWatcher interface { | |||
NotifyConfig(ctx context.Context, conf *confmap.Conf) error | |||
} | |||
|
|||
// ModuleInfo describes the go module for each component. | |||
type ModuleInfo struct { | |||
Receiver map[component.Type]string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have more structure? For example, should we use https://pkg.go.dev/golang.org/x/mod@v0.20.0/module#Version (or something similar) instead?
I am a bit hesitant about using module.Version
directly since that module has a 0.x version, but something similar may make sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not opposed to structuring it more but it wasn't clear to me either what that structure should be. I think it's worth noting that the module string is something of a standard in its own right, since its interpretable by go tooling.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not opposed to structuring it more but it wasn't clear to me either what that structure should be
Hm, I guess a light wrapper around the module.Version
I linked above makes sense.
But thinking about it more I remembered open-telemetry/opentelemetry-collector-contrib/issues/31136, where we put int
as the type for a stepping number, that is commonly represented as a string, and then found out that there are edge cases where it's not representable as an int.
I guess a wrapper would make this situation manageable, but the lesson I learned there is that using a string may be better when you don't control the evolution of what you are representing.
This is all to say: if you feel like a string works, let's go with a string :)
Description
Paired with @djaglowski on adding a new struct,
ModuleInfo
, toextension.Settings
. The goal is to make the collector's component go modules available to extensions that may want to use that information (in particular the OpAMP extension).We didn't want to modify the
extension
package but adding this information to the Settings struct seems to be the most painless way to make this information available. No function signatures need to be updated and existing extensions can just ignore the new field on the Settings struct unless they want the information.Link to tracking issue
Fixes #10876
Testing
Updated existing tests.