-
Notifications
You must be signed in to change notification settings - Fork 43
[extension/clientaddrmiddleware] Add initial clientaddrmiddleware extension
#930
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
[extension/clientaddrmiddleware] Add initial clientaddrmiddleware extension
#930
Conversation
| // ClientAddressMetadataKeys list of metadata keys to determine the client address. | ||
| // Keys are processed in order, the first valid value is used to set the client address. | ||
| // If there are no valid addresses found, the client address is not updated. | ||
| ClientAddressMetadataKeys []string `mapstructure:"client_address_metadata_keys,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: MetadataKeys should suffice IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call updated to metadata_keys
| Receivers should be configured with `include_metadata: true`, so that the context includes client metadata keys. | ||
|
|
||
| ### Example | ||
| The following example configures the middleware to set the client address based on the the `x-forwareded-for` metadata key (header). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The following example configures the middleware to set the client address based on the the `x-forwareded-for` metadata key (header). | |
| The following example configures the middleware to set the client address based on the the `x-forwarded-for` metadata key (header). |
axw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Overview
This PR adds the initial
clientaddrmiddlewareextension implementation which just includes the configuration, factory and middleware interface implementation.ClientAddressMetadataKeyshttp and grpc configuration to provide flexible client address determination open-telemetry/opentelemetry-collector#14224Currently both
confighttpandconfiggrpcset the client address based only one value RemoteAddress or peer address respectively. This middleware provides the flexibility to determine the client address (client.Info.Addr) from metadata keys.Enables custom processors such as the
elasticapmprocessorto enrich events with client IP address. See PR: #924.