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

Mismatch Between Routing Processor Limitations Docs and Prior Issue? #30560

Closed
bdschaap opened this issue Jan 15, 2024 · 10 comments
Closed

Mismatch Between Routing Processor Limitations Docs and Prior Issue? #30560

bdschaap opened this issue Jan 15, 2024 · 10 comments
Labels
pkg/ottl processor/routing Routing processor question Further information is requested

Comments

@bdschaap
Copy link

bdschaap commented Jan 15, 2024

Component(s)

routingprocessor

Describe the issue you're reporting

The routingprocessor documentation mentions that "OTTL statements can be applied to resource attributes". However, a previously filed issue may indicate that there may be support for routing based on log attributes. Though the fix may have been limited to resolving a crash and the functionality may not actually be supported.

Docs - https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/routingprocessor#limitations
Previous issue - #26462

@bdschaap bdschaap added the needs triage New item requiring triage label Jan 15, 2024
@crobert-1 crobert-1 added the processor/routing Routing processor label Jan 16, 2024
Copy link
Contributor

Pinging code owners for processor/routing: @jpkrohling. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@crobert-1 crobert-1 added documentation Improvements or additions to documentation question Further information is requested labels Jan 16, 2024
@crobert-1
Copy link
Member

Good catch @bdschaap, I agree the comment doesn't line up with functionality.

Currently the following contexts are used for routing each telemetry type:
ottlspan for traces - ottlspan context README
ottldatapoint for metrics - ottldatapoint context README
ottllog for logs - ottllog context README

As shown in each of the OTTL context READMEs, more things than just resource attributes are available for comparison and routing.

From git blame it looks like these contexts and the README comment have all been in place for multiple years, so I assume if this functionality was wrong it would have created issues by now. Also, if we ended up changing code to match the README it would be a very impacting and breaking change. For these reasons I believe the README should be updated to be more clear, but I'll have to defer to code owners to know if we're missing something here.

Copy link
Contributor

Pinging code owners for pkg/ottl: @TylerHelmuth @kentquirk @bogdandrutu @evan-bradley. See Adding Labels via Comments if you do not have permissions to add labels yourself.

@bdschaap
Copy link
Author

@crobert-1 Thank you. Though I've tried routing based on severity text of the log but have been unsuccessful. Though perhaps I was doing it wrong if the functionality does exist. It would be great to get confirmation as well as an example added to the docs if the functionality exists .

As a workaround, I've been using 1) the groupbyattrs processor to group logs by the log attribute, 2) the transform processor to create a new resource attribute from the log attribute, and 3) routing processor to route based on the resource attribute. It's a roundabout approach that complicates the configuration but it does work.

@crobert-1
Copy link
Member

Happy to help debug routing failures, it's a pretty common challenge for users. However, it'd be better to open a new issue so that this one is kept for it's original purpose. Feel free to open another issue if you want further help getting it to work!

@bdschaap
Copy link
Author

Gotcha. Just providing additional context that my experience seemed to align with the documentation and not the previous issue where the crash was fixed.

@TylerHelmuth
Copy link
Member

The processor's readme is correct: the routingprocessor (and routingconnector) only make decisions based on resource telemetry. The processor was created before the ottlresource context was added and since it is deprecated it hasn't been updaed. You can see here how it only takes the resource into account:

ltx := ottllog.NewTransformContext(
plog.NewLogRecord(),
pcommon.NewInstrumentationScope(),
rlogs.Resource(),
)

@crobert-1
Copy link
Member

Thanks for the reference @TylerHelmuth. I was looking at metrics and should have seen that the transform context was being passed the nil datapoint and pmetric.NewMetric() rather than actual metrics coming in. 🤦

So the behavior here is that since these are valid OTTL statements they won't raise an error in initialization, but they'll just always fail to match incoming data since there are no attributes to compare against. Is that correct?

@crobert-1 crobert-1 removed documentation Improvements or additions to documentation needs triage New item requiring triage labels Jan 18, 2024
@TylerHelmuth
Copy link
Member

Yes that is correct (and confusing). The routing connect does it correctly: it only uses ottlresource and therefore would allow a statement that uses a field from a log like serverity_text.

@crobert-1
Copy link
Member

Closing as the README is correct here.

@crobert-1 crobert-1 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg/ottl processor/routing Routing processor question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants