Skip to content

write_handler: Use client_golang/exp/api/remote for handling remote writes #16086

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 5 commits into
base: main
Choose a base branch
from

Conversation

saswatamcode
Copy link
Member

This PR uses the new client_golang experimental remote API package, introduced in prometheus/client_golang#1658 to handle remote writes (v1 and v2).

Also, removes a couple of test cases around missing headers/no content-type as those are now handled by the exp write handler (assumes V1 and snappy as defaults).

cc: @bwplotka

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.

Thanks. We removed more than add, so our helper helped (:

LGTM 💪🏽

@@ -376,7 +377,7 @@ func main() {
a.Flag("web.enable-remote-write-receiver", "Enable API endpoint accepting remote write requests.").
Default("false").BoolVar(&cfg.web.EnableRemoteWriteReceiver)

supportedRemoteWriteProtoMsgs := config.RemoteWriteProtoMsgs{config.RemoteWriteProtoMsgV1, config.RemoteWriteProtoMsgV2}
supportedRemoteWriteProtoMsgs := remoteapi.MessageTypes{remoteapi.WriteV1MessageType, remoteapi.WriteV2MessageType}
Copy link
Member

Choose a reason for hiding this comment

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

We could replace config entries as well with remoteapi perhaps? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok so I did most of the constants, but some still remain. I'll modify that in next PR for replacing client/sending code.

@@ -52,6 +52,7 @@ require (
github.com/ovh/go-ovh v1.6.0
github.com/prometheus/alertmanager v0.28.0
github.com/prometheus/client_golang v1.21.0-rc.0
github.com/prometheus/client_golang/exp v0.0.0-20250227122456-ad23ad6d5468
Copy link
Member

Choose a reason for hiding this comment

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

Wanna go ahead and make v0.1.0 release on client_golang? Likely the tag has to be in form of exp v0.1.0 (https://stackoverflow.com/a/77864755) if you want.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup totally. I think https://github.com/hashicorp/vault/tags does a similar thing

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's hold off tagging, until I have PR for replacing some of the client code, that way, we can release v0.1.0 with exp we know works.

Signed-off-by: Saswata Mukherjee <[email protected]>
@bboreham
Copy link
Member

bboreham commented Mar 2, 2025

Why would we rely on something "experimental" to implement something declared stable?

@bwplotka
Copy link
Member

bwplotka commented Mar 4, 2025

@bboreham do you mean remote write protocol 1.0 stability? That's fair, the ecosystem relies on it. However the stability is for API, not for quality of the code.

For this work we want to ensure the wider ecosystem can use the same stable behaviours for both remote write 1.0, 2.0 and beyond. In order to do so we extracted relevant pieces to an external API which is now experimental as we may shape the API a bit (and since we are in the same team, making sure it's working for Prometheus well). This means only more stability for projects like Mimir, Thanos, Cortex and senders like Alloy, Tempo, avalanche, etc

To sum up, we don't change any protocol behaviours here AFAIK (we carefully checked that). If you are worried about the risk, we don't risk anything more than when we were (and will be) adjusting both the handler and writer for 2.0 and future work here.

WDYT?

@github-actions github-actions bot added the stale label May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants