Skip to content

Commit b43feb9

Browse files
committed
receiver/httpcheck: stop double-emitting TLS cert-remaining data point
RecordHttpcheckTLSCertRemainingDataPoint was called twice per scrape for every HTTPS endpoint: once inside the mux.Lock block before the timing metrics, and again a few lines lower after the timing metrics. The two blocks were byte-for-byte equivalent, so the receiver emitted duplicate httpcheck.tls.cert_remaining data points on every cycle. Remove the redundant pre-timing block. The post-timing block keeps the endpoint/issuer/commonName/sans labels unchanged. Fixes #47740. Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com> Assisted-by: Claude Opus 4.7
1 parent c990203 commit b43feb9

2 files changed

Lines changed: 28 additions & 15 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: receiver/httpcheck
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Stop emitting duplicate `httpcheck.tls.cert_remaining` data points by removing the redundant pre-timing TLS block; the post-timing block (a few lines below) is the single source that retains endpoint/issuer/commonName/sans labels.
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [47740]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# Optional: The change log or logs in which this entry should be included.
21+
# e.g. '[user]' or '[user, api]'
22+
# Include 'user' if the change is relevant to end users.
23+
# Include 'api' if there is a change to a library API.
24+
change_logs: [user]

receiver/httpcheckreceiver/scraper.go

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -349,21 +349,10 @@ func (h *httpcheckScraper) scrape(ctx context.Context) (pmetric.Metrics, error)
349349

350350
mux.Lock()
351351

352-
// Check if TLS metric is enabled and this is an HTTPS endpoint
353-
if h.cfg.Metrics.HttpcheckTLSCertRemaining.Enabled && resp != nil && resp.TLS != nil {
354-
// Extract TLS info directly from the HTTP response
355-
issuer, commonName, sans, timeLeft := extractTLSInfo(resp.TLS)
356-
if issuer != "" || commonName != "" || len(sans) > 0 {
357-
h.mb.RecordHttpcheckTLSCertRemainingDataPoint(
358-
now,
359-
timeLeft,
360-
h.cfg.Targets[targetIndex].Endpoint,
361-
issuer,
362-
commonName,
363-
sans,
364-
)
365-
}
366-
}
352+
// TLS cert-remaining is recorded once per scrape a few lines
353+
// below (after the timing metrics). The duplicate block that
354+
// used to live here double-emitted the data point for every
355+
// HTTPS endpoint (#47740).
367356
// Record timing breakdown metrics
368357
dnsMs, tcpMs, tlsMs, requestMs, responseMs := timing.getDurations()
369358
endpoint := h.cfg.Targets[targetIndex].Endpoint

0 commit comments

Comments
 (0)