Skip to content

Commit 346966d

Browse files
committed
add hashing_metadata field to table
1 parent 2f0ac98 commit 346966d

File tree

3 files changed

+43
-1
lines changed

3 files changed

+43
-1
lines changed

migrations_lockfile.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ hybridcloud: 0016_add_control_cacheversion
1010
nodestore: 0002_nodestore_no_dictfield
1111
remote_subscriptions: 0003_drop_remote_subscription
1212
replays: 0004_index_together
13-
sentry: 0786_drop_broadcasts_cta_column
13+
sentry: 0787_add_hashing_metadata_to_grouphash_metadata
1414
social_auth: 0002_default_auto_field
1515
uptime: 0017_unique_on_timeout
1616
workflow_engine: 0011_action_updates
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Generated by Django 5.1.1 on 2024-11-08 20:42
2+
3+
from django.db import migrations
4+
5+
import sentry.db.models.fields.jsonfield
6+
from sentry.new_migrations.migrations import CheckedMigration
7+
8+
9+
class Migration(CheckedMigration):
10+
# This flag is used to mark that a migration shouldn't be automatically run in production.
11+
# This should only be used for operations where it's safe to run the migration after your
12+
# code has deployed. So this should not be used for most operations that alter the schema
13+
# of a table.
14+
# Here are some things that make sense to mark as post deployment:
15+
# - Large data migrations. Typically we want these to be run manually so that they can be
16+
# monitored and not block the deploy for a long period of time while they run.
17+
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
18+
# run this outside deployments so that we don't block them. Note that while adding an index
19+
# is a schema change, it's completely safe to run the operation after the code has deployed.
20+
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment
21+
22+
is_post_deployment = False
23+
24+
dependencies = [
25+
("sentry", "0786_drop_broadcasts_cta_column"),
26+
]
27+
28+
operations = [
29+
migrations.AddField(
30+
model_name="grouphashmetadata",
31+
name="hashing_metadata",
32+
field=sentry.db.models.fields.jsonfield.JSONField(null=True),
33+
),
34+
]

src/sentry/models/grouphashmetadata.py

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from sentry.db.models import Model, region_silo_model
66
from sentry.db.models.base import sane_repr
77
from sentry.db.models.fields.foreignkey import FlexibleForeignKey
8+
from sentry.db.models.fields.jsonfield import JSONField
9+
from sentry.types.grouphash_metadata import HashingMetadata
810

911

1012
# The overall grouping method used
@@ -56,6 +58,12 @@ class GroupHashMetadata(Model):
5658
latest_grouping_config = models.CharField(null=True)
5759
# The primary grouping method (message, stacktrace, fingerprint, etc.)
5860
hash_basis = models.CharField(choices=HashBasis, null=True)
61+
# Metadata about the inputs to the hashing process and the hashing process itself (what
62+
# fingerprinting rules were matched? did we parameterize the message? etc.). For the specific
63+
# data stored, see the class definitions of the `HashingMetadata` subtypes.
64+
hashing_metadata: models.Field[HashingMetadata | None, HashingMetadata | None] = JSONField(
65+
null=True
66+
)
5967

6068
# SEER
6169

0 commit comments

Comments
 (0)