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: report gateway http metrics only when response is successful #8827

Merged
merged 5 commits into from
Apr 8, 2022
Merged

fix: report gateway http metrics only when response is successful #8827

merged 5 commits into from
Apr 8, 2022

Conversation

iand
Copy link
Contributor

@iand iand commented Mar 28, 2022

Fixes #8820

@welcome

This comment was marked as resolved.

@lidel lidel added the topic/gateway Topic gateway label Apr 5, 2022
@lidel lidel self-requested a review April 5, 2022 23:34
Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

LGTM.

@iand I've pushed two commits, mind taking a look if they make sense before I merge this?

// Update metrics
i.rawBlockGetMetric.WithLabelValues(contentPath.Namespace()).Observe(time.Since(begin).Seconds())
// Was response successful?
if code/100 == 2 && err == nil {
Copy link
Member

@lidel lidel Apr 5, 2022

Choose a reason for hiding this comment

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

💭

This also ignores 304 Not Modified responses when calculating metrics – i think that was intentional, because those also lower response times, right?

Would it be useful to add a global metric counting 304s, just to know the % of "skipped" responses? (in separate PR)

@lidel lidel added this to the go-ipfs 0.13 milestone Apr 6, 2022
This fix ensures we don't do any additional work when Etag match what
user already has in their own cache.
@lidel lidel assigned iand and lidel Apr 6, 2022
@iand
Copy link
Contributor Author

iand commented Apr 8, 2022

@lidel you can merge this whenever. I reran CI to fix a flake.

@lidel lidel merged commit fbf7666 into ipfs:master Apr 8, 2022
xrazis pushed a commit to xrazis/kubo that referenced this pull request Apr 14, 2022
* fix: report gateway http metrics only when response is successful
* fix(gw): 304 Not Modified as no-op

This fix ensures we don't do any additional work when Etag match
what user already has in their own cache.

Co-authored-by: Marcin Rataj <lidel@lidel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic/gateway Topic gateway
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Gateway HTTP Metrics inconsistently measure failed response times
2 participants