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

feat(gw): add ipfs_http_gw_request_types metric #311

Merged
merged 1 commit into from
May 22, 2023
Merged

Conversation

lidel
Copy link
Member

@lidel lidel commented May 22, 2023

This PR adds an explicit request type metric, a counter of how many requests of a specific format hit the gateway.
When no explicit format is requested, the type is empty string "".

This is useful on its own, allowing gateway operators to reason what request types are the most popular, but also helps with debugging described in #288.

@lidel lidel requested a review from hacdias as a code owner May 22, 2023 10:55
@codecov
Copy link

codecov bot commented May 22, 2023

Codecov Report

Merging #311 (498d5a6) into main (4fb455d) will decrease coverage by 9.26%.
The diff coverage is 87.50%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #311      +/-   ##
==========================================
- Coverage   57.42%   48.16%   -9.26%     
==========================================
  Files         232      279      +47     
  Lines       27739    33511    +5772     
==========================================
+ Hits        15928    16140     +212     
- Misses      10109    15684    +5575     
+ Partials     1702     1687      -15     
Impacted Files Coverage Δ
gateway/metrics.go 60.69% <86.95%> (+2.93%) ⬆️
gateway/handler.go 57.56% <100.00%> (+0.07%) ⬆️

... and 61 files with indirect coverage changes

@lidel lidel merged commit fee5f6b into main May 22, 2023
@lidel lidel deleted the feat/more-metrics branch May 22, 2023 11:29
@Jorropo
Copy link
Contributor

Jorropo commented May 22, 2023

This is a non trivial change, I am surprised this was merged without review or comment explaining why merging as-is.

@lidel
Copy link
Member Author

lidel commented May 22, 2023

This is a trivial change -- it only adds new counter metric.

Copy link
Contributor

@Jorropo Jorropo left a comment

Choose a reason for hiding this comment

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

LGTM

@Jorropo
Copy link
Contributor

Jorropo commented May 22, 2023

It's code that do stuff. I don't think that trivial. You could had made a wrong copy paste and did i.getMetric.WithLabelValues(contentPath.Namespace(), responseFormat).Inc() instead (I know my example wouldn't work because getMetric is a histogram, it's more to show who knows what could happen in 20 lines of code ?).

Having someone quickly read with a different state of mind can catch simple mistakes that happen when you code quickly.
Anyway this looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants