Skip to content

logs: label 'target' cannot be used at it is already defined by default. Renaming it in 'name'#1519

Open
wat-org wants to merge 1 commit intoprometheus:masterfrom
wat-org:fix/log-dns-label
Open

logs: label 'target' cannot be used at it is already defined by default. Renaming it in 'name'#1519
wat-org wants to merge 1 commit intoprometheus:masterfrom
wat-org:fix/log-dns-label

Conversation

@wat-org
Copy link
Copy Markdown
Contributor

@wat-org wat-org commented Jan 8, 2026

What this PR does / Which issue(s) does the PR fix:

The prober logger contains by default a label 'module' and a label 'target', which contains contextual information related to the current module/target.
Some logs related to dns explicitly specifies a label 'target', and consequently overrides the content of the default label 'target' and make log correlation difficult.
The aim of this PR if to fix this: using another label name, the label 'target' will have a consistant value and simplify log correlation.

example

before the fix:

time=2026-01-08T10:19:33.736Z level=INFO source=handler.go:123 msg="Beginning probe" module=http-xxx target=https://www.example.com/api/health probe=http timeout_seconds=5
time=2026-01-08T10:19:33.737Z level=INFO source=utils.go:61 msg="Resolving target address" module=http-xxx target=www.example.com ip_protocol=ip4
time=2026-01-08T10:19:33.739Z level=INFO source=utils.go:74 msg="Resolved target address" module=http-xxx target=www.example.com ip=104.18.26.120
time=2026-01-08T10:19:33.740Z level=INFO source=http.go:207 msg="Making HTTP request" module=http-xxx target=https://www.example.com/api/health url=https://104.18.26.120/api/health host=www.example.com
time=2026-01-08T10:19:33.749Z level=INFO source=http.go:542 msg="Received HTTP response" module=http-xxx target=https://www.example.com/api/health status_code=200
time=2026-01-08T10:19:33.749Z level=INFO source=http.go:673 msg="Response timings for roundtrip" module=http-xxx target=https://www.example.com/api/health roundtrip=0 start=2026-01-08T10:19:33.740Z dnsDone=2026-01-08T10:19:33.740Z connectDone=2026-01-08T10:19:33.741Z gotConn=2026-01-08T10:19:33.745Z responseStart=2026-01-08T10:19:33.749Z tlsStart=2026-01-08T10:19:33.741Z tlsDone=2026-01-08T10:19:33.745Z end=2026-01-08T10:19:33.749Z
time=2026-01-08T10:19:33.749Z level=INFO source=handler.go:134 msg="Probe succeeded" module=http-xxx target=https://www.example.com/api/health duration_seconds=0.012727658

->
the logs generated by the prober have target=https://www.example.com/api/health
the logs produced by utils.go have target=www.example.com
->
label target is not consistant.
it is hard to correlate logs.

after the fix:

time=2026-01-08T10:19:33.736Z level=INFO source=handler.go:123 msg="Beginning probe" module=http-xxx target=https://www.example.com/api/health probe=http timeout_seconds=5
time=2026-01-08T10:19:33.737Z level=INFO source=utils.go:61 msg="Resolving target address" module=http-xxx target=https://www.example.com/api/health name=www.example.com ip_protocol=ip4
time=2026-01-08T10:19:33.739Z level=INFO source=utils.go:74 msg="Resolved target address" module=http-xxx target=https://www.example.com/api/health name=www.example.com ip=104.18.26.120
time=2026-01-08T10:19:33.740Z level=INFO source=http.go:207 msg="Making HTTP request" module=http-xxx target=https://www.example.com/api/health url=https://104.18.26.120/api/health host=www.example.com
time=2026-01-08T10:19:33.749Z level=INFO source=http.go:542 msg="Received HTTP response" module=http-xxx target=https://www.example.com/api/health status_code=200
time=2026-01-08T10:19:33.749Z level=INFO source=http.go:673 msg="Response timings for roundtrip" module=http-xxx target=https://www.example.com/api/health roundtrip=0 start=2026-01-08T10:19:33.740Z dnsDone=2026-01-08T10:19:33.740Z connectDone=2026-01-08T10:19:33.741Z gotConn=2026-01-08T10:19:33.745Z responseStart=2026-01-08T10:19:33.749Z tlsStart=2026-01-08T10:19:33.741Z tlsDone=2026-01-08T10:19:33.745Z end=2026-01-08T10:19:33.749Z
time=2026-01-08T10:19:33.749Z level=INFO source=handler.go:134 msg="Probe succeeded" module=http-xxx target=https://www.example.com/api/health duration_seconds=0.012727658

->
the logs generated by the prober have target=https://www.example.com/api/health
the logs produced by utils.go have target=https://www.example.com/api/health (and name=www.example.com)
->
label target is consistant.
it is simple to correlate logs.

Does this PR introduce a user-facing change?

not at all

Checklist

  • Tests updated (N/A)
  • Documentation added (N/A)
  • CHANGELOG added in release-notes section of PR Desc. (N/A)

…t. renaming it in 'name'

Signed-off-by: guillaume.cornet <cornet.guillaume.pierre@gmail.com>
@wat-org
Copy link
Copy Markdown
Contributor Author

wat-org commented Jan 23, 2026

hello @electron0zero
I've seen you have merged a PR few days ago.
Could you have a look at this one ?
Regards

@wat-org
Copy link
Copy Markdown
Contributor Author

wat-org commented Feb 26, 2026

hello @SuperQ
I've seen you have merged a PR few days ago.
Could you have a look at this one ?
Regards

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.

1 participant