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

cmd/relay: enabled new libp2p relay metrics #3040

Merged
merged 6 commits into from
Apr 16, 2024

Conversation

pinebit
Copy link
Contributor

@pinebit pinebit commented Apr 16, 2024

libp2p introduced set of new metrics for relay:
https://github.com/libp2p/go-libp2p/blob/master/p2p/protocol/circuitv2/relay/metrics.go

This work integrates these metrics into our instrumentation flow.

Note: metrics reported by libp2p will be prefixed: libp2p_relaysvc whereas metrics reported by charon code are prefixed: relay_p2p. This distinction seems useful for clear separation and avoiding clashes. Therefore, metrics.md remains intact. This only enriches libp2p metrics with charon cluster labels.

category: feature
ticket: #2544

Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 52.94118% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 54.88%. Comparing base (6bebc88) to head (919562d).

Files Patch % Lines
cmd/relay/p2p.go 50.00% 7 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3040      +/-   ##
==========================================
+ Coverage   54.76%   54.88%   +0.11%     
==========================================
  Files         207      207              
  Lines       28932    28935       +3     
==========================================
+ Hits        15844    15880      +36     
+ Misses      11267    11236      -31     
+ Partials     1821     1819       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

sonarcloud bot commented Apr 16, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

}

p2p.RegisterConnectionLogger(ctx, tcpNode, nil)

labels := map[string]string{"relay_peer": p2p.PeerName(tcpNode.ID())}
log.SetLokiLabels(labels)
promRegistry, err := promauto.NewRegistry(labels)
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it a bit weird creating a prometheus registry in startP2P function? Does it make sense to create it outside of it (in cmd/relay/relay.go:Run afaict) and pass it as an argument, similarly to how the reporter is passed (another monitoring structure)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem here is in the dependency on labels which we can populate only after we started a tcpNode.
I would rework it in a different way to remove this dependency, but would be a drastic change, not for the scope of this PR for sure.

@pinebit pinebit added the merge when ready Indicates bulldozer bot may merge when all checks pass label Apr 16, 2024
@obol-bulldozer obol-bulldozer bot merged commit 62a9492 into main Apr 16, 2024
11 of 12 checks passed
@obol-bulldozer obol-bulldozer bot deleted the pinebit/p2p-relay-metrics branch April 16, 2024 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when ready Indicates bulldozer bot may merge when all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants