fix(workflows): variable-scan metric cardinality, timing, and bytecode skip - #71500
Merged
Merged
Conversation
…e skip Review follow-ups on the variable-miss tracing: - Drop the hog_flow_id label from the miss counter: one series per workflow UUID is unbounded cardinality for a metric whose job is the fleet-wide rate (it sizes the publish-time lint work). The per-flow drill-down lives in the structured warn log, which already carries team, flow, action, and the missing names. - Time the scan with a histogram: it runs on every fresh entry into a function step, so its cost has to be observable rather than assumed. - Stop traversing bytecode/transpiled keys. They are the bulkiest part of a config and, contrary to the previous comment, not match-proof: a template string embedded verbatim as a bytecode constant matches the regex while the executor never renders from it - a latent false positive, covered by a new test row. Generated-By: PostHog Code Task-Id: 7f5083cf-5d17-4f37-8bee-8c43db70cb79
Contributor
|
Reviews (1): Last reviewed commit: "fix(workflows): variable-scan metric car..." | Re-trigger Greptile |
meikelmosby
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Review follow-ups on #71060 (variable-miss tracing), raised in the team Slack thread after it auto-merged:
hog_flow_id- one Prometheus series per workflow UUID that ever misses a variable, unbounded cardinality for a metric whose job is fleet-wide ("are misses common enough to justify the publish-time lint?").bytecodearrays. The in-code comment claimed that's safe because compiled references storevariablesand the key as separate constants - true for compiled references, but a template string embedded verbatim as a bytecode constant (or thetranspiledJS form) does match the regex while the executor never renders from it: wasted work on the bulkiest part of the config, plus a latent false-positive warning.Changes
cdp_hogflow_missing_variable_referenceis now unlabelled. The per-flow drill-down lives in the structured warn log, which already carries team, flow, action, and the missing names - strictly richer than the label was. The metric is a day old, so nothing charts by the old label yet.cdp_hogflow_variable_scan_duration_secondshistogram around the scan (fixed buckets, 0.5ms-500ms). If it flatlines sub-millisecond we can delete it later with evidence in hand.bytecodeandtranspiledkeys, with the comment corrected to explain the false-positive case rather than asserting safety.How did you test this code?
Extended the existing parameterized suite with a row where a matching-looking template string sits inside a bytecode constant and a
transpiledstring - it must not be reported (catches anyone removing the skip and reintroducing the false positive; the pre-existing bytecode row only covered the compiled-reference shape that can't match). Fullhogflow-variable-usage+hog_functionsuites pass (28 tests), lint and tsc clean.Automatic notifications
Docs update
Not needed - internal observability only.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Authored with PostHog Code (Claude), addressing colleague review feedback relayed from Slack. Skills invoked:
/writing-tests. The bytecode-skip finding turned out to be a correctness fix, not just perf - the original safety comment held for compiled references but not for template strings carried verbatim as constants.Created with PostHog Code