-
Notifications
You must be signed in to change notification settings - Fork 110
all: change metric names delimiter . to / (#2138) #2139
Conversation
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.
Thanks Ivan. Looks OK, I could not find a miss except in no-code README. https://github.com/ethersphere/swarm/blob/master/README.md#metrics-and-instrumentation-in-swarm.
- https://github.com/ethersphere/swarm/blob/metric-names-rewrite/p2p/protocols/protocol.go#L285 %T is the problem
It is possible to use strings.ReplaceAll
to replace all problematic characters? Probably to replace .
with _
.
- runtime metrics
The problem is in a vendored ethereum/go-ethereum https://github.com/ethersphere/swarm/blob/metric-names-rewrite/vendor/github.com/ethereum/go-ethereum/metrics/runtime.go#L57.
I think that it would be most reliable just to copy code that does runtime metrics in go-ethereum/metrics into swarm/metrics package and fix the naming problem. We are calling two functions from there RegisterRuntimeMemStats and CaptureRuntimeMemStats. These functions and all of their required unexported variables, types and functions can be just copied and fixed. This would be much easier then to bother fixing this issue upstream and dealing with go-etehereum dependency version upgrade.
We are lucky not to use RegisterDebugGCStats from https://github.com/ethersphere/swarm/blob/metric-names-rewrite/vendor/github.com/ethereum/go-ethereum/metrics/debug.go#L64.
Is it ok for you to fix the rest of the problematic metrics with my suggestions?
@janos fixed peer/send metric delimiter as proposed with |
TestReporter in github.com/ethersphere/swarm/p2p/protocols is failing because accounting metrics are persisted and the keys in the database are not updated. They are defined in p2p/protocols/reporter.go metricsMap. I do not think that metrics should be used for anything else except instrumentation and that accounting should not rely on metrics in order to function well. Regardless of that, this is implemented and it should work. |
All metric name delimiters are changed except for:
all
runtime
metrics from debug/api andhttps://github.com/ethersphere/swarm/blob/metric-names-rewrite/p2p/protocols/protocol.go#L285
%T
is the problem