feat(preprod): Store metrics artifact type as string in EAP (EME-874)#112905
feat(preprod): Store metrics artifact type as string in EAP (EME-874)#112905cameroncooke wants to merge 3 commits intomasterfrom
Conversation
Write metrics_artifact_type as a human-readable string label instead of an integer enum value when producing PREPROD size metric EAP trace items. This enables string-based value autocomplete in Explore search without needing enum-to-name mapping at the display layer. - Add to_choice_label() helper on MetricsArtifactType enum - Update EAP write path to emit string labels - Repoint PREPROD search field as public artifact_type (string) - Add artifact_type to frontend string defaults with predefined values - Hide deprecated integer fields from Explore UI - Extract METRICS_ARTIFACT_TYPES as canonical shared constant Refs EME-874 Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
|
🚨 Warning: This pull request contains Frontend and Backend changes! It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently. Have questions? Please ask in the |
Backend Test FailuresFailures on
|
…rror handling - Update read.py attribute definition to search_type="string" matching the write path change (fixes integration test round-trip failure) - Extract _metrics_artifact_type_label helper with ValueError handling for invalid database values (addresses Warden feedback)
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d692518. Configure here.
…ersion Handles the case where an enum member exists but is missing from as_choices(), preventing a crash in the EAP write path.
Sentry Snapshot Testing
|
| "size_metric_id": size_metric.id, | ||
| "sub_item_type": "size_metric", | ||
| "metrics_artifact_type": size_metric.metrics_artifact_type, | ||
| "metrics_artifact_type": _metrics_artifact_type_label(size_metric.metrics_artifact_type), |
There was a problem hiding this comment.
Just want to confirm this is safe to do and that you've tested changing a column type with existing data.

Stores
metrics_artifact_typeas a human-readable string label (e.g.main_artifact,watch_artifact) instead of an integer enum value when writing PREPROD size metrics to EAP. This replaces the previous approach of trying to map integer enums to display names at the frontend/query layer, which was invasive and couldn't leverage the existing string value autocomplete pipeline.The new public search field
artifact_typeresolves to the internalmetrics_artifact_typestring attribute, making it eligible for Explore's existing value autocomplete. Deprecated integer-backed fields (metrics_artifact_type,tags[metrics_artifact_type,number],tags[artifact_type,number]) are hidden from the UI.Also extracts
METRICS_ARTIFACT_TYPESas a canonical shared constant on the frontend, so the settings UI composes itsall_artifactssentinel on top rather than baking it into the base list.The tradeoff is no backfill for existing EAP data — only newly written rows will have string values. This is acceptable since we're early going with PREPROD metrics.
Screenshots
Known risks
artifact_typenow points to the internalmetrics_artifact_type(string), but there is also a rawartifact_typeinteger attribute in EAP representing the build artifact kind (XCARCHIVE/AAB/APK). The old integerartifact_typeis hidden from the UI but still written to EAP.metrics_artifact_typeinteger field or the oldartifact_typeinteger field will no longer resolve through the search definitions. Given we are early going with PREPROD, the impact should be minimal and user-recoverable.artifact_typefield will only match rows written after this change.Fixes EME-874