-
Notifications
You must be signed in to change notification settings - Fork 487
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
Fix issue with metrics exporter in otelcol.exporter.loadbalancing #5684
Conversation
I understand that this is to stop the bleeding, so I think this is fine. However, I don't understand the underlying problem here, and why it's not an issue for OpenTelemetry Collector. Are they using different default configs for different telemetry types? Do we need to copy the same pattern? |
FYI, I tested this locally using the k6 traces creator and this config:
|
@@ -69,7 +71,7 @@ var ( | |||
// | |||
// The registered component must be registered to export the | |||
// otelcol.ConsumerExports type, otherwise New will panic. | |||
func New(opts component.Options, f otelexporter.Factory, args Arguments) (*Exporter, error) { | |||
func New(opts component.Options, f otelexporter.Factory, args Arguments, disableMetricsExporter bool) (*Exporter, error) { |
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 think adding a disableMetricsExporter
parameter feels a little too targeted for this specific bug. Since the exporter package is not where the bug originates, I think it can make adding this specific parameter a big confusing and vague.
I'd like to see this fix transform into a more general improvement to the exporter package's API, such as some kind of bitfield for which telemetry types to create exporters for, such as calling:
exporter.New(opts, fact, args.(Arguments), exporter.TypesAll)
, orexporter.New(opts, fact, args.(Arguments), exporter.TypeLogs|exporter.TypeTraces)
.
This will be more work, but I think it leaves the API design feeling more intentional rather than having the ability to disable specifically metrics.
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.
TBH I'm hoping we just get rid of this workaround soon altogether. We shouldn't be initialising a metrics exporter if other components are not configured to send metrics to the LB exporter. I think that's the real problem.
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 added a bitfield just now, and also tested it locally by running the agent with an LB exporter and an otlp one. PTAL.
I think Collector would only create a metrics exporter if it's explicitly requested. I think a metrics exporter for an LB would only be created it it's in a metrics pipeline. There's an example of a traces pipeline in the otel docs. We had to make changes to |
329ff93
to
56ad725
Compare
56ad725
to
4146f63
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.
Thanks!
PR Description
In #5529, we upgraded Agent from OTel 0.85 to 0.87. One of the recent changes in OTel is the ability of the LB exporter to work with metrics. Unfortunately, this also means that its metrics exporter rejects configs which use the "traceID" routing key. Due to the way otelcol components are intialised, we always create all three exporters (logs, metrics, traces) for each otelcol exporter.
Agent does not need to support the metrics exporter in the LB exporter. That's because metrics exporting is experimental, and
otelcol.exporter.loadbalancing
is labeled in Flow as beta. For this reason metrics routing keys were explicitly disabled during #5529, and the ability to export metrics was not documented in the Flow docs forotelcol.exporter.loadbalancing
.Notes to the Reviewer
This issue was reported on the community Slack.
This PR is a temporary workaround so that
otelcol.exporter.loadbalancing
will work again with a routing key of "traceID". We will need to find a permanent solution to this problem soon. And remove this workaround.PR Checklist