-
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
[kafka] Add option to supply destination topic through context #34503
Conversation
32922e2
to
8888100
Compare
17756ba
to
7c178ce
Compare
@codeboten can we move this PR forward? |
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.
Sorry to block this at the last minute but I don't think we should add an allowlist exception for this. Arbitrary Go API for building packages should be either in internal
(if meant only for Collector contrib components) or in pkg
(if meant also for external components, in which case I would like to have an example of which external component is going to use this)
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 am not sure I want to encourage passing metadata via context, in my experience it has not lead to a good time and often caused more issues than what it attempts to solve.
I also think this could create non deterministic behaviour (from a user's perspective) where data is being routed to topics that don't exist or conditions of which the data is routed to a topic do not make sense.
I would prefer users using the routing connector and having several kafka exporters that is very clearly configured and understood how data is being routed and delivered.
I am not blocking this PR because it appears there is some interest in having some form of dynamic routing configuration, but this is not the way I suggest it should done. |
@MovieStoreGuy I mostly agree with you. The situation is a bit tricky for us, because we write our own custom components for Gateway Collectors that run in a multi-tenanted fashion. Due to the breadth of tenant scope and broker/topic structure it's not reasonable for everything to be explicitly declarative via configuration. In a perfect world we'd derive a topic name and print it into the telemetry attributes and leverage that value using existing component capabilities. However, we see the topic name as an internal detail and not something we want to expose to tenants via the database (post-ingestion). This is the best option we've come up with so far, because the Collector component architecture doesn't provide a mechanism for agent-local metadata propagation other than telemetry data or |
This allows for upstream connectors to control the destination without polluting the data being written.
Raw string keys aren't allowed by the linter.
and exclude new package from single export limit.
`make gotidy crosslink genoteltestbedcol`
076abc7
to
7c1d4bf
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.
@MovieStoreGuy Could you take a look at the comments above?
Following up here. @pavolloffay @mx-psi @codeboten anything else I need to do? |
Yeah, I get where you're coming from. I also think this problem isn't strictly limited to Kafka, you still have the same problem with something like OTLP exporter as an example if you wanted to include some amount of auth/meta data.
The approach does go against the recommendations of go design paradigms suggest where Context isn't recommended to be used for business logic, however, I can see why we'd need it. I am happy to approve this, but once there is a notion of supporting tenancy, I'd like for this approach to be deprecated in favour of what is to come, does that sound reasonable to you? |
I'm fine with that. I took this path because there wasn't another option for passing data along that wasn't embedded in the exportable data. |
efff81e
to
4887227
Compare
# Conflicts: # cmd/otelcontribcol/go.mod # exporter/kafkaexporter/go.mod # receiver/kafkareceiver/go.mod
4887227
to
fd5aeed
Compare
I merged from main and resolved the conflicts. |
…telemetry#34503) **Description:** <Describe what has changed.> <!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> Add option to get destination topic from context. This allows for upstream connectors to control the destination without polluting the data being written. **Link to tracking Issue:** <Issue number if applicable> Fixes open-telemetry#34432 **Testing:** <Describe what testing was performed and which tests were added.> Added unit tests. **Documentation:** <Describe the documentation added.> Updated the component readme with the added setting. --------- Co-authored-by: Pablo Baeyens <pablo.baeyens@datadoghq.com> Co-authored-by: Sean Marciniak <30928402+MovieStoreGuy@users.noreply.github.com>
Description:
Add option to get destination topic from context. This allows for upstream connectors to control the destination without polluting the data being written.
Link to tracking Issue:
Fixes #34432
Testing:
Added unit tests.
Documentation:
Updated the component readme with the added setting.