From 1d3c8e31bf60b25c3f4f368b66d7ba172c9fc50d Mon Sep 17 00:00:00 2001 From: Kev Date: Tue, 14 Oct 2025 12:58:10 -0400 Subject: [PATCH] fix(eap): Span fields should hide internal Span fields should probably be eventually removed, but for the time being we still shouldn't show hidden attribute names --- src/sentry/api/endpoints/organization_spans_fields.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/sentry/api/endpoints/organization_spans_fields.py b/src/sentry/api/endpoints/organization_spans_fields.py index bf53da68595246..259496d1d69f2a 100644 --- a/src/sentry/api/endpoints/organization_spans_fields.py +++ b/src/sentry/api/endpoints/organization_spans_fields.py @@ -22,12 +22,14 @@ from sentry.api.paginator import ChainPaginator from sentry.api.serializers import serialize from sentry.api.utils import handle_query_errors +from sentry.auth.staff import is_active_staff +from sentry.auth.superuser import is_active_superuser from sentry.models.organization import Organization from sentry.search.eap import constants from sentry.search.eap.resolver import SearchResolver from sentry.search.eap.spans.definitions import SPAN_DEFINITIONS from sentry.search.eap.types import SearchResolverConfig, SupportedTraceItemType -from sentry.search.eap.utils import translate_internal_to_public_alias +from sentry.search.eap.utils import can_expose_attribute, translate_internal_to_public_alias from sentry.search.events.types import SnubaParams from sentry.snuba.referrer import Referrer from sentry.tagstore.types import TagValue @@ -118,12 +120,19 @@ def get(self, request: Request, organization: Organization) -> Response: rpc_response = snuba_rpc.attribute_names_rpc(rpc_request) + include_internal = is_active_superuser(request) or is_active_staff(request) + paginator = ChainPaginator( [ [ as_tag_key(attribute.name, serialized["type"]) for attribute in rpc_response.attributes if attribute.name + and can_expose_attribute( + attribute.name, + SupportedTraceItemType.SPANS, + include_internal=include_internal, + ) ], ], max_limit=max_span_tags,