Skip to content

feat(occurrences on eap): Make organization trace item stats API endpoint generic over trace item type#112889

Open
shashjar wants to merge 1 commit intoshashjar/implement-stats-query-occurrences-eap-rpcfrom
shashjar/make-organization-trace-item-stats-api-endpoint-generic-over-trace-item-type
Open

feat(occurrences on eap): Make organization trace item stats API endpoint generic over trace item type#112889
shashjar wants to merge 1 commit intoshashjar/implement-stats-query-occurrences-eap-rpcfrom
shashjar/make-organization-trace-item-stats-api-endpoint-generic-over-trace-item-type

Conversation

@shashjar
Copy link
Copy Markdown
Member

@shashjar shashjar commented Apr 13, 2026

Follow-up to #112878. Second of two backend PRs to support attribute breakdowns for occurrences in Explore.

  • Adds itemType query parameter to the /trace-items/stats/ endpoint, supporting "spans" (default) and "occurrences"
  • Introduces TraceItemStatsConfig dataclass and get_trace_item_stats_config() dispatcher to route queries to the correct RPC class, definitions, alias mappings, excluded attributes, referrer, and ID column based on item type
  • Renames spansLimit query parameter to traceItemsLimit (safe because frontend is not currently passing this query param)
  • Adds attributes, max_buckets, & skip_translate_internal_to_public_alias to RPCBase.run_stats_query() base class signature to match the interfaces used in the subclasses (Spans / Occurrences)

search_resolver: SearchResolver | None = None,
attributes: list[AttributeKey] | None = None,
max_buckets: int = 75,
skip_translate_internal_to_public_alias: bool = False,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Diff here because the RPC base class was missing some arguments from its interface

required=False,
)
spansLimit = serializers.IntegerField(required=False, default=1000, max_value=1000)
traceItemsLimit = serializers.IntegerField(required=False, default=1000, max_value=1000)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think renaming spansLimit -> traceItemsLimit is safe since the frontend doesn't currently pass the query param at all

@shashjar shashjar requested review from a team April 14, 2026 00:06
@shashjar shashjar marked this pull request as ready for review April 14, 2026 00:06
@shashjar shashjar requested review from a team as code owners April 14, 2026 00:06
@shashjar shashjar removed request for a team April 14, 2026 00:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant