Skip to content

[Metrics] Give visibility into indexing#134

Merged
mhutchinson merged 3 commits into
transparency-dev:mainfrom
mhutchinson:feat/metrics
Jun 10, 2026
Merged

[Metrics] Give visibility into indexing#134
mhutchinson merged 3 commits into
transparency-dev:mainfrom
mhutchinson:feat/metrics

Conversation

@mhutchinson

Copy link
Copy Markdown
Contributor
  • Number of keys output per entry
  • Duration of various operations

- Number of keys output per entry
- Duration of various operations
@mhutchinson

Copy link
Copy Markdown
Contributor Author

I recommend reviewing with the whitespace-aware diff on (?w=1) or it looks much worse than it is!

Comment thread vindex/map.go
if mp == nil {
mp = otel.GetMeterProvider()
}
meter := mp.Meter("github.com/transparency-dev/incubator/vindex")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@mhutchinson mhutchinson merged commit 6252100 into transparency-dev:main Jun 10, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants