8000 Migrate OTLP endpoint to PRW 2.0 for ingestion by dashpole · Pull Request #16784 · prometheus/prometheus · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Migrate OTLP endpoint to PRW 2.0 for ingestion #16784

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

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

Conversation

dashpole
Copy link
Contributor
@dashpole dashpole commented Jun 26, 2025

Part of #16610. See #16610 (comment) for alternatives.

The current OTLP endpoint translates OTLP to PRW 1.0, and then appends the metrics to the TSDB using the PRW 1.0 ingestion path. This PR migrates this translation logic to instead translate to PRW 2.0 and use the PRW 2.0 ingestion path.

Currently, the PRW 1.0 endpoint just ignores metadata, so we are dropping type, help, and unit information. Migrating to 2.0 will fix that. It will also allow the OTLP endpoint to use the type and unit feature implementation without re-implementing it in the translation layer.

This PR can be largely summarized as:

  • Rename prompb types to writev2 types. Those are split into their own commits.
  • Migrate from prompb.Label with labels.Label, and adding support for symbolization.
  • Metadata is attached to each TimeSeries, instead of being stored separately. Metadata is added to all unit tests.
  • Migrate the OTLP write handler to use writeV2 instead of write
  • Small fixes

The existing e2e tests in write_test.go didn't need any changes, which helps to show that this doesn't change any behavior.

dashpole added 23 commits June 26, 2025 14:16
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
dashpole added 2 commits June 26, 2025 17:39
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
@dashpole dashpole marked this pull request as ready for review June 26, 2025 17:54
@dashpole dashpole requested a review from aknuds1 as a code owner June 26, 2025 17:54
@dashpole
Copy link
Contributor Author

Copy link
Member
@bwplotka bwplotka left a comment

Choose a reason for hiding this comment

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

Epic work, thanks!

Looks good in general, some minor suggestions only 👍🏽

}

return labels
return c.builder.Labels()
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why we return built labels and not builder? Looks like we expect to still add at least name after this. By returning builder we make it a bit more efficient in theory. (could be done in separate PR)

Copy link
Member

Choose a reason for hiding this comment

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

Ah, so it made sense in the past as we were creating proto labels later. But now we operate on labels.Labels, so maybe it's viable to pass builders/scratchbuilders?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have to take a single set of base attributes, and add one or two labels (e.g. for name with _sum, or _bucket suffix) to multiple different label sets. What i've done is use a ScratchBuilder to build the base attributes, and then use a Builder to append the special ones. There isn't a copy method I can see for ScratchBuilder, otherwise I could use that to build multiple variations of the same set of labels. Let me know if there is a better pattern.

dashpole and others added 6 commits June 27, 2025 10:39
Co-authored-by: Bartlomiej Plotka <bwplotka@gmail.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
Signed-off-by: David Ashpole <dashpole@google.com>
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.

3 participants
0