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

[Access] Update REST metrics to use route name for all types #4571

Merged
merged 5 commits into from
Jul 20, 2023

Conversation

peterargue
Copy link
Contributor

The REST metrics handler passes the original route into the collector, causing high cardinality and performance issues on the prometheus servers. We attempted to fix this with #4452, but only updated 1 of 4 metrics that were reporting the URL.

This PR updates all metrics to use the mapped route name. It also removes a bunch of unnecessary config and aligns the collector with the other metrics collectors in flow-go

@codecov-commenter
Copy link

codecov-commenter commented Jul 19, 2023

Codecov Report

Merging #4571 (435c8ff) into master (2528190) will decrease coverage by 6.52%.
The diff coverage is 47.61%.

@@            Coverage Diff             @@
##           master    #4571      +/-   ##
==========================================
- Coverage   56.25%   49.73%   -6.52%     
==========================================
  Files         653       98     -555     
  Lines       64699     6651   -58048     
==========================================
- Hits        36396     3308   -33088     
+ Misses      25362     3175   -22187     
+ Partials     2941      168    -2773     
Flag Coverage Δ
unittests 49.73% <47.61%> (-6.52%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
network/p2p/inspector/internal/cache/cache.go 64.70% <ø> (ø)
network/p2p/middleware/middleware.go 1.71% <0.00%> (ø)
network/p2p/p2pbuilder/libp2pNodeBuilder.go 0.00% <0.00%> (ø)
network/p2p/test/fixtures.go 30.28% <0.00%> (ø)
network/p2p/connection/connector_factory.go 62.16% <42.10%> (ø)
network/netconf/flags.go 26.37% <50.00%> (ø)
network/p2p/connection/peerManager.go 82.97% <50.00%> (ø)
network/p2p/scoring/score_option.go 79.87% <72.91%> (ø)
network/p2p/tracer/internal/rpc_send_entity.go 77.77% <77.77%> (ø)
network/p2p/tracer/gossipSubMeshTracer.go 94.26% <81.81%> (ø)
... and 6 more

... and 734 files with indirect coverage changes

// mapURLToRoute uses the urlToRouteMapper callback to convert a URL to a route name
// This normalizes the URL, removing dynamic information converting it to a static string
func (r *RestCollector) mapURLToRoute(url string) string {
if r.urlToRouteMapper == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at the code, this callback should never be set to nil. We should return an error in the constructor if it is, that should indicate a bug.

@kc1116 kc1116 requested a review from koko1123 July 19, 2023 15:04
@peterargue
Copy link
Contributor Author

bors merge

bors bot added a commit that referenced this pull request Jul 19, 2023
4571: [Access] Update REST metrics to use route name for all types r=peterargue a=peterargue

The REST metrics handler passes the original route into the collector, causing high cardinality and performance issues on the prometheus servers. We attempted to fix this with #4452, but only updated 1 of 4 metrics that were reporting the URL.

This PR updates all metrics to use the mapped route name. It also removes a bunch of unnecessary config and aligns the collector with the other metrics collectors in flow-go

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>
@bors
Copy link
Contributor

bors bot commented Jul 19, 2023

Build failed:

@peterargue
Copy link
Contributor Author

bors merge

bors bot added a commit that referenced this pull request Jul 20, 2023
4571: [Access] Update REST metrics to use route name for all types r=peterargue a=peterargue

The REST metrics handler passes the original route into the collector, causing high cardinality and performance issues on the prometheus servers. We attempted to fix this with #4452, but only updated 1 of 4 metrics that were reporting the URL.

This PR updates all metrics to use the mapped route name. It also removes a bunch of unnecessary config and aligns the collector with the other metrics collectors in flow-go

Co-authored-by: Peter Argue <89119817+peterargue@users.noreply.github.com>
@bors
Copy link
Contributor

bors bot commented Jul 20, 2023

Build failed:

@peterargue peterargue merged commit 806456f into master Jul 20, 2023
33 checks passed
@peterargue peterargue deleted the petera/fix-rest-metrics-take3 branch July 20, 2023 20:32
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.

4 participants