Closed bondeanikets closed 5 years ago
Hi @bondeanikets, The metrics library has a registry of metric counters/histograms/vector counters etc. When creating a new counter for instance, it adds a counter to the registry. If you attempt to add the same counter with the same name, you'll cause an error in the metrics library.
Calling the newEdge
method twice ensures that we attempt to recreate edges that already exist in the registry, see here. In the second call, all created metrics should fail, but we still return an edge. The metric library is not nil
, but all of the counters will be since they were not initialized.
The entire metrics library is nil-safe.
I'm closing this as it seems that you are asking/clarifying the test behaviour and are not actually, reporting an issue or feature.
At https://github.com/yarpc/yarpc-go/blob/dev/internal/observability/graph_test.go#L49, why is the function
newEdge
called twice?Also, noop metric is used in the second call, but the comment says null.
@kriskowal, thoughts?