Skip to content

Commit

Permalink
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/sentry/features/temporary.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ def register_temporary_features(manager: FeatureManager):
manager.add("projects:relay-otel-endpoint", ProjectFeature, FeatureHandlerStrategy.OPTIONS, api_expose=False)
# EAP: extremely experimental flag that makes DDM page use EAP tables
manager.add("projects:use-eap-spans-for-metrics-explorer", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=False)
manager.add("projects:record-span-descriptions", ProjectFeature, FeatureHandlerStrategy.FLAGPOLE, api_expose=True)

# Project plugin features
manager.add("projects:plugins", ProjectPluginFeature, FeatureHandlerStrategy.INTERNAL, default=True, api_expose=True)
Expand Down
4 changes: 4 additions & 0 deletions src/sentry/ingest/transaction_clusterer/datasource/redis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" Write transactions into redis sets """

import logging
from collections.abc import Iterator, Mapping
from typing import Any
Expand Down Expand Up @@ -184,6 +185,9 @@ def record_span_descriptions(
if not features.has("projects:span-metrics-extraction", project):
return

if not features.has("projects:record-span-descriptions", project):
return

spans = event_data.get("spans", [])
for span in spans:
description = _get_span_description_to_store(span)
Expand Down
13 changes: 8 additions & 5 deletions tests/sentry/ingest/test_span_desc_clusterer.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def test_record_span_desc_url(mocked_record, default_organization):
with Feature(
{
"projects:span-metrics-extraction": True,
"projects:record-span-descriptions": True,
}
):
project = Project(id=111, name="project", organization_id=default_organization.id)
Expand Down Expand Up @@ -241,9 +242,10 @@ def _add_mock_data(proj, number):
# Add a transaction to project2 so it runs again
_record_sample(ClustererNamespace.SPANS, project2, "foo")

with mock.patch(
"sentry.ingest.transaction_clusterer.tasks.PROJECTS_PER_TASK", 1
), freeze_time("2000-01-01 01:00:01"):
with (
mock.patch("sentry.ingest.transaction_clusterer.tasks.PROJECTS_PER_TASK", 1),
freeze_time("2000-01-01 01:00:01"),
):
spawn_clusterers_span_descs()

# One project per batch now:
Expand Down Expand Up @@ -299,8 +301,9 @@ def test_get_deleted_project():
@django_db_all
def test_record_span_descriptions_no_databag(default_organization):
"""Verify a `None` databag doesn't break the span description clusterer."""
with Feature("projects:span-metrics-extraction"), override_options(
{"span_descs.bump-lifetime-sample-rate": 1.0}
with (
Feature("projects:span-metrics-extraction"),
override_options({"span_descs.bump-lifetime-sample-rate": 1.0}),
):
payload = {
"spans": [
Expand Down

0 comments on commit 2cbf881

Please sign in to comment.