-
Notifications
You must be signed in to change notification settings - Fork 3k
Description
Component(s)
pkg/ottl
Is your feature request related to a problem? Please describe.
There are cases where it is useful to operate on request metadata, e.g. to use metadata (headers) for routing, as proposed in #38888 and as already supported in routingprocessor.
This would also solve the need in #37616.
Describe the solution you'd like
I would like to add a standard "request" context to OTTL. This would be a level above "resource", and would provide the following paths based on https://github.com/open-telemetry/opentelemetry-collector/blob/main/client/client.go:
request.addr
: the client addressrequest.auth.attributes
: the full map of client auth datarequest.auth.attributes[""]
: a specific key in the client auth data, supporting multiple keys for nested datarequest.metadata
: the full map of client metadatarequest.metadata[""]
: a specific key in the client metadata; if 2 keys are provided, the second one will index into the slice of values
Describe alternatives you've considered
Instead of creating a generic "request" context, we could create receiver-specific contexts, e.g. http
, or kafka
. This may provide a cleaner solution to #35231 (comment)
I'm not sure how practical this is at the moment. My understanding is that each subsequently more narrowly-scoped context (e.g. resource -> scope -> log) knows about and implements access to the more general scope. I don't think we would want a kafka context inside pkg/ottl, so we would probably want instead to somehow inject that through context.Context
.
Additional context
No response