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

[pdatautil] Add function for splitting log records while preserving scope and resource context #35623

Closed
wants to merge 3 commits into from

Conversation

djaglowski
Copy link
Member

@djaglowski djaglowski commented Oct 4, 2024

This type of function will be useful in the routing connector, where users often need to route telemetry based on contexts below the resource level. e.g. log records.

The trick here is to make copies of the resource and scope information only when needed.

A couple assumptions made in this implementation:

  1. Empty scopes and resources are ignored, unless they became empty as a result of splitting log records. e.g. If all the log records from one scope are moved away, then that scope is deleted.
  2. Rather than purely splitting an input into two outputs, it is more efficient to use the original input and create one new output. Much like actual pdata methods, a return parameter is used so that callers can provide their own preexisting target.
  3. Moved resources and scopes are not merged into preexisting ones. (This isn't meant to be a batching function.)

@djaglowski djaglowski marked this pull request as draft October 8, 2024 19:44
@djaglowski
Copy link
Member Author

I've converted this back to a draft for now, to consider how this could integrate with OTTL conditions, some of which would require construction of a full log context. We may need to pass resource and scope info into the split function as well.

@djaglowski djaglowski marked this pull request as ready for review October 9, 2024 15:30
@djaglowski djaglowski marked this pull request as draft October 14, 2024 17:37
@djaglowski
Copy link
Member Author

Closing this in favor of a PR where similar functions are added to an internal package of the routing connector.

@djaglowski djaglowski closed this Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants