prometheus / prometheus/common

Consolidate content type and content encoding functions in prometheus/common

Open
#652 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
295
Forks
367
Avg merge
2d 10h
Merged PRs (30d)
18

Description

I recently added zstd support to client_golang in https://github.com/prometheus/client_golang/pull/1496 which uses an internalized version of the archived repository: https://github.com/golang/gddo/blob/master/httputil/negotiate.go

I see that https://github.com/prometheus/common/blob/2d5ba4a4a8854b224d06df286a191f710fc65785/expfmt/encode.go#L67 was recently changed to use https://github.com/munnerz/goautoneg for contentType logic in https://github.com/prometheus/common/pull/625

Would you be open to include the logic for content encoding implemented in client_go in here and replace goautoneg with ggdo/httputil (we could either consume from the archived repository or internalize it into this repository; we took the second approach for client_golang)?

This likely would help with consolidating the library for content encoding as well as content type and allow reusing parts of it in prometheus/prometheus as well (e.g. in https://github.com/prometheus/prometheus/issues/13866)

CC: @bwplotka

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with expfmt/encode.go at the referenced contentType logic, then compare it with the content-encoding implementation in client_golang and the archived gddo/httputil/negotiate.go. Determine whether the shared logic should consume the archived repository or be internalized, and verify that content type and content encoding behavior remain compatible for the affected Prometheus components.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend-api-design, networking
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.