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

distributor: report OTLP parse errors back to client #10588

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

narqo
Copy link
Contributor

@narqo narqo commented Feb 5, 2025

What this PR does

This PR comes with mostly structural changes. The idea here is that, currently, OTLPHandler silently drops series, it couldn't parse. This makes it complicated for the users, who see the increase in the dropped OTLP series due to a parse error, but who don't have access to the internal logs (e.g. when Mimir is deployed in Grafana Cloud).

Here, the handler holds the errors received during the OTLP conversion, and, if there wasn't any explicit issues from the downstream push services, it returns the status 400 (it's up for a debate if this new behaviour is more correct; refer to the internal discussion https://github.com/grafana/mimir-squad/issues/2716).

Checklist

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

@narqo narqo marked this pull request as ready for review February 5, 2025 13:30
@narqo narqo requested a review from a team as a code owner February 5, 2025 13:30
@narqo narqo requested a review from aknuds1 February 5, 2025 13:31
@narqo
Copy link
Contributor Author

narqo commented Feb 5, 2025

@aknuds1 I think you may be the best one for the review here (it is not urgent, though)

@aknuds1
Copy link
Contributor

aknuds1 commented Feb 5, 2025

Taking a look!

Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

Please see comments. Mainly, I think you should avoid the inlining since I think it's a step in the wrong direction (towards less readable code). Also if I'm not mistaken, the inlining is just a (significant) stylistic change so it shouldn't be done in this PR, which is meant to fix a bug.

pkg/distributor/otel.go Outdated Show resolved Hide resolved
level.Debug(spanLogger).Log(
"msg", "OTLP to Prometheus conversion complete",
"metric_count", metricCount,
"metric_dropped", metricDropped,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"metric_dropped", metricDropped,
"metrics_dropped", metricsDropped,

pkg/distributor/otel.go Show resolved Hide resolved
pkg/distributor/otel.go Outdated Show resolved Hide resolved
@narqo narqo requested a review from aknuds1 February 6, 2025 13:09
Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

LGTM modulo nits. Thanks!

@@ -203,6 +291,7 @@ func OTLPHandler(
level.Debug(spanLogger).Log(
"msg", "OTLP to Prometheus conversion complete",
"metric_count", metricCount,
"metric_dropped", metricsDropped,
Copy link
Contributor

Choose a reason for hiding this comment

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

Plural metrics are dropped:

Suggested change
"metric_dropped", metricsDropped,
"metrics_dropped", metricsDropped,

Comment on lines +476 to +478

mimirTS := c.converter.TimeSeries()
return mimirTS
Copy link
Contributor

Choose a reason for hiding this comment

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

[Nit] Easier to read:

Suggested change
mimirTS := c.converter.TimeSeries()
return mimirTS
return c.converter.TimeSeries()

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.

2 participants