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

Fill HTTP_CLIENT_IP in ServerInstrumenter #3756

Merged
merged 1 commit into from
Aug 5, 2021

Conversation

anuraaga
Copy link
Contributor

@anuraaga anuraaga commented Aug 3, 2021

Looks like this doesn't need to be exposed on the normal HttpAttributesExtractor


@Nullable
// Visible for testing
String getForwardedClientIp(REQUEST request) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just copied from HttpServerTracer

Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the auto-capture

AttributesBuilder attributes, REQUEST request, @Nullable RESPONSE response) {
String clientIp = getForwardedClientIp(request);
if (clientIp == null && netAttributesExtractor != null) {
clientIp = netAttributesExtractor.peerIp(request, response);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's not clear to me that http.client_ip should be populated in this case since easy for exporter/backend to fallback to net.peer.ip

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do it right now, though I agree it's not clear. Figured we'd stick to what we have for now though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, I'll open a spec issue to seek clarification and we can revisit later

@anuraaga anuraaga merged commit 8cbec71 into open-telemetry:main Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants