-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
swarm: add a basic metrics tracer #1973
Conversation
3328610
to
52034ff
Compare
0daaeff
to
28cb275
Compare
26a6f97
to
0bf5d37
Compare
I added the Grafana dashboard. There's probably a lot that can be improved on that front, happy about suggestions (and PRs...). What's really annoying here is that Grafana is too stupid to apply consistent colors on different panels. For example, it makes it soooo much easier to consume if QUIC always has the same color. You can set colors manually via so-called overrides, but those are per panel. So what I did is I defined the overrides for all our transports in one panel, and then copy-pasted a long block of JSON over to the other panels. Apparently that's the only way to do it. 🤢 |
I know it's asking a bit, but is there an open grafana dashboard I can see? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so cool! I can't believe we haven't had this yet.
Just some nits. I'll approve as soon as they're fixed.
) | ||
|
||
func BenchmarkMetricsConnOpen(b *testing.B) { | ||
b.ReportAllocs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we check that this is indeed some low number of allocs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a unit test? Benchmarks are currently not run on CI at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup
if s.metricsTracer != nil { | ||
connState := connC.ConnState() | ||
s.metricsTracer.OpenedConnection(network.DirOutbound, connC.RemotePublicKey(), connState) | ||
s.metricsTracer.CompletedHandshake(time.Since(start), connState) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want to do this on the listen side as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would require us to put it in the transport. The swarm doesn't know when the handshake of an incoming connection started.
tags := getStringSlice() | ||
defer putStringSlice(tags) | ||
*tags = appendConnectionState(*tags, cs) | ||
connHandshakeLatency.WithLabelValues(*tags...).Observe(t.Seconds()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we could know if this was an early muxer negotiation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add this to the ConnectionState struct?
0bf5d37
to
f2746ea
Compare
f2746ea
to
efb535f
Compare
Merging because I can't wait for this feature! |
Fixes #1910.
Due to our experience with OpenCensus (#1955), this now uses Prometheus. There's a benchmark test that confirms that (by using a
sync.Pool
for the slices containing the labels) we're not allocating at all.