Skip to content
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

[connector/routing] Support log record routing #35948

Closed
djaglowski opened this issue Oct 23, 2024 · 2 comments · Fixed by #35939
Closed

[connector/routing] Support log record routing #35948

djaglowski opened this issue Oct 23, 2024 · 2 comments · Fixed by #35939
Labels
connector/routing enhancement New feature or request needs triage New item requiring triage

Comments

@djaglowski
Copy link
Member

Component(s)

connector/routing

Is your feature request related to a problem? Please describe.

Currently the routing connector only has the ability to route based on resource information. In other words, all logs associated with a given resource will be routed together. (The same is true of metrics and spans as well, but this issue directly addresses logs as a first step.)

Describe the solution you'd like

Add a context field to routing table options, with possible values resource (default) or log. If log context is specified, execute the OTTL condition or statement as a log statement. Based on the result, route the individual log record appropriately.

Importantly, there is an implementation challenge here because appropriate routing at a per-log level requires retention of the higher level scope and resource information, without pulling in other logs as well.

I believe I finally have a workable solution, demonstrated in #35939. This solution is based on the addition of helper functions that can "split" a plog.Logs according to criteria at either the resource or log level. When splitting at the log level, scope and resource information are retained.

I'd like to implement this functionality for logs first, then later for other signals once the strategy proves out. The initial sequence of PRs will look like this:

  1. Add an internal package to the routing connector. This will contain the splitting functions and will be well tested in a generic way. (Later, these may be moved to pkg/pdatautil or eventually into pdata, but for now keep them unexported.)
  2. Update the current implementation to use the split-by-resource function. This should have no noticeable change to users.
  3. Add support for log routing, using the split-by-log function.

Describe alternatives you've considered

No response

Additional context

No response

@djaglowski djaglowski added enhancement New feature or request needs triage New item requiring triage labels Oct 23, 2024
Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@djaglowski
Copy link
Member Author

@mwear, @jpkrohling, I'm excited to move my PoC forward with the plan proposed above, if it sounds good to you.

Also cc'ing @evan-bradley @TylerHelmuth as I think some version of this might eventually be able to solve cases like #32080.

jpbarto pushed a commit to jpbarto/opentelemetry-collector-contrib that referenced this issue Oct 29, 2024
…g context (open-telemetry#35939)

This PR resolves
open-telemetry#35948
by adding a `context` field to routing table items. The default value of
`context` is `resource`, so that existing users will not see a
difference. `log` context may also be used. Each routing table item may
have a difference context. `match_once` must be `true` in order to use
`log` context.
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this issue Dec 17, 2024
…g context (open-telemetry#35939)

This PR resolves
open-telemetry#35948
by adding a `context` field to routing table items. The default value of
`context` is `resource`, so that existing users will not see a
difference. `log` context may also be used. Each routing table item may
have a difference context. `match_once` must be `true` in order to use
`log` context.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
connector/routing enhancement New feature or request needs triage New item requiring triage
Projects
None yet
1 participant