Skip to content

[APM] Error group details: 500 "Missing required fields (transaction.sampled)" → infinite loading #254262

@jennypavlova

Description

@jennypavlova

Summary

When opening an error sample on the APM error group details page (e.g. kibana-frontend > Errors > error group), the request to load the error sample can fail with 500 and message "Missing required fields (transaction.sampled) in event". The UI then shows "Error while fetching resource" and an infinite loading spinner instead of the error details.

Environment

  • Observed on error group details with labels.error_type: "PageFatalReactError" (and likely other groups when the related transaction lacks the field).
  • URL pattern: .../internal/apm/services/{serviceName}/errors/{groupId}/error/{errorId}?...

Root cause

  1. The error sample API fetches the error document, then loads the related transaction (when transactionId and traceId exist) via getTransaction.
  2. getTransaction uses requireFields with a list that includes transaction.sampled. If the transaction document in Elasticsearch does not contain transaction.sampled (e.g. RUM, OpenTelemetry, or unsampled transactions), ensureRequiredApmFields throws Error('Missing required fields (transaction.sampled) in event') → 500.
  3. The frontend then shows the error toast and never finishes loading the sample (infinite spinner).

Why the field can be missing

  • Not all agents or ingestion paths set transaction.sampled.
  • OpenTelemetry and RUM, or older agents, may not populate it.
  • Requiring it for the error-details flow is stricter than necessary: we can still display the error and transaction context when the field is absent.

Suggested fix

  • In get_transaction/index.ts: remove TRANSACTION_SAMPLED from requiredFields so that transaction documents without this field are still returned.
  • When building the response, treat transaction.sampled as optional (e.g. omit or set to undefined when missing) so the API contract remains valid. Downstream UI and types already handle optional sampled in other contexts (e.g. event_raw has sampled?: boolean).

This allows the error group details page to load without 500 when the related transaction does not have transaction.sampled, avoiding the infinite loading spinner.

AC:

  • Error details page should load even if the transaction.sampled is not present/undefined
  • The UI should not show an error if the transaction.sampled is not present/undefined
  • The spinner should not show in case of an error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Team:obs-presentationFocus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left NavigationbugFixes for quality problems that affect the customer experience

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions