Tracing | Rasa Documentation

Build your first agent in just a few minutes with Rasa Copilot.

On this page

Distributed tracing tracks requests as they flow through a distributed system (in this case: a Rasa assistant), sending data about the requests to a tracing backend which collects all trace data and enables inspecting it. Trace data helps you understand the flow of requests through both the components of a single service (Rasa itself), and across different distributed services, for example, your action server.

Supported Tracing Backends/Collectors

To trace requests in Rasa, you can either use Jaeger as a backend, or use the OTEL Collector (OpenTelemetry Collector). to collect traces and then send them to the backend of your choice. See Configuring a Tracing Backend or Collector for instructions.

Rasa Channels

Trace context sent along with requests using the W3C Trace Context Specification via the REST channel is used to continue tracing in Rasa.

Rasa Inspector

If you have enabled tracing in Rasa and are using the Rasa Inspector debugging tool to try your assistant, note that in addition to the expected tracing span for the Agent.handle_message method call, the tracing backend will collect independent tracing spans for the MessageProcessor.get_tracker method calls. This is expected behaviour because the Rasa Inspector tool uses the Rasa HTTP API endpoints to retrieve the conversation tracker which is required by the Inspector interface.

Action Server

The trace context from Rasa is sent along with requests to the custom action server using the W3C Trace Context Specification and then used to continue tracing the request through the custom action server.

Tracing is continued in the action server by instrumenting the webhook that receives custom actions. See Action server attributes for the attributes captured as part of the trace context.

See traced events for details on what attributes are made available as part of the trace context in Rasa.

Questions Tracing Can Help Answer

Tracing can help troubleshoot issues in development and production, by answering questions such as:

Configuring a Tracing Backend or Collector

To configure a tracing backend or collector, add a tracing entry to your endpoints i.e. in your endpoints.yml file, or in the relevant section of your Helm values in a deployment.

Enabling tracing activates Rasa's instrumentation layer. That layer also records Observability Metrics. If you configure a metrics block in your endpoints file, you must also enable tracing or no metric measurements will be collected.

Jaeger

To configure a Jaeger tracing backend, specify the type as jaeger.

endpoints.yml

tracing:
  type: jaeger
  host: localhost
  port: 4317
  service_name: rasa
  sync_export: ~

OTEL Collector

Collectors are components that collect traces in a vendor-agnostic way and then forward them to various backends. For example, the OpenTelemetry Collector (OTEL) can collect traces from multiple different components and instrumentation libraries, and then export them to multiple different backends e.g. jaeger.

To configure an OTEL Collector, specify the type as otlp.

endpoints.yml

tracing:
  type: otlp
  endpoint: my-otlp-host:4317
  insecure: false
  service_name: rasa
  root_certificates: ./tests/unit/tracing/fixtures/ca.pem

Traced Events

The Rasa service areas that are traceable cover the actions required to:

Model Training

Tracing is enabled for model training by instrumenting Rasa GraphTrainer and GraphNode classes.

GraphTrainer Attributes

The following attributes can be inspected during training of GraphTrainer:

GraphNode Attributes

The following attributes are captured during the training (as well as prediction during message handling) of every graph node:

Message Handling

The following Rasa classes are instrumented to enable tracing during message handling:

In addition, the following Python modules were instrumented to enable tracing during message handling:

Namely, these operations are now traceable:

Tracing in the Action Server

API Requests are traced as they flow through the action server by instrumenting the webhook that receives custom actions and other classes involved in the execution of custom actions.

Webhook Attributes

The following attributes are captured as part of the trace context of the webhook that receives custom actions;