Skip to content

fix(metrics) fix runaway blob file_type attribute values#3150

Merged
levb merged 1 commit into
mainfrom
lev-fix-runaway_filetype
Jun 30, 2026
Merged

fix(metrics) fix runaway blob file_type attribute values#3150
levb merged 1 commit into
mainfrom
lev-fix-runaway_filetype

Conversation

@levb

@levb levb commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@cla-bot cla-bot Bot added the cla-signed label Jun 30, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

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.

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

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@levb levb marked this pull request as ready for review June 30, 2026 19:28

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@levb levb merged commit 6b88bbc into main Jun 30, 2026
97 of 99 checks passed
@levb levb deleted the lev-fix-runaway_filetype branch June 30, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants