[Metrics] Give visibility into indexing#134
Conversation
mhutchinson
commented
Jun 10, 2026
- Number of keys output per entry
- Duration of various operations
- Number of keys output per entry - Duration of various operations
|
I recommend reviewing with the whitespace-aware diff on ( |
| if mp == nil { | ||
| mp = otel.GetMeterProvider() | ||
| } | ||
| meter := mp.Meter("github.com/transparency-dev/incubator/vindex") |
There was a problem hiding this comment.
Elsewhere we've put all this in an init() func, and have the meters in package scope var {}.
I'm not sure what would happen here if you had a process which had two instances of a verifiable index and it tried to (re-)create more metrics with the same name.
There was a problem hiding this comment.
I think this way is actually safer because all the variables are locally scoped. You could have metrics for different vindex exported on different paths/ports if you provide different MeterProviders. If you pass in the same one then it should merge them. Unlikely to happen here as running 2 indexes is probably a lot for a single task!
The reason we might not have done this before is because it's messier because you need to pass around the provider and the counters/histograms instead of having them as global singletons.
I'm happy with this approach for now, and we can revisit this in v1 rewrite.