|
1 | 1 | # Proto Override System |
2 | 2 |
|
3 | | -Compile and serve proto definitions directly from the sentry repo, replacing the pip-installed `sentry-protos` package for migrated domains. |
| 3 | +Temporarily override pip-installed `sentry-protos` modules with local `.proto` definitions for faster iteration, without waiting for a `sentry-protos` release. |
4 | 4 |
|
5 | 5 | ## Why This Exists |
6 | 6 |
|
7 | | -Proto definitions used to live exclusively in the `sentry-protos` repo, with a separate pip release cycle. Iterating on protos required publishing a new `sentry-protos` version before sentry could use the changes. This system moves proto source files into the sentry repo itself (`proto/`), compiling them at import time during development and pre-compiling them during CI/deploy for production. |
8 | | - |
9 | | -Domains are migrated incrementally. Non-migrated domains (snuba, seer, etc.) continue to be served from the `sentry-protos` pip package as a transparent fallback. |
| 7 | +Proto definitions live in the `sentry-protos` repo with a separate pip release cycle. Iterating on protos requires publishing a new `sentry-protos` version before sentry can use the changes. This system lets you place `.proto` files in `proto/` to override specific modules during development, CI, and production. Changes should eventually be published back to `sentry-protos`. |
10 | 8 |
|
11 | 9 | ## Architecture |
12 | 10 |
|
@@ -72,28 +70,26 @@ This works regardless of whether the module comes from `proto/` (override) or th |
72 | 70 | ### Priority Order |
73 | 71 |
|
74 | 72 | ``` |
75 | | -1. proto/ (in-repo, committed to git) ← source of truth |
76 | | -2. pip sentry-protos (installed package) ← fallback for non-migrated domains |
| 73 | +1. proto/ (in-repo overrides) ← highest priority |
| 74 | +2. pip sentry-protos (installed package) ← fallback |
77 | 75 | ``` |
78 | 76 |
|
79 | | -Migrated domains (e.g., billing) are maintained in `proto/`. Non-migrated domains (snuba, seer, etc.) are served from the pip-installed `sentry-protos` package until they are migrated. |
| 77 | +Protos in `proto/` take precedence. Anything not overridden falls through to the pip package. |
80 | 78 |
|
81 | 79 | ### getsentry |
82 | 80 |
|
83 | 81 | No setup required. Both repos share one venv with sentry editable-installed, so `REPO_ROOT` in `proto_loader.py` resolves to sentry's repo root where `proto/` lives. The `install()` calls in sentry's initializer and pytest plugin cover getsentry automatically — both at runtime and in tests. |
84 | 82 |
|
85 | 83 | Proto overrides placed in sentry's `proto/sentry_protos/` are picked up by getsentry with no getsentry-side changes. |
86 | 84 |
|
87 | | -### Migrating a New Domain |
| 85 | +### Copying Protos from sentry-protos |
88 | 86 |
|
89 | | -To migrate a domain from `sentry-protos` into this repo (one-time): |
| 87 | +To copy a domain's protos from a local sentry-protos checkout: |
90 | 88 |
|
91 | 89 | ```bash |
92 | 90 | bin/sync-protos /path/to/sentry-protos <domain> |
93 | 91 | ``` |
94 | 92 |
|
95 | | -After the initial copy, maintain the protos in `proto/` — do not re-sync. |
96 | | - |
97 | 93 | ## Configuration |
98 | 94 |
|
99 | 95 | Most setups need no environment variables — `proto/` and `.proto_cache/` work by convention. |
@@ -145,16 +141,16 @@ proto/ ← .proto sources (in git) |
145 | 141 |
|
146 | 142 | ## Helper Script: `bin/sync-protos` |
147 | 143 |
|
148 | | -A one-time migration tool for copying proto files from a `sentry-protos` checkout into `proto/`. After the initial migration, protos are maintained directly in the sentry repo. |
| 144 | +Copies proto files from a `sentry-protos` checkout into `proto/`. |
149 | 145 |
|
150 | 146 | ```bash |
151 | | -# One-time migration: copy billing protos from sentry-protos |
| 147 | +# Copy billing protos from sentry-protos |
152 | 148 | bin/sync-protos /path/to/sentry-protos billing |
153 | 149 |
|
154 | | -# Migrate multiple domains at once |
| 150 | +# Copy multiple domains |
155 | 151 | bin/sync-protos /path/to/sentry-protos billing snuba |
156 | 152 |
|
157 | | -# Migrate all domains |
| 153 | +# Copy all domains |
158 | 154 | bin/sync-protos --all |
159 | 155 |
|
160 | 156 | # Show current override status |
|
0 commit comments