View a markdown version of this page

Go from a trace to a profile - Amazon CloudWatch

Go from a trace to a profile

A trace tells you which request was slow. A profile tells you which functions ran during it. To go from a trace to a profile, open the trace, choose Analyze, and then choose Analyze profiles. What happens next depends on whether the service's profiles are linked to the trace:

  • The profiles are linked to the trace -- Omni opens Explore profiles for that trace, so the flame graph shows only the samples recorded during it.

  • The profiles aren't linked to the trace -- Omni asks the Omni agent to analyze the service's profiles over the time window of the trace, and shows the answer in the chat.

Omni doesn't show a span heatmap or trace exemplars. To find the costliest spans across a time window, use the query API. See Find costly spans with a heatmap and trace exemplars.

What span-linked profiles require

Opening the profiles for a single trace requires the profiler to record the trace context, meaning the trace ID and span ID, with each sample. Not every profiler does.

  • The ADOT Java agent records trace context. Version 2.32.0 or later, with the profiler turned on (OTEL_AWS_PROFILER_ENABLED=true) and tracing enabled, marks request-boundary spans while it samples. Samples from sampled traces carry a link to the trace and span. For how to run it, see Publish profile data to Amazon CloudWatch.

  • async-profiler and the OpenTelemetry eBPF profiler do not. Their samples have no trace or span IDs. Their profiles still appear in Omni and you can still read them per service; but Omni can't link them to a single trace.

Because the link is recorded only for traces that tracing sampled, a span can be slow and still have no profile samples of its own. In that case, Omni asks the Omni agent to analyze the service's profiles for the trace's time window instead.

Span-level profile data in the API

For span-linked profiles, the query API returns the distribution of profile values across spans, with example trace IDs and span IDs. Use it when you want to find the costliest spans across a window rather than start from one trace you already have. See Find costly spans with a heatmap and trace exemplars.