Skip to content
This repository was archived by the owner on Jan 12, 2023. It is now read-only.

Extract ipAddress from context #26

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

MichelHollands
Copy link

@MichelHollands MichelHollands commented Aug 3, 2020

What this PR does:

Extract the IP address from the X-Forwarder-For value in the context. Add it to the duplicate samples error message. The error message now looks like this:

level=error ts=2020-08-06T10:15:13.204489Z caller=push.go:47 org_id=fake traceID=d4cf2362923ab2d msg="push error" err="rpc error: code = Code(400) desc = user=fake: sample with repeated timestamp but different value; last value: 0.015037291, incoming value: 0.015055151 from IP address 1.2.3.4, ::1, ::1 for series {__name__=\"scrape_duration_seconds\", instance=\"localhost:9090\", job=\"prometheus\"}"

The fact that the IP addresses look like '1.2.3.4, ::1, ::1' is a result of the proxy I'm using. Prometheus remote writes to a reverse proxy which forwards the remote write to Cortex. Prometheus, the reverse proxy and Cortex are running locally on a Mac hence the ::1 IP v6 address. The reverse proxy adds the X-Forwarded-For header of 1.2.3.4. This reverse proxy uses the Go httputil.ReverseProxy type which automatically adds the IP address of it's client (Prometheus) as well. So X-Forwarded-For = "1.2.3.4, ::1" coming into Cortex. The last ::1 is then the remote address of the proxy.

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

@MichelHollands MichelHollands marked this pull request as ready for review August 6, 2020 10:22
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
@MichelHollands MichelHollands force-pushed the add_client_ip_address_to_duplicate_message branch from 3c96cb7 to 902f74e Compare August 6, 2020 12:11
Signed-off-by: Michel Hollands <[email protected]>
@MichelHollands MichelHollands force-pushed the add_client_ip_address_to_duplicate_message branch from e442223 to e1b3b82 Compare August 6, 2020 15:04
Signed-off-by: Michel Hollands <[email protected]>
@MichelHollands MichelHollands force-pushed the add_client_ip_address_to_duplicate_message branch from 37cb26b to ec93caf Compare August 6, 2020 15:40
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
@MichelHollands MichelHollands force-pushed the add_client_ip_address_to_duplicate_message branch from 3d2cea3 to 6e99d01 Compare August 24, 2020 07:28
@CLAassistant
Copy link

CLAassistant commented Jun 15, 2022

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ pracucci
❌ MichelHollands
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants