posthog icon indicating copy to clipboard operation
posthog copied to clipboard

Add a column configurator to the tracing table (custom span attribute columns)

Open jonmcwest opened this issue 2 months ago • 1 comments

Is your feature request related to a problem?

The tracing span table has a fixed set of columns. Spans carry arbitrary OTel span and resource attributes, but there is no way to put one of those attributes on screen as a column. Users who want to scan a list of spans by a domain-specific attribute (tenant, model, region, endpoint, queue, etc.) must open each span in the drawer, one at a time, or leave the product and write SQL.

Logs already solved this. Users move between the two products and expect the same control.

Describe the solution you'd like

A column configurator for the tracing table, modelled on the logs one:

  • Reorder, add, remove and resize columns.
  • Built-in columns from a registry (timestamp, service, operation, duration, status, trace ID, span ID, person, session, …), the same shape as LOGS_COLUMN_REGISTRY.
  • Custom attribute columns: a source-prefixed shorthand (attributes.<key>, resource_attributes.<key>) or a scalar HogQL expression, resolved server-side and only fetched while the column is on screen — the customColumns mechanism in LogsQuery.
  • Attribute-key autocomplete from the existing tracing attribute-key endpoint, so users do not have to remember key names.
  • Persist the column set per user, and store it on a saved TracingView so a shared view carries its columns.

Reference implementation (logs)

  • products/logs/frontend/components/LogsViewer/config/columns.ts — column types, registry, customColumns contract, normalization.
  • products/logs/frontend/components/LogsViewer/config/LogsColumnConfigurator.tsx and logsColumnConfiguratorLogic.ts — the UI and its kea logic.
  • products/logs/frontend/components/LogsViewer/config/logsViewerConfigLogic.ts — persistence.
  • products/logs/backend/logs_query_runner.py + column_expressions.py and products/logs/backend/test/test_custom_columns.py — server-side expression handling and its guardrails.

Where it lands in tracing

  • products/tracing/frontend/VirtualizedTable.tsx already carries a VirtualizedTableColumn<T> contract that deliberately mirrors logs' VirtualizedTableColumn, with resizing via components/TableColumns/useResizableColumns. The two were written with the intent of converging on a shared lib/ primitive — this is a good moment to do that rather than fork a third copy of the configurator.
  • Backend: products/tracing/backend/logic.py (TraceSpansQueryRunner) needs the equivalent of customColumns — a validated, scalar-only expression list.
  • TracingView in products/tracing/backend/models.py needs a column field.

Describe alternatives you've considered

  • Adding a couple more fixed columns: does not help, because the attributes people care about are their own.
  • Sending them to SQL: works, but loses the filter rail, the waterfall and the drawer.

Additional context

Requested through in-product survey feedback on the tracing product.

jonmcwest avatar Sep 10 '26 14:09 jonmcwest

This is now available: the tracing span table has a column configurator where you can add span or resource attributes as columns. Closing as done, thanks for the request.

darkopia avatar Nov 29 '26 15:11 darkopia