You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The components subcommand is useful for understanding which types are available, but it would be helpful in some cases to know the exact module and version which defines each component.
Describe the solution you'd like
Enhance the components subcommand to include the go module and version.
The best solution I have found involves using runtime.Caller. Basically, within each <kind>.NewFactory function we can call runtime.Caller to get the module (including version), then save the result onto the corresponding <kind>.factory struct and return it via a new method on the corresponding <kind>.Factory interface, e.g. GoModule() string. Here is a working prototype.
Describe alternatives you've considered
I explored whether reflection could be used on the factories directly but could not identify a mechanism to get the corresponding module. The only way I can find to get any information about modules is using runtime.debug.ReadBuildInfo, but this provides an comprehensive list of module dependencies for the collector binary, without any reliable way to match them to the factories.
I also explored the possibility of using the OCB manifest in some way, but I have not identified a straightforward way to match modules with corresponding component types. e.g. How do we know for certain that go.opentelemetry.io/collector/receiver/otlpreceiver contains a component type called otlp? Presumably we could enhance the FactoryMap structs to pair the module string with the factory, but this seems overly complicated and won't apply to collectors built outside of OCB.
Additional context
This same information would be extremely useful for OpAMP, since a server would be able to confidently understand the exact components available in a collector, including the precise corresponding configuration. Adding it to the components subcommand seems like a natural first step. Later, we should be able to make the information available to the opampextension in some way.
The text was updated successfully, but these errors were encountered:
djaglowski
changed the title
Components subcommand - option to describe module@version for each component
Components subcommand - Add module@version for each component
Jul 9, 2024
Resolves#10570
Alternative to #10598
This implementation is more reliable that #10598 because it gets
information directly from the builder manifest. It relies on additional
structure in the `component.go` file, ultimately encoded in
`otelcol.Factories`.
An alternative would be to push the enhancements deeper, into the
`<kind>.Factories` implementations, so that the module information is
available directly alongside the Factory.
Is your feature request related to a problem? Please describe.
The
components
subcommand is useful for understanding which types are available, but it would be helpful in some cases to know the exact module and version which defines each component.Describe the solution you'd like
Enhance the
components
subcommand to include the go module and version.Current Output:
Proposed Output:
The best solution I have found involves using
runtime.Caller
. Basically, within each<kind>.NewFactory
function we can callruntime.Caller
to get the module (including version), then save the result onto the corresponding<kind>.factory
struct and return it via a new method on the corresponding<kind>.Factory
interface, e.g.GoModule() string
. Here is a working prototype.Describe alternatives you've considered
I explored whether reflection could be used on the factories directly but could not identify a mechanism to get the corresponding module. The only way I can find to get any information about modules is using
runtime.debug.ReadBuildInfo
, but this provides an comprehensive list of module dependencies for the collector binary, without any reliable way to match them to the factories.I also explored the possibility of using the OCB manifest in some way, but I have not identified a straightforward way to match modules with corresponding component types. e.g. How do we know for certain that
go.opentelemetry.io/collector/receiver/otlpreceiver
contains a component type calledotlp
? Presumably we could enhance theFactoryMap
structs to pair the module string with the factory, but this seems overly complicated and won't apply to collectors built outside of OCB.Additional context
This same information would be extremely useful for OpAMP, since a server would be able to confidently understand the exact components available in a collector, including the precise corresponding configuration. Adding it to the
components
subcommand seems like a natural first step. Later, we should be able to make the information available to the opampextension in some way.The text was updated successfully, but these errors were encountered: