dev(mocks): empower-mocks v0
Use latest real events from Empower Plant in your dev environment, with distributed tracing and linked Replays preserved.
This PR
This PR ships a dev environment script, empower-mocks similar to load-mocks that takes previously captured envelopes stored in a public GCP bucket, tweaks them to have latest timestamps and unique IDs and sends into locally running ingest pipeline.
./bin/empower-mocks --help
usage: empower-mocks [-h] [--projects [PROJECTS ...]] [--stream [INTERVAL_SECONDS]] [--quiet]
Load latest mock data from empower
options:
-h, --help show this help message and exit
--projects [PROJECTS ...]
Space-separated list of empower projects (default: react flask)
--stream [INTERVAL_SECONDS]
Send new events continuously at given interval in seconds (default: 5)
--quiet Don't print ingest responses
Second part, currently being built, is event capture using mini-relay integrated into Empower CI and will allow empower-mocks script to have the most recent events, e.g. ones using latest SDK. The goal of it is to provide high-quality real data for local debugging. "Mocks" therefore is a bit of misnomer as this is actual E2E test data.
--stream option
Instead of ingesting just 1 sample set of events --stream [INTERVAL_SECONDS] option will use captured Empower events as a template to generate new events every INTERVAL_SECONDS (default: 5) with adjusted timestamps and new IDs.
Empower
Empower Plant (https://demo.sentry.io/) offers a variety of SDKs and backends, has rich context and good-looking trace waterfall graphs. Its code lives in sentry-demos/empower monorepo and is co-owned by SE and SDK Engineering teams. It has CI and will build, deploy and stream all new merged changes to our demo org. You can learn more in #discuss-demo channel on Slack which has documentation links at the top.
Event capture
The part that captures events from empower and stores them in GCP bucket is still work in progress:
design doc
work already done
Implementation details
We chose not to parse envelopes for simplicity and low maintenance burden. Instead whenever possible we search-and-replace values that need to be adjusted. We accept the risk of those accidentally modifying unrelated keys in the event context because this is only test data.
Expected bucket structure
Note: relies on sequential digit filenames (1,2,3,...) instead of current 3629.173098407 and like. GCP doesn't seem to have a way to browse the bucket via public HTTP. In the future we also want project folders in the bucket to match project names in empower to eliminate the need to hardcode the mapping.
Testing
./bin/empower-mocks
Mocking org Sentry
> Mocking team Empower Plant
> Mocking project react
> Mocking project flask
{}
{"id":"aedbad1aaf2ada9a4400c4baa5a70ec5"}
{}
{}
> Done sending envelopes. Waiting for processing to finish
> Processing pending buffers
> Processing complete
./bin/empower-mocks --stream
Mocking org Sentry
> Mocking team Empower Plant
> Mocking project react
> Mocking project flask
> Sending new batch of events every 5 seconds
^C Exit
^Z Pause
fg Resume
{}
{}
{"id":"e20479bc8b571bf4d64ad23bd96a7d2f"}
{}
{}
{}
{"id":"3fc5f4fec379770efe9ae2d04c4385ce"}
{}
^Z
Paused. Use `fg` command to resume
zsh: suspended ./bin/empower-mocks --stream
fg
[1] + continued ./bin/empower-mocks --stream
{}
{}
{"id":"1d0ceb4195340601993797f9649e38b7"}
{}
{}
{}
{"id":"4cc3ecc28cae14ed196aa894b04be75f"}
{}
^C
Exiting...