diff --git a/requirements-base.txt b/requirements-base.txt index 519060224af0a7..ada1314342a29f 100644 --- a/requirements-base.txt +++ b/requirements-base.txt @@ -71,7 +71,7 @@ sentry-ophio>=1.1.3 sentry-protos==0.2.0 sentry-redis-tools>=0.5.0 sentry-relay>=0.9.9 -sentry-sdk[http2]>=2.25.1 +sentry-sdk[http2]>=2.29.1 slack-sdk>=3.27.2 snuba-sdk>=3.0.43 simplejson>=3.17.6 diff --git a/requirements-dev-frozen.txt b/requirements-dev-frozen.txt index 8937819e48ee8f..8c3717f1db00cd 100644 --- a/requirements-dev-frozen.txt +++ b/requirements-dev-frozen.txt @@ -192,7 +192,7 @@ sentry-ophio==1.1.3 sentry-protos==0.2.0 sentry-redis-tools==0.5.0 sentry-relay==0.9.9 -sentry-sdk==2.27.0 +sentry-sdk==2.29.1 sentry-usage-accountant==0.0.10 simplejson==3.17.6 six==1.16.0 diff --git a/requirements-frozen.txt b/requirements-frozen.txt index 6e832e6bb52037..f65bff9ef387d4 100644 --- a/requirements-frozen.txt +++ b/requirements-frozen.txt @@ -130,7 +130,7 @@ sentry-ophio==1.1.3 sentry-protos==0.2.0 sentry-redis-tools==0.5.0 sentry-relay==0.9.9 -sentry-sdk==2.27.0 +sentry-sdk==2.29.1 sentry-usage-accountant==0.0.10 simplejson==3.17.6 six==1.16.0 diff --git a/src/sentry/api/bases/organization.py b/src/sentry/api/bases/organization.py index 4edbe487329e3b..0b891cabb7a95f 100644 --- a/src/sentry/api/bases/organization.py +++ b/src/sentry/api/bases/organization.py @@ -37,7 +37,7 @@ from sentry.utils import auth from sentry.utils.hashlib import hash_values from sentry.utils.numbers import format_grouped_length -from sentry.utils.sdk import bind_organization_context, set_measurement +from sentry.utils.sdk import bind_organization_context, set_span_data class NoProjects(Exception): @@ -566,7 +566,7 @@ def get_filter_params( len_projects = len(projects) sentry_sdk.set_tag("query.num_projects", len_projects) sentry_sdk.set_tag("query.num_projects.grouped", format_grouped_length(len_projects)) - set_measurement("query.num_projects", len_projects) + set_span_data("query.num_projects", len_projects) params: FilterParams = { "start": start, diff --git a/src/sentry/api/endpoints/organization_event_details.py b/src/sentry/api/endpoints/organization_event_details.py index f9045e09c68da1..456c64ddf52a3a 100644 --- a/src/sentry/api/endpoints/organization_event_details.py +++ b/src/sentry/api/endpoints/organization_event_details.py @@ -2,7 +2,6 @@ from datetime import datetime, timedelta from typing import Any -import sentry_sdk from rest_framework.request import Request from rest_framework.response import Response from snuba_sdk import Column, Condition, Function, Op @@ -23,6 +22,7 @@ from sentry.snuba.dataset import Dataset from sentry.snuba.query_sources import QuerySource from sentry.snuba.referrer import Referrer +from sentry.utils.sdk import set_span_data VALID_AVERAGE_COLUMNS = {"span.self_time", "span.duration"} @@ -39,7 +39,7 @@ def add_comparison_to_event(event, average_columns, request: Request): group_to_span_map[group].append(span) # Nothing to add comparisons to - sentry_sdk.set_measurement("query.groups", len(group_to_span_map)) + set_span_data("query.groups", len(group_to_span_map)) if len(group_to_span_map) == 0: return @@ -77,7 +77,7 @@ def add_comparison_to_event(event, average_columns, request: Request): ), ) ) - sentry_sdk.set_measurement("query.groups_found", len(result["data"])) + set_span_data("query.groups_found", len(result["data"])) for row in result["data"]: group = row["span.group"] for span in group_to_span_map[group]: diff --git a/src/sentry/api/endpoints/organization_events_trace.py b/src/sentry/api/endpoints/organization_events_trace.py index 7935b46bffe737..4b2b30f471899f 100644 --- a/src/sentry/api/endpoints/organization_events_trace.py +++ b/src/sentry/api/endpoints/organization_events_trace.py @@ -36,7 +36,7 @@ from sentry.snuba.referrer import Referrer from sentry.utils.iterators import chunked from sentry.utils.numbers import base32_encode, format_grouped_length -from sentry.utils.sdk import set_measurement +from sentry.utils.sdk import set_span_data from sentry.utils.snuba import bulk_snuba_queries from sentry.utils.validators import INVALID_ID_DETAILS, is_event_id, is_span_id @@ -761,7 +761,7 @@ def build_span_query(trace_id: str, spans_params: SnubaParams, query_spans: list # Performance improvement, snuba's parser is extremely slow when we're sending thousands of # span_ids here, using a `splitByChar` means that snuba will not parse the giant list of spans span_minimum = options.get("performance.traces.span_query_minimum_spans") - sentry_sdk.set_measurement("trace_view.spans.span_minimum", span_minimum) + set_span_data("trace_view.spans.span_minimum", span_minimum) sentry_sdk.set_tag("trace_view.split_by_char.optimization", len(query_spans) > span_minimum) if len(query_spans) > span_minimum: # TODO: because we're not doing an IN on a list of literals, snuba will not optimize the query with the HexInt @@ -813,14 +813,14 @@ def augment_transactions_with_spans( projects.add(error["project.id"]) ts_params = find_timestamp_params(transactions) time_buffer = options.get("performance.traces.span_query_timebuffer_hours") - sentry_sdk.set_measurement("trace_view.spans.time_buffer", time_buffer) + set_span_data("trace_view.spans.time_buffer", time_buffer) if ts_params["min"]: params.start = ts_params["min"] - timedelta(hours=time_buffer) if ts_params["max"]: params.end = ts_params["max"] + timedelta(hours=time_buffer) if ts_params["max"] and ts_params["min"]: - sentry_sdk.set_measurement( + set_span_data( "trace_view.trace_duration", (ts_params["max"] - ts_params["min"]).total_seconds() ) sentry_sdk.set_tag("trace_view.missing_timestamp_constraints", False) @@ -899,7 +899,7 @@ def augment_transactions_with_spans( total_chunks = 3 else: total_chunks = 4 - sentry_sdk.set_measurement("trace_view.span_query.total_chunks", total_chunks) + set_span_data("trace_view.span_query.total_chunks", total_chunks) chunks = chunked(list_spans, (len(list_spans) // total_chunks) + 1) queries = [build_span_query(trace_id, spans_params, chunk) for chunk in chunks] results = bulk_snuba_queries( @@ -1046,7 +1046,8 @@ def record_analytics( sentry_sdk.set_tag( "trace_view.transactions.grouped", format_grouped_length(len_transactions) ) - set_measurement("trace_view.transactions", len_transactions) + set_span_data("trace_view.transactions", len_transactions) + projects: set[int] = set() for transaction in transactions: projects.add(transaction["project.id"]) @@ -1054,7 +1055,7 @@ def record_analytics( len_projects = len(projects) sentry_sdk.set_tag("trace_view.projects", len_projects) sentry_sdk.set_tag("trace_view.projects.grouped", format_grouped_length(len_projects)) - set_measurement("trace_view.projects", len_projects) + set_span_data("trace_view.projects", len_projects) def get(self, request: Request, organization: Organization, trace_id: str) -> HttpResponse: if not self.has_feature(organization, request): diff --git a/src/sentry/api/endpoints/organization_profiling_functions.py b/src/sentry/api/endpoints/organization_profiling_functions.py index 790c4595e4a915..e6a0659f991041 100644 --- a/src/sentry/api/endpoints/organization_profiling_functions.py +++ b/src/sentry/api/endpoints/organization_profiling_functions.py @@ -24,7 +24,7 @@ from sentry.snuba.dataset import Dataset from sentry.snuba.referrer import Referrer from sentry.utils.dates import parse_stats_period, validate_interval -from sentry.utils.sdk import set_measurement +from sentry.utils.sdk import set_span_data from sentry.utils.snuba import bulk_snuba_queries TOP_FUNCTIONS_LIMIT = 50 @@ -202,7 +202,7 @@ def get_trends_data(stats_data) -> list[BreakpointData]: trending_functions = get_trends_data(stats_data) all_trending_functions_count = len(trending_functions) - set_measurement("profiling.top_functions", all_trending_functions_count) + set_span_data("profiling.top_functions", all_trending_functions_count) # Profiling functions have a resolution of ~10ms. To increase the confidence # of the results, the caller can specify a min threshold for the trend difference. @@ -215,9 +215,7 @@ def get_trends_data(stats_data) -> list[BreakpointData]: ] filtered_trending_functions_count = all_trending_functions_count - len(trending_functions) - set_measurement( - "profiling.top_functions.below_threshold", filtered_trending_functions_count - ) + set_span_data("profiling.top_functions.below_threshold", filtered_trending_functions_count) # Make sure to sort the results so that it's in order of largest change # to smallest change (ASC/DESC depends on the trend type) diff --git a/src/sentry/api/endpoints/organization_tags.py b/src/sentry/api/endpoints/organization_tags.py index df040ecf4a2c19..4fd7c20c293840 100644 --- a/src/sentry/api/endpoints/organization_tags.py +++ b/src/sentry/api/endpoints/organization_tags.py @@ -15,7 +15,7 @@ from sentry.api.utils import clamp_date_range, handle_query_errors from sentry.snuba.dataset import Dataset from sentry.utils.numbers import format_grouped_length -from sentry.utils.sdk import set_measurement +from sentry.utils.sdk import set_span_data @region_silo_endpoint @@ -83,6 +83,6 @@ def get(self, request: Request, organization) -> Response: format_grouped_length(len(results), [1, 10, 50, 100]), ) sentry_sdk.set_tag("dataset_queried", dataset.value) - set_measurement("custom_tags.count", len(results)) + set_span_data("custom_tags.count", len(results)) return Response(serialize(results, request.user)) diff --git a/src/sentry/api/endpoints/organization_traces.py b/src/sentry/api/endpoints/organization_traces.py index 76e4e8dd2bc2ad..3acc5e84504fd1 100644 --- a/src/sentry/api/endpoints/organization_traces.py +++ b/src/sentry/api/endpoints/organization_traces.py @@ -49,7 +49,7 @@ from sentry.snuba.dataset import Dataset from sentry.snuba.referrer import Referrer from sentry.utils.numbers import clip -from sentry.utils.sdk import set_measurement +from sentry.utils.sdk import set_span_data from sentry.utils.snuba import bulk_snuba_queries_with_referrers from sentry.utils.snuba_rpc import get_traces_rpc @@ -1417,7 +1417,7 @@ def process_user_queries( where, _ = resolve_conditions(user_query) queries[user_query] = where - set_measurement("user_queries_count", len(queries)) + set_span_data("user_queries_count", len(queries)) sentry_sdk.set_context("user_queries", {"raw_queries": user_queries}) return queries @@ -1452,7 +1452,7 @@ def process_rpc_user_queries( if where is not None: queries[user_query] = where - set_measurement("user_queries_count", len(queries)) + set_span_data("user_queries_count", len(queries)) sentry_sdk.set_context("user_queries", {"raw_queries": user_queries}) return queries diff --git a/src/sentry/api/utils.py b/src/sentry/api/utils.py index f58aa1498e2a1e..c87ed5d8a0e808 100644 --- a/src/sentry/api/utils.py +++ b/src/sentry/api/utils.py @@ -44,7 +44,7 @@ from sentry.silo.base import SiloMode from sentry.types.region import get_local_region from sentry.utils.dates import parse_stats_period -from sentry.utils.sdk import capture_exception, merge_context_into_scope +from sentry.utils.sdk import capture_exception, merge_context_into_scope, set_span_data from sentry.utils.snuba import ( DatasetSelectionError, QueryConnectionFailed, @@ -454,7 +454,7 @@ def update_snuba_params_with_timestamp( # While possible, the majority of traces shouldn't take more than a week # Starting with 3d for now, but potentially something we can increase if this becomes a problem time_buffer = options.get("performance.traces.transaction_query_timebuffer_days") - sentry_sdk.set_measurement("trace_view.transactions.time_buffer", time_buffer) + set_span_data("trace_view.transactions.time_buffer", time_buffer) example_start = example_timestamp - timedelta(days=time_buffer) example_end = example_timestamp + timedelta(days=time_buffer) # If timestamp is being passed it should always overwrite the statsperiod or start & end diff --git a/src/sentry/event_manager.py b/src/sentry/event_manager.py index efc24684732325..957ed8b6636913 100644 --- a/src/sentry/event_manager.py +++ b/src/sentry/event_manager.py @@ -137,7 +137,7 @@ from sentry.utils.performance_issues.performance_detection import detect_performance_problems from sentry.utils.performance_issues.performance_problem import PerformanceProblem from sentry.utils.safe import get_path, safe_execute, setdefault_path, trim -from sentry.utils.sdk import set_measurement +from sentry.utils.sdk import set_span_data from sentry.utils.tag_normalization import normalized_sdk_tag_from_event from .utils.event_tracker import TransactionStageStatus, track_sampled_event @@ -2587,9 +2587,8 @@ def save_transaction_events( ) except KeyError: continue - - set_measurement(measurement_name="jobs", value=len(jobs)) - set_measurement(measurement_name="projects", value=len(projects)) + set_span_data("jobs", len(jobs)) + set_span_data("projects", len(projects)) # NOTE: Keep this list synchronized with sentry/spans/consumers/process_segments/message.py diff --git a/src/sentry/ingest/transaction_clusterer/rules.py b/src/sentry/ingest/transaction_clusterer/rules.py index ee3612079a952c..901694971dd7da 100644 --- a/src/sentry/ingest/transaction_clusterer/rules.py +++ b/src/sentry/ingest/transaction_clusterer/rules.py @@ -9,6 +9,7 @@ from sentry.ingest.transaction_clusterer.rule_validator import RuleValidator from sentry.models.project import Project from sentry.utils import metrics +from sentry.utils.sdk import set_span_data from .base import ReplacementRule @@ -145,7 +146,7 @@ def _trim_rules(self, rules: RuleSet) -> RuleSet: sorted_rules = [rule for rule in sorted_rules if rule[1] >= last_seen_deadline] if self.MERGE_MAX_RULES < len(rules): - sentry_sdk.set_measurement("discarded_rules", len(rules) - self.MERGE_MAX_RULES) + set_span_data("discarded_rules", len(rules) - self.MERGE_MAX_RULES) sentry_sdk.Scope.get_isolation_scope().set_context( "clustering_rules_max", { diff --git a/src/sentry/models/release.py b/src/sentry/models/release.py index f6e32329b9135f..342f3a75d3f27f 100644 --- a/src/sentry/models/release.py +++ b/src/sentry/models/release.py @@ -45,6 +45,7 @@ from sentry.utils.db import atomic_transaction from sentry.utils.hashlib import hash_values, md5_text from sentry.utils.numbers import validate_bigint +from sentry.utils.sdk import set_span_data logger = logging.getLogger(__name__) @@ -644,7 +645,8 @@ def set_commits(self, commit_list): This will clear any existing commit log and replace it with the given commits. """ - sentry_sdk.set_measurement("release.set_commits", len(commit_list)) + set_span_data("release.set_commits", len(commit_list)) + from sentry.models.releases.set_commits import set_commits set_commits(self, commit_list) diff --git a/src/sentry/profiles/task.py b/src/sentry/profiles/task.py index bb62ca665743ea..63f0e3903195f4 100644 --- a/src/sentry/profiles/task.py +++ b/src/sentry/profiles/task.py @@ -53,7 +53,7 @@ from sentry.utils.kafka_config import get_kafka_producer_cluster_options, get_topic_definition from sentry.utils.locking import UnableToAcquireLock from sentry.utils.outcomes import Outcome, track_outcome -from sentry.utils.sdk import set_measurement +from sentry.utils.sdk import set_span_data REVERSE_DEVICE_CLASS = {next(iter(tags)): label for label, tags in DEVICE_CLASS.items()} @@ -223,10 +223,9 @@ def process_profile_task( if "version" in profile: version = profile["version"] sentry_sdk.set_tag("format", f"sample_v{version}") - - set_measurement("profile.samples", len(profile["profile"]["samples"])) - set_measurement("profile.stacks", len(profile["profile"]["stacks"])) - set_measurement("profile.frames", len(profile["profile"]["frames"])) + set_span_data("profile.samples", len(profile["profile"]["samples"])) + set_span_data("profile.stacks", len(profile["profile"]["stacks"])) + set_span_data("profile.frames", len(profile["profile"]["frames"])) elif "profiler_id" in profile and profile["platform"] == "android": sentry_sdk.set_tag("format", "android_chunk") else: @@ -252,9 +251,9 @@ def process_profile_task( _set_frames_platform(profile) if "version" in profile: - set_measurement("profile.samples.processed", len(profile["profile"]["samples"])) - set_measurement("profile.stacks.processed", len(profile["profile"]["stacks"])) - set_measurement("profile.frames.processed", len(profile["profile"]["frames"])) + set_span_data("profile.samples.processed", len(profile["profile"]["samples"])) + set_span_data("profile.stacks.processed", len(profile["profile"]["stacks"])) + set_span_data("profile.frames.processed", len(profile["profile"]["frames"])) if options.get("profiling.stack_trace_rules.enabled"): try: @@ -372,8 +371,7 @@ def _symbolicate_profile(profile: Profile, project: Project) -> bool: raw_modules, raw_stacktraces, frames_sent = _prepare_frames_from_profile( profile, platform ) - - set_measurement( + set_span_data( f"profile.frames.sent.{platform}", len(frames_sent), ) diff --git a/src/sentry/profiles/utils.py b/src/sentry/profiles/utils.py index 5e30d7568e8e38..0287f9453e4592 100644 --- a/src/sentry/profiles/utils.py +++ b/src/sentry/profiles/utils.py @@ -15,7 +15,7 @@ from sentry.grouping.enhancer import Enhancements, keep_profiling_rules from sentry.net.http import connection_from_url from sentry.utils import json, metrics -from sentry.utils.sdk import set_measurement +from sentry.utils.sdk import set_span_data Profile = MutableMapping[str, Any] CallTrees = Mapping[str, list[Any]] @@ -113,8 +113,7 @@ def get_from_profiling_service( ) with sentry_sdk.start_span(op="json.dumps"): data = json.dumps(json_data).encode("utf-8") - - set_measurement("payload.size", len(data), unit="byte") + set_span_data("payload.size", len(data)) if metric: metric_name, metric_tags = metric metrics.distribution(metric_name, len(data), tags=metric_tags) diff --git a/src/sentry/search/events/fields.py b/src/sentry/search/events/fields.py index 4ff424046c7c38..2467bc20fddafb 100644 --- a/src/sentry/search/events/fields.py +++ b/src/sentry/search/events/fields.py @@ -47,7 +47,7 @@ from sentry.search.events.types import NormalizedArg, ParamsType from sentry.search.utils import InvalidQuery, parse_duration from sentry.utils.numbers import format_grouped_length -from sentry.utils.sdk import set_measurement +from sentry.utils.sdk import set_span_data from sentry.utils.snuba import ( SESSIONS_SNUBA_MAP, get_json_type, @@ -135,7 +135,7 @@ def project_threshold_config_expression( "project_threshold.count.grouped", format_grouped_length(num_project_thresholds, [10, 100, 250, 500]), ) - set_measurement("project_threshold.count", num_project_thresholds) + set_span_data("project_threshold.count", num_project_thresholds) num_transaction_thresholds = transaction_threshold_configs.count() sentry_sdk.set_tag("txn_threshold.count", num_transaction_thresholds) @@ -143,7 +143,7 @@ def project_threshold_config_expression( "txn_threshold.count.grouped", format_grouped_length(num_transaction_thresholds, [10, 100, 250, 500]), ) - set_measurement("txn_threshold.count", num_transaction_thresholds) + set_span_data("txn_threshold.count", num_transaction_thresholds) if num_project_thresholds + num_transaction_thresholds == 0: return ["tuple", [f"'{DEFAULT_PROJECT_THRESHOLD_METRIC}'", DEFAULT_PROJECT_THRESHOLD]] @@ -283,7 +283,7 @@ def team_key_transaction_expression(organization_id, team_ids, project_ids): sentry_sdk.set_tag( "team_key_txns.count.grouped", format_grouped_length(count, [10, 100, 250, 500]) ) - set_measurement("team_key_txns.count", count) + set_span_data("team_key_txns.count", count) # There are no team key transactions marked, so hard code false into the query. if count == 0: diff --git a/src/sentry/sentry_metrics/consumers/indexer/processing.py b/src/sentry/sentry_metrics/consumers/indexer/processing.py index 4a72736ff4886e..43b04ad8a5cb25 100644 --- a/src/sentry/sentry_metrics/consumers/indexer/processing.py +++ b/src/sentry/sentry_metrics/consumers/indexer/processing.py @@ -23,7 +23,8 @@ from sentry.sentry_metrics.indexer.base import StringIndexer from sentry.sentry_metrics.indexer.mock import MockIndexer from sentry.sentry_metrics.indexer.postgres.postgres_v2 import PostgresIndexer -from sentry.utils import metrics, sdk +from sentry.utils import metrics +from sentry.utils.sdk import set_span_data logger = logging.getLogger(__name__) @@ -123,12 +124,11 @@ def _process_messages_impl( tags_validator=self.__get_tags_validator(), schema_validator=self.__get_schema_validator(), ) - - sdk.set_measurement("indexer_batch.payloads.len", len(batch.parsed_payloads_by_meta)) + set_span_data("indexer_batch.payloads.len", len(batch.parsed_payloads_by_meta)) extracted_strings = batch.extract_strings() - sdk.set_measurement("org_strings.len", len(extracted_strings)) + set_span_data("org_strings.len", len(extracted_strings)) with metrics.timer("metrics_consumer.bulk_record"), sentry_sdk.start_span(op="bulk_record"): record_result = self._indexer.bulk_record(extracted_strings) @@ -138,6 +138,6 @@ def _process_messages_impl( results = batch.reconstruct_messages(mapping, bulk_record_meta) - sdk.set_measurement("new_messages.len", len(results.data)) + set_span_data("new_messages.len", len(results.data)) return results diff --git a/src/sentry/snuba/rpc_dataset_common.py b/src/sentry/snuba/rpc_dataset_common.py index a0f72f1df24ea7..7251afae6dcc8c 100644 --- a/src/sentry/snuba/rpc_dataset_common.py +++ b/src/sentry/snuba/rpc_dataset_common.py @@ -31,6 +31,7 @@ from sentry.search.events.fields import get_function_alias from sentry.search.events.types import SAMPLING_MODES, EventsMeta, SnubaData, SnubaParams from sentry.utils import json, snuba_rpc +from sentry.utils.sdk import set_span_data from sentry.utils.snuba import process_value logger = logging.getLogger("sentry.snuba.spans_rpc") @@ -313,9 +314,7 @@ def process_table_response( assert len(column_value.results) == len(column_value.reliabilities), Exception( "Length of rpc results do not match length of rpc reliabilities" ) - sentry_sdk.set_measurement( - f"SearchResolver.result_size.{attribute}", len(column_value.results) - ) + set_span_data(f"SearchResolver.result_size.{attribute}", len(column_value.results)) while len(final_data) < len(column_value.results): final_data.append({}) @@ -333,7 +332,7 @@ def process_table_response( final_confidence[index][attribute] = CONFIDENCES.get( column_value.reliabilities[index], None ) - sentry_sdk.set_measurement("SearchResolver.result_size.final_data", len(final_data)) + set_span_data("SearchResolver.result_size.final_data", len(final_data)) if debug: final_meta["query"] = json.loads(MessageToJson(table_request.rpc_request)) diff --git a/src/sentry/utils/pagination_factory.py b/src/sentry/utils/pagination_factory.py index 0fcf2839e7b599..7c59c0a96546bf 100644 --- a/src/sentry/utils/pagination_factory.py +++ b/src/sentry/utils/pagination_factory.py @@ -67,9 +67,6 @@ def get_paginator( def annotate_span_with_pagination_args(span: Span, per_page: int) -> None: - from sentry.utils.sdk import set_measurement - span.set_data("Limit", per_page) - set_measurement("query.per_page", per_page) sentry_sdk.set_tag("query.per_page", per_page) sentry_sdk.set_tag("query.per_page.grouped", format_grouped_length(per_page, [1, 10, 50, 100])) diff --git a/src/sentry/utils/sdk.py b/src/sentry/utils/sdk.py index 278cffd88af1f9..5078ab47237053 100644 --- a/src/sentry/utils/sdk.py +++ b/src/sentry/utils/sdk.py @@ -704,6 +704,12 @@ def set_measurement(measurement_name, value, unit=None): pass +def set_span_data(data_name, value): + span = sentry_sdk.get_current_span() + if span is not None: + span.set_data(data_name, value) + + def merge_context_into_scope( context_name: str, context_data: Mapping[str, Any], scope: Scope ) -> None: diff --git a/src/sentry/utils/snuba.py b/src/sentry/utils/snuba.py index db2600c4649619..d112d1e3902668 100644 --- a/src/sentry/utils/snuba.py +++ b/src/sentry/utils/snuba.py @@ -1208,7 +1208,7 @@ def _bulk_snuba_query(snuba_requests: Sequence[SnubaRequest]) -> ResultSet: allocation_policy_prefix = "allocation_policy." bytes_scanned = body.get("profile", {}).get("progress_bytes", None) if bytes_scanned is not None: - span.set_measurement(f"{allocation_policy_prefix}.bytes_scanned", bytes_scanned) + span.set_data(f"{allocation_policy_prefix}.bytes_scanned", bytes_scanned) if _is_rejected_query(body): quota_allowance_summary = body["quota_allowance"]["summary"] for k, v in quota_allowance_summary.items():