Before you start
You need two things:- A network integration in place, so requests are reported as resources. See Flutter Network Tracking.
- Your backend services instrumented with Application Monitoring, so there is a trace to link to.
List your first party hosts
Tracing headers are only added to hosts you name. SetfirstPartyHosts on your configuration:
api.example.com also matches beta.api.example.com. Wildcards, schemes, paths, and regular expressions are not supported. Use bare domain names.
Requests to hosts that are not listed are still reported as RUM resources. They just do not carry tracing headers, so they cannot be joined to a backend trace.
Choose which headers are sent
By default, each host infirstPartyHosts receives two header formats: the Atatus headers and W3C trace context. That covers both an Atatus backend agent and any service that reads standard traceparent headers.
To control the formats per host, use firstPartyHostsWithTracingHeaders instead:
The
baggage header carries the RUM session ID, and the user and account IDs when you have set them, so your backend can attribute a trace to the same person.
Setting
firstPartyHosts replaces anything already in firstPartyHostsWithTracingHeaders. Use one or the other, not both.Control how much is traced
Two options decide whether a request carries tracing headers:
Set them on your RUM configuration:
traceContextInjection decides what happens to the requests sampling dropped:
sampled, the default, writes no tracing headers on a dropped request.allstill writes the headers, with the sampling flag set to0. Your backend then sees the trace and can apply its own sampling decision.
Group requests into one trace
By default each request is its own trace. To tie several requests together as one operation, start a trace, make the requests, then stop it:Always call
stopTrace(). A trace left open keeps attaching later requests to it, including ones from a different screen.Check whether a host is traced
Two helpers let you check the configuration at runtime, which is useful when debugging a request that is not joining its trace:What lands on the resource
A traced resource carries these attributes, which are what the backend uses to join the two sides:
A request that sampling dropped keeps
_atatus.rule_psr but carries no trace or span ID.
Troubleshooting
If a request is reported as a resource but never joins a backend trace, work through these in order:- Confirm the host is listed in
firstPartyHosts, exactly, with no scheme or path. Check it withisFirstPartyHost. - Raise
traceSampleRateto100.0while testing, so sampling is not hiding the problem. - Confirm the backend service is instrumented and reads one of the header formats you send.
- Check that your own
HttpOverridesare installed before Atatus is initialized. See the warning in Flutter Network Tracking.
Next steps
- Add a network integration in Flutter Network Tracking.
- Configure the rest of the agent in Flutter Agent Configuration Options.