[build-tools] Add eas/posthog_wait_for_metric workflow function#3945
[build-tools] Add eas/posthog_wait_for_metric workflow function#3945gwdp 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.63% 59.69% +0.06%
=======================================================================
Files 941 942 +1
Lines 41498 41555 +57
Branches 8746 8757 +11
=======================================================================
+ Hits 24745 24802 +57
Misses 16659 16659
Partials 94 94 ☔ 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
25c9c2e to
541170a
Compare
3745235 to
e006085
Compare
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
541170a to
0040a80
Compare
e006085 to
021c85f
Compare
0040a80 to
8d13771
Compare
a8e1b57 to
f630079
Compare
|
Subscribed to pull request
Generated by CodeMention Warning: The preamble and epilogue options in commentConfiguration are deprecated. Use template instead. |
sjchmiela
left a comment
There was a problem hiding this comment.
i guess it would be even cooler if we could do it not-from-a-VM (type: posthog-wait-for-metric) and poll from a background job
021c85f to
7d5471d
Compare
f630079 to
28718f6
Compare
7d5471d to
2a9777a
Compare
28718f6 to
6e72fed
Compare
6e72fed to
2755d8a
Compare
05251fe to
84eab00
Compare
58cfdcf to
9d6b3f4
Compare
21a614d to
c84289b
Compare
01a7642 to
9a9a276
Compare
Tysm for the idea, it would be even cooler, tracking it under ENG-23097 as a follow-up |
c84289b to
f37a747
Compare
9a9a276 to
bc4056b
Compare
|
✅ Thank you for adding the changelog entry! |

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 }}.