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

fix(kuma-dp): set prometheus content-type when returning metrics #4706

Merged
merged 2 commits into from
Aug 1, 2022

Conversation

lukidzi
Copy link
Contributor

@lukidzi lukidzi commented Aug 1, 2022

Summary

kuma-dp scrapes metrics from the applications, aggregates them, and returns. Unfortunately we were not setting correct content-type and some applications could file while scraping. Added setting of content type based on https://github.com/prometheus/docs/blob/main/content/docs/instrumenting/exposition_formats.md#basic-info. Also, added passing of prometheus requests header to the application. based on the code (https://github.com/prometheus/prometheus/blob/main/scrape/scrape.go#L772)

Checklist prior to review

- [ ] Link to docs PR or issue --
- [ ] Link to UI issue or PR --

@lukidzi lukidzi requested a review from a team as a code owner August 1, 2022 08:07
@codecov-commenter
Copy link

codecov-commenter commented Aug 1, 2022

Codecov Report

Merging #4706 (9fc314f) into master (d841111) will increase coverage by 0.03%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #4706      +/-   ##
==========================================
+ Coverage   46.42%   46.45%   +0.03%     
==========================================
  Files         687      687              
  Lines       46692    46699       +7     
==========================================
+ Hits        21677    21695      +18     
+ Misses      23094    23087       -7     
+ Partials     1921     1917       -4     
Impacted Files Coverage Δ
app/kuma-dp/pkg/dataplane/metrics/server.go 11.32% <0.00%> (-0.81%) ⬇️
pkg/core/resources/manager/cache.go 88.31% <0.00%> (+2.59%) ⬆️
pkg/api-server/server.go 77.59% <0.00%> (+2.90%) ⬆️
pkg/xds/cache/once/once.go 100.00% <0.00%> (+5.00%) ⬆️
pkg/plugins/leader/postgres/leader_elector.go 89.36% <0.00%> (+6.38%) ⬆️
pkg/xds/cache/once/cache.go 94.87% <0.00%> (+12.82%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d841111...9fc314f. Read the comment docs.

@lukidzi lukidzi merged commit 93891f2 into kumahq:master Aug 1, 2022
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.

Kuma "metrics hijacking"/exposing application metrics not setting Accept header.
4 participants