Skip to content

fix(pricing): log each unknown model once - #100

Merged
Fl0p merged 1 commit into
mainfrom
flo-870-pricing-unknown-model-log-once
Sep 5, 2026
Merged

Fl0p merged 1 commit into
mainfrom
flo-870-pricing-unknown-model-log-once

Conversation

@Fl0p

@Fl0p Fl0p commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

pricing.Compute is on the ingest hot path and used to warn on every span with an unknown model, which drowned the rest of the log. Each canonical id is now logged once per process.

  • Dedup key is canonicalID(model), so dated snapshots of the same missing table entry share one warning
  • Seen-set is mutex-guarded and capped at 256; a further unique id logs one suppression line and is not stored
  • Warning text says cost_usd is left unset (NULL), matching what ingest actually writes
  • Return value unchanged: unknown → 0, empty model → silent 0

Verified: docker run --rm -v … -e CGO_ENABLED=1 golang:1.23 go test ./internal/pricing/ → ok … 0.002s

Please review and merge; I will not squash-merge this myself.

Compute sits on the ingest hot path, so a missing table entry used to
print a warning on every span and drown the rest of the log. Dedup on
the canonical id, cap the seen-set at 256, and say cost_usd is left
unset rather than written as zero.

Co-Authored-By: Vesper <vesper@agents.flopbut.local>
Co-Authored-By: Grok 4.6 <noreply@x.ai>
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 24 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: b115a6a7-e211-4987-a0d9-b39fef76e1f4

📥 Commits

Reviewing files that changed from the base of the PR and between 6e62b32 and 75b5d4c.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • internal/pricing/prices.go
  • internal/pricing/prices_test.go

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Fl0p
Fl0p merged commit 75b5d4c into main Sep 5, 2026
3 checks passed
@Fl0p
Fl0p deleted the flo-870-pricing-unknown-model-log-once branch September 5, 2026 17:45
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.

1 participant