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] Add ability to route logs by request context #36067

Merged

Conversation

djaglowski
Copy link
Member

@djaglowski djaglowski commented Oct 29, 2024

This PR adds the ability to route logs based on request context. Specifically, values from an incoming context as defined in google.golang.org/grpc/metadata and client metadata values as defined in go.opentelemetry.io/collector/client.

Request based routing is implemented as a feature of an individual route. This allows mixing of contexts within a table, so that e.g. you can route low severity logs to one route, route some logs based on resource, and then route the remainder based on request metadata. Notably, when request metadata is matched, this indicates a match for the entire plog.Logs, so all remaining data in that structure (i.e. data that hasn't already matched a previous route) will be routed immediately.

@github-actions github-actions bot requested review from jpkrohling and mwear October 29, 2024 13:46
@djaglowski djaglowski force-pushed the routing-connector-by-request branch 4 times, most recently from 7d4b084 to 9a8856a Compare October 30, 2024 15:03
@djaglowski djaglowski force-pushed the routing-connector-by-request branch from 9a8856a to 624ea27 Compare October 30, 2024 15:15
@djaglowski djaglowski marked this pull request as ready for review October 30, 2024 15:44
@djaglowski djaglowski requested a review from a team as a code owner October 30, 2024 15:44
@djaglowski djaglowski merged commit 7500155 into open-telemetry:main Oct 30, 2024
160 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 30, 2024
@djaglowski djaglowski deleted the routing-connector-by-request branch November 4, 2024 14:55
ArthurSens pushed a commit to ArthurSens/opentelemetry-collector-contrib that referenced this pull request Nov 4, 2024
…n-telemetry#36067)

This PR adds the ability to route logs based on request context.
Specifically, [values from an incoming
context](https://github.com/grpc/grpc-go/blob/v1.67.1/metadata/metadata.go#L216)
as defined in `google.golang.org/grpc/metadata` and [client
metadata](https://pkg.go.dev/go.opentelemetry.io/collector/client#Metadata)
values as defined in `go.opentelemetry.io/collector/client`.

Request based routing is implemented as a feature of an individual
route. This allows mixing of contexts within a table, so that e.g. you
can route low severity logs to one route, route some logs based on
resource, and then route the remainder based on request metadata.
Notably, when request metadata is matched, this indicates a match for
the entire `plog.Logs`, so all remaining data in that structure (i.e.
data that hasn't already matched a previous route) will be routed
immediately.
sbylica-splunk pushed a commit to sbylica-splunk/opentelemetry-collector-contrib that referenced this pull request Dec 17, 2024
…n-telemetry#36067)

This PR adds the ability to route logs based on request context.
Specifically, [values from an incoming
context](https://github.com/grpc/grpc-go/blob/v1.67.1/metadata/metadata.go#L216)
as defined in `google.golang.org/grpc/metadata` and [client
metadata](https://pkg.go.dev/go.opentelemetry.io/collector/client#Metadata)
values as defined in `go.opentelemetry.io/collector/client`.

Request based routing is implemented as a feature of an individual
route. This allows mixing of contexts within a table, so that e.g. you
can route low severity logs to one route, route some logs based on
resource, and then route the remainder based on request metadata.
Notably, when request metadata is matched, this indicates a match for
the entire `plog.Logs`, so all remaining data in that structure (i.e.
data that hasn't already matched a previous route) will be routed
immediately.
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