Spans

edit

Spans contain information about a specific code path that has been executed. They measure from the start to end of an activity, and they can have a parent/child relationship with other spans.

Agents automatically instrument a variety of libraries to capture these spans from within your application. In addition, you can use the Agent API for ad hoc instrumentation of specific code paths.

A span contains:

  • A transaction.id attribute that refers to their parent transaction.
  • A parent.id attribute that refers to their parent span, or their transaction.
  • start time and duration
  • name
  • type
  • stack trace (optional)

Most agents limit keyword fields (e.g. span.id) to 1024 characters, and non-keyword fields (e.g. span.start.us) to 10,000 characters.

Spans are stored in span indices. Note that these indices are separate from transaction indices by default.

Dropped Spans

edit

For performance reasons, some APM agents can choose to purposefully sample or omit spans. One example of this might be for long running transactions with over 100 spans. These edge cases can overload both the agent and the APM Server. To avoid this, agents will drop spans. When they do this, they notify the server of exactly how many spans were dropped. This note is then passed on to the user in the UI.

Settings affecting dropped spans, and more details on why they might occur, are available in the relevant agent documentation:

Missing Spans

edit

Similarly to dropped spans, transactions may have missing spans. This can happen because spans are streamed from the APM Agent to the APM Server separately from their transaction. Unforseen errors may cause spans to go missing. Because the agent notifies the server about how many spans there should be, the number of missing spans is able to be calculated and shown in the UI.