-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Routing statements are not parsed properly if statement strings match #30663
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
Added a draft pull request that would fix this issue (according to unit tests). In the meantime I'll build a collector image from this state and test it manually. |
Is there any reason the configuration you're sharing wouldn't be the following?
The connector very clearly supports routing the same statement to multiple pipelines. In the case of the config you've shared I'd actually prefer failing the collector on startup with a descriptive message telling the user that multiple identical routing statements should be consolidated into one. This may break existing configurations that currently run, but the existing configurations are not doing what users want, so I don't believe this is actually a negative impact. The alternative would be internally resolving the mismatched logic in the collector as you've shared, but I worry about long term complexity of this going forward. In general, having users supply bad configs and then the collector fixing it without letting the user know can lead to ambiguous behavior and complex code. I'd rather just keep it simple and clearly communicate to users when something like this is happening. I'll defer to code owners though, I might be missing something here. |
My assumption here was that the intended behaviour is what is in the submitted draft. At the current state the config parsing only "detects" these kinds equivalent statements if they are completely matching strings, but in case one is |
That's fair, but in the case of whitespace differences (or any other string mismatches) the existing solution handles it the way you're requesting, right? The statements will still get routed where they're supposed to go and there wouldn't be conflicts. It just makes more sense to me to add more validation to input rather than adding internal logic to handle config mistakes programmatically. The collector's design makes it so that every defined config can go through it's own validation process, resulting the collector failing to start on invalid configs. It seems like the more idiomatic approach for the collector's design. I'll defer to code owners here though, I might be missing something. 👍 |
My two cents: I beleive the point in @kristofgyuracz 's reasoning is that adding meaningful validation of statements (to make sure they are non-identical) would be non-trivial to implement and a simple equality check doesn't really add that much protection. |
Agreed! I don't see much value in that at this point, given the amount of work required and the relatively little impact.
Also agreed, however, the only existing issue that's being discussed is a 100% string match between two different routes. This is the bug that we're facing that causes one route to be over-written by another. If there's any trivial whitespace difference they will be separate entries in the map, and their routes will be preserved. Am I still following? Did I miss something? The more I think about this the less strong of a preference I have, whether we fail config validation or simply handle it the way the PR has proposed. I'll defer to others, I'm fine either way. |
Yes, that's right. We were able to do a workaround for this issue, and I agree with you that either direction could be fine, but it would be nice to have a clearly deterministic behaviour. |
I don't know what to take from this issue: the title doesn't seem to match what was discussed so far. Here's what I understand the routing connector does, and what might be done to improve it: ✔ same string, multiple pipelines Other than doing a basic trim on the conditions, I wouldn't do anything else to address the last one. Yes, people can do a condition being "1==1" and "2==2", which are logically the same, but I don't think the connector should care about that at all. Perhaps @mwear has a different view? |
We encountered this specific scenario, and it's a completely valid point that it shouldn't work. The current behaviour is that the config is parsed without any error message, and collector will route messages differently, than what is in the parsed config. I think in this case, logging an error message, or failing to start the collector (with an error message pinpointing the issue) would be more user friendly. |
I would strongly prefer that we handle this through better validation rather than introducing unnecessary complexity into the router itself. We can check for conflicting routes during config validate, and log a warning, or return an error. Routers in the wild vary in how they handle conflicting routes. |
Thanks for the feedback! If that's okay, i'll submit a PR for logging a warning and continuing. |
That'd be great. Thanks! |
…n-telemetry#31297) **Description:** <Describe what has changed.> Based on discussion in open-telemetry#30663, a warning is logged if there are two or more routing items with the same routing statement. **Link to tracking Issue:** open-telemetry#30663
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
I believe this can be closed as #31297 has been merged. |
Resolved by #31297 |
Component(s)
connector/routing
What happened?
Description
If two routing table entries have the exact same routing strings(, but different target pipelines), messages will be only forwarded to one of the target pipelines.
The reason is that it the route map's key is the routing statement string, and during parsing it is overwritten by the second entry.
https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/v0.92.0/connector/routingconnector/router.go#L133
Steps to Reproduce
Expected Result
Messages are sent to both pipelines.
Actual Result
Messages are sent to only one of the pipelines.
Collector version
0.92.0
Environment information
Environment
Kubernetes distro: KinD v1.27.3
Opentelemetry-operator
OpenTelemetry Collector configuration
Log output
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: