Skip to content

Conversation

saswatamcode
Copy link
Member

@saswatamcode saswatamcode commented Jan 17, 2025

Moving to exp.

Do we want to create new client in this remote write API addition as well? Or do future iteration on it? :)

I might add the decompression middleware stuff here as well

cc: @bwplotka

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
@bwplotka
Copy link
Member

I would straight away try to avoid old client shenigans and rethink this from scratch.

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Comment on lines +41 to +42
baseURL *url.URL
client *http.Client
Copy link
Member Author

Choose a reason for hiding this comment

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

Passing http.Client directly here instead of api.Client structs. Seems like the most flexible way, without doing custom configs.

// SnappyDecompressorMiddleware returns a middleware that checks if the request body is snappy-encoded and decompresses it.
// If the request body is not snappy-encoded, it returns an error.
// Used by default in NewRemoteWriteHandler.
func SnappyDecompressorMiddleware(logger *slog.Logger) func(http.Handler) http.Handler {
Copy link
Member Author

Choose a reason for hiding this comment

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

Tried to convert this into a middleware with the ability for downstream users to override and add their own middlewares if needed.

Let me know what you think, or if this is too much

Copy link
Member

Choose a reason for hiding this comment

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

No, this is great, thanks!

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
@bwplotka
Copy link
Member

Can we create a go mod file? It has to be a separate Go module if it will be experimental.

Copy link
Member

@kakkoyun kakkoyun left a comment

Choose a reason for hiding this comment

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

Looking good.

We need documentation:

  • We need a README. And we need to make the intention crystal clear.
  • Also, we have to be clear, we don't give any guarantees that the experimental APIs won't introduce breaking changes, or they will eventually be promoted to stable.
  • How do we release? This suppose to have different release cycles and maybe tags.

@kakkoyun
Copy link
Member

Looking good.

We need documentation:

  • We need a README. And we need to make the intention crystal clear.
  • Also, we have to be clear, we don't give any guarantees that the experimental APIs won't introduce breaking changes, or they will eventually be promoted to stable.
  • How do we release? This suppose to have different release cycles and maybe tags.

Additionally, we need experiment owners. So that we can ping them on the issues.

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
go.work Outdated
Copy link
Member Author

Choose a reason for hiding this comment

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

Added a workspace file as well

@saswatamcode
Copy link
Member Author

We need a README. And we need to make the intention crystal clear.

Yup, probably some example usage helps

Also, we have to be clear, we don't give any guarantees that the experimental APIs won't introduce breaking changes, or they will eventually be promoted to stable.

exp package go doc has a line on this, but yes probably something to mention in dedicated README. Might be good to do this in next PR to prwclient-em branch?

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
@saswatamcode saswatamcode marked this pull request as ready for review January 24, 2025 10:44
go 1.21

use (
.
Copy link
Member

Choose a reason for hiding this comment

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

Nice, thanks!

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, let's try this how it looks on the main PR 💪🏽
Thanks!

@bwplotka bwplotka merged commit 433de68 into prometheus:prwclient-em Jan 31, 2025
8 checks passed
bwplotka added a commit that referenced this pull request Feb 25, 2025
…t and handler. (#1658)

* api: Add remote API with write client; add remote handler.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Make Write message type more flexble, address some feedback (#1710)

* Address remaining feedback

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Make Write message type more flexible

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Move remote write API to client_golang/exp (#1711)

* Move remote write API to client_golang/exp

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Don't use api.Client structs, add options for middleware

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Fix reqBuf usage

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Fix url path

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Add separate mod file (and workspace file)

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Hook exp tests fmt; Test handler error case; Configure backoff

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* exp: Add README, address feedback, use sync.Pool (#1747)

* Implement suggestion for Store interface and contentType

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Add README

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Use sync.Pool

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Implement review suggestions

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Release bufs right after compressPayload

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Bump exp to go 1.22

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Saswata Mukherjee <saswataminsta@yahoo.com>
ying-jeanne pushed a commit to ying-jeanne/client_golang that referenced this pull request Mar 28, 2025
…t and handler. (prometheus#1658)

* api: Add remote API with write client; add remote handler.

Signed-off-by: bwplotka <bwplotka@gmail.com>

* Make Write message type more flexble, address some feedback (prometheus#1710)

* Address remaining feedback

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Make Write message type more flexible

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Move remote write API to client_golang/exp (prometheus#1711)

* Move remote write API to client_golang/exp

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Don't use api.Client structs, add options for middleware

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Fix reqBuf usage

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Fix url path

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Add separate mod file (and workspace file)

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Hook exp tests fmt; Test handler error case; Configure backoff

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* exp: Add README, address feedback, use sync.Pool (prometheus#1747)

* Implement suggestion for Store interface and contentType

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Add README

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Use sync.Pool

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Implement review suggestions

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Release bufs right after compressPayload

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

* Bump exp to go 1.22

Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>

---------

Signed-off-by: bwplotka <bwplotka@gmail.com>
Signed-off-by: Saswata Mukherjee <saswataminsta@yahoo.com>
Signed-off-by: Bartlomiej Plotka <bwplotka@gmail.com>
Co-authored-by: Saswata Mukherjee <saswataminsta@yahoo.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