chore: WPB-28096 Enable JVM metrics and add business metrics - #147
chore: WPB-28096 Enable JVM metrics and add business metrics#147bbaarriiss wants to merge 5 commits into
Conversation
Code review: Prometheus metrics integration
Overall this is a well-shaped change. The There is one issue I'd want fixed before merge (label cardinality), one deployment question, and a handful of smaller things. 1. Unbounded label cardinality — client-controlled tag values 🔴
Both tag values are caller-controlled:
Micrometer registers a new
Suggested fix — clamp to a known set: private fun eventTag(event: String) =
if (event in KNOWN_EVENTS) event else OTHER
private fun actionTag(action: String?) = when {
action == null -> NO_ACTION
action in KNOWN_ACTIONS -> action
else -> OTHER
}
2.
|
|
Hey @claude , I can understand your concern about "Unbounded label cardinality — client-controlled tag values" but the values are actually limited. These event are the event Github sends us. So, no worries about it. |
|
Claude finished @bbaarriiss's task in 2m 21s —— View job Re: label cardinality — you're mostly right, downgrading itThanks for pushing back. I went back through Where you're rightThe benign cardinality is genuinely fine. GitHub has ~75 webhook event types, most with a handful of actions; I was also wrong to lump The one narrow thing that isn't quite convention-free
// SignatureValidator.kt:28
val generatedHmacSha1: String = generateHmacSha1(payload, secret)The header isn't in the signed material, and there's no delivery-ID dedup or timestamp check — That said, the realism caveat matters and cuts your way: getting a valid signed payload means being a repo admin, or reading one out of GitHub's webhook delivery UI — i.e. someone who already holds the secret. It's not an anonymous-internet path, it's "a party you already trust can make a shared service's registry grow." That's a much smaller claim than the one I made. So: the values are the ones GitHub sends, in practice. They just aren't constrained to that by the code — it's a convention, not an invariant. If you want the cheap versionNot asking for the private fun eventTag(event: String) = if (event in KNOWN_EVENTS) event else "other"Worth noting it'd close an adjacent thing for free: The rest of the review (#2 metrics endpoint exposure, #3 the 3.4.0 pin, #4 the 403 change, #5 send failures, #6 setup, #7 re-registration) is unaffected by this and still stands as written. Original review, for referenceCode review: Prometheus metrics integration
Overall this is a well-shaped change. The There is one issue I'd want fixed before merge (label cardinality), one deployment question, and a handful of smaller things. 1. Unbounded label cardinality — client-controlled tag values 🔴(superseded — see reply above)
Both tag values are caller-controlled:
Micrometer registers a new
Suggested fix — clamp to a known set: private fun eventTag(event: String) =
if (event in KNOWN_EVENTS) event else OTHER
private fun actionTag(action: String?) = when {
action == null -> NO_ACTION
action in KNOWN_ACTIONS -> action
else -> OTHER
}
2.
|
|
📣 Now the PR is ready for review. Note: I deleted the comments I've added in this PR to test certain cases about Github events and verify them on Grafana. |
PR Submission Checklist for internal contributors
The PR Title
SQPIT-764The PR Description
What's new in this PR?
Solutions
How to test