Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev(mocks): empower-mocks v0 WIP #76520

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

dev(mocks): empower-mocks v0 WIP #76520

wants to merge 4 commits into from

Conversation

realkosty
Copy link
Contributor

@realkosty realkosty commented Aug 24, 2024

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
Screenshot 2024-08-24 at 12 04 24 AM
./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...

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 24, 2024
@realkosty realkosty added Component: Developer Environment This covers issues related to setting up a developer's environment and removed Scope: Backend Automatically applied to PRs that change backend components labels Aug 27, 2024
@getsantry
Copy link
Contributor

getsantry bot commented Sep 17, 2024

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you add the label WIP, I will leave it alone unless WIP is removed ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@getsantry getsantry bot added the Stale label Sep 17, 2024
@realkosty realkosty changed the title dev(mocks): empower-mocks v0 dev(mocks): empower-mocks v0 WIP Sep 17, 2024
@getsantry getsantry bot removed the Stale label Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Developer Environment This covers issues related to setting up a developer's environment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant