Skip to content

fix(parsers.prometheus): Skip incomplete summaries and histograms instead of panicking - #20206

Merged
skartikey merged 1 commit into
influxdata:masterfrom
sohailshk:fix/prometheus-parser-nil-summary
Nov 23, 2026
Merged

skartikey merged 1 commit into
influxdata:masterfrom
sohailshk:fix/prometheus-parser-nil-summary

Conversation

@sohailshk

@sohailshk sohailshk commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A sample with an unparsable value inside a summary or histogram family reaches extractMetricsV1 and extractMetricsV2 as a metric without a summary or histogram, and the nil pointer dereference panics; inputs.prometheus parses in a goroutine without recovery, so one bad scrape target stops the process. The parser now skips such a metric, so the decoder error is returned. TestParseText has a summary and a histogram case that panic on master and pass with the change.

Checklist

Related issues

resolves #20205

…tead of panicking

A text sample with an unparsable value inside a summary or histogram family leaves the metric without its summary or histogram payload. The metric versions 1 and 2 then dereference a nil pointer and take down the agent instead of returning the decoding error.
@sohailshk
sohailshk requested a review from a team November 21, 2026 19:13
@telegraf-tiger

Copy link
Copy Markdown
Contributor

Thanks so much for the pull request!
🤝 ✒️ Just a reminder that the CLA has not yet been signed, and we'll need it before merging. Please sign the CLA when you get a chance, then post a comment here saying !signed-cla

@telegraf-tiger telegraf-tiger Bot added area/prometheus fix pr to fix corresponding bug plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins labels Nov 21, 2026
@telegraf-tiger

Copy link
Copy Markdown
Contributor

@srebhan

srebhan commented Nov 23, 2026

Copy link
Copy Markdown
Member

@sohailshk please sign the CLA as we cannot review or merge your PR otherwise!

@srebhan srebhan self-assigned this Nov 23, 2026
@srebhan srebhan added the waiting for response waiting for response from contributor label Nov 23, 2026
@sohailshk

Copy link
Copy Markdown
Contributor Author

!signed-cla

@telegraf-tiger telegraf-tiger Bot removed the waiting for response waiting for response from contributor label Nov 23, 2026

@srebhan srebhan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a lot @sohailshk!

@srebhan srebhan added the ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. label Nov 23, 2026
@srebhan srebhan assigned skartikey and unassigned srebhan Nov 23, 2026

@skartikey skartikey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@sohailshk Thanks for the contribution!

@skartikey
skartikey merged commit 3e7a597 into influxdata:master Nov 23, 2026
29 checks passed
@github-actions github-actions Bot added this to the v1.40.4 milestone Nov 23, 2026
srebhan pushed a commit that referenced this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/prometheus fix pr to fix corresponding bug plugin/parser 1. Request for new parser plugins 2. Issues/PRs that are related to parser plugins ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prometheus parser panics on a summary or histogram sample with an invalid value

3 participants