[build-tools] Add eas/posthog_wait_for_metric workflow function#3945
Draft
gwdp wants to merge 1 commit into
Draft
[build-tools] Add eas/posthog_wait_for_metric workflow function#3945gwdp wants to merge 1 commit into
gwdp wants to merge 1 commit into
Conversation
c50c7ce to
4f8d88f
Compare
00debc7 to
5b641eb
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## gwdp/eng-21551-posthog-flag-rollout #3945 +/- ##
=======================================================================
+ Coverage 59.33% 59.40% +0.08%
=======================================================================
Files 938 939 +1
Lines 41223 41296 +73
Branches 8685 8699 +14
=======================================================================
+ Hits 24454 24527 +73
Misses 16674 16674
Partials 95 95 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
5b641eb to
63af5cf
Compare
4f8d88f to
17c3b91
Compare
63af5cf to
55545d5
Compare
17c3b91 to
3745235
Compare
55545d5 to
25c9c2e
Compare
|
✅ Thank you for adding the changelog entry! |
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.
Why
Gate an EAS workflow on a PostHog metric. Hold a rollout until errors stay low (or any metric clears) before it continues, instead of watching dashboards by hand. imo this is the coolest 🔥
How
Adds
eas/posthog_wait_for_metric. It polls a HogQLqueryuntiloperator/thresholdis met, everyinterval_seconds(default 30) for up totimeout_seconds(default 600). Auth is the same personal key as the flag step, and the key needs the query read scope. (good docs coming)It also sets a
valueoutput with the query result that met the threshold, so a later step can use${{ steps.<step id>.outputs.value }}.There's no
ignore_errorhere on purpose. It's a gate, so timing out fails the step. Network errors, 429 and 5xx retry until the deadline. Auth and query errors fail right away.Test Plan
CI passes. Test workflow below. The second and third jobs fail on purpose (timeout and bad query shape). Not live-run yet, since the key from connect lacks the query scope. Will run it before undrafting.
Test workflow
Examples
These are simple workflows just to exercise the step. More fun and useful ones, mixed with EAS Update and deploys, are coming in the docs.
Send an event and wait for it
Two jobs with no
needs, so they run at the same time. One sends the event, the other waits for it to land. This needs real concurrency. It won't clear on a local runner set to concurrency 1, since the jobs run one after another there.Use the metric value in a later step
The gate exposes the reading it settled on as an output. A later step reads it with
${{ steps.gate.outputs.value }}.