fix(metrics) fix runaway blob file_type attribute values#3150
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the blobType function in packages/shared/pkg/storage/paths.go to classify whole-object blob reads into a fixed set of constants (blobTypeHeader, blobTypeSnapfile, blobTypeMetadata, and blobTypeOther), preventing metric label cardinality blowup. It also introduces corresponding unit tests in packages/shared/pkg/storage/paths_test.go to verify this behavior. There are no review comments, and we have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
LGTM — small, well-scoped metric cardinality fix with thorough test coverage.
Extended reasoning...
Overview
Two-file change to packages/shared/pkg/storage/paths.go and its test. Replaces blobType — which previously returned the raw filename (after stripping .header) — with a fixed four-value vocabulary (header/snapfile/metadata/other). Used in two call sites in metrics.go for the file_type label on read.blob metrics.
Security risks
None. This is purely an observability label classifier; the path string itself is not exposed, and the function now actively prevents leaking content-addressed hashes or build-IDs into a metric label.
Level of scrutiny
Low. The change is mechanical, the new behavior is enforced by an exhaustive table-driven test (including a regression case for the cardinality blowup from #3063), the comments document why each branch exists, and Codecov confirms full coverage. No production behavior changes beyond metric label values.
Other factors
The only callers are the two blob metric recording sites in metrics.go, both of which pass blobType's return straight into an attribute string — no caller is parsing the value, so collapsing the vocabulary is safe.
No description provided.