|
36 | 36 | from sentry.snuba.referrer import Referrer |
37 | 37 | from sentry.utils.iterators import chunked |
38 | 38 | from sentry.utils.numbers import base32_encode, format_grouped_length |
39 | | -from sentry.utils.sdk import set_measurement |
| 39 | +from sentry.utils.sdk import set_span_data |
40 | 40 | from sentry.utils.snuba import bulk_snuba_queries |
41 | 41 | from sentry.utils.validators import INVALID_ID_DETAILS, is_event_id, is_span_id |
42 | 42 |
|
@@ -761,7 +761,7 @@ def build_span_query(trace_id: str, spans_params: SnubaParams, query_spans: list |
761 | 761 | # Performance improvement, snuba's parser is extremely slow when we're sending thousands of |
762 | 762 | # span_ids here, using a `splitByChar` means that snuba will not parse the giant list of spans |
763 | 763 | span_minimum = options.get("performance.traces.span_query_minimum_spans") |
764 | | - sentry_sdk.set_measurement("trace_view.spans.span_minimum", span_minimum) |
| 764 | + set_span_data("trace_view.spans.span_minimum", span_minimum) |
765 | 765 | sentry_sdk.set_tag("trace_view.split_by_char.optimization", len(query_spans) > span_minimum) |
766 | 766 | if len(query_spans) > span_minimum: |
767 | 767 | # 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( |
813 | 813 | projects.add(error["project.id"]) |
814 | 814 | ts_params = find_timestamp_params(transactions) |
815 | 815 | time_buffer = options.get("performance.traces.span_query_timebuffer_hours") |
816 | | - sentry_sdk.set_measurement("trace_view.spans.time_buffer", time_buffer) |
| 816 | + set_span_data("trace_view.spans.time_buffer", time_buffer) |
817 | 817 | if ts_params["min"]: |
818 | 818 | params.start = ts_params["min"] - timedelta(hours=time_buffer) |
819 | 819 | if ts_params["max"]: |
820 | 820 | params.end = ts_params["max"] + timedelta(hours=time_buffer) |
821 | 821 |
|
822 | 822 | if ts_params["max"] and ts_params["min"]: |
823 | | - sentry_sdk.set_measurement( |
| 823 | + set_span_data( |
824 | 824 | "trace_view.trace_duration", (ts_params["max"] - ts_params["min"]).total_seconds() |
825 | 825 | ) |
826 | 826 | sentry_sdk.set_tag("trace_view.missing_timestamp_constraints", False) |
@@ -899,7 +899,7 @@ def augment_transactions_with_spans( |
899 | 899 | total_chunks = 3 |
900 | 900 | else: |
901 | 901 | total_chunks = 4 |
902 | | - sentry_sdk.set_measurement("trace_view.span_query.total_chunks", total_chunks) |
| 902 | + set_span_data("trace_view.span_query.total_chunks", total_chunks) |
903 | 903 | chunks = chunked(list_spans, (len(list_spans) // total_chunks) + 1) |
904 | 904 | queries = [build_span_query(trace_id, spans_params, chunk) for chunk in chunks] |
905 | 905 | results = bulk_snuba_queries( |
@@ -1046,15 +1046,16 @@ def record_analytics( |
1046 | 1046 | sentry_sdk.set_tag( |
1047 | 1047 | "trace_view.transactions.grouped", format_grouped_length(len_transactions) |
1048 | 1048 | ) |
1049 | | - set_measurement("trace_view.transactions", len_transactions) |
| 1049 | + set_span_data("trace_view.transactions", len_transactions) |
| 1050 | + |
1050 | 1051 | projects: set[int] = set() |
1051 | 1052 | for transaction in transactions: |
1052 | 1053 | projects.add(transaction["project.id"]) |
1053 | 1054 |
|
1054 | 1055 | len_projects = len(projects) |
1055 | 1056 | sentry_sdk.set_tag("trace_view.projects", len_projects) |
1056 | 1057 | sentry_sdk.set_tag("trace_view.projects.grouped", format_grouped_length(len_projects)) |
1057 | | - set_measurement("trace_view.projects", len_projects) |
| 1058 | + set_span_data("trace_view.projects", len_projects) |
1058 | 1059 |
|
1059 | 1060 | def get(self, request: Request, organization: Organization, trace_id: str) -> HttpResponse: |
1060 | 1061 | if not self.has_feature(organization, request): |
|
0 commit comments