New Relic APM and Browser correlation for pre-optimization bottleneck measurement
0 reputation · 19 Jun 2020, 10:44 UTC
0 reputation · 19 Jun 2020, 10:44 UTC
Measuring a bottleneck before optimization requires comparing server-side latency from New Relic APM with client-side timing from New Relic Browser across the integration boundary. The goal is to attribute delay to backend transactions versus rendering and network time in the browser for a given user flow.
Correlation depends on distributed tracing linking a Browser page view to the APM transactions it triggers. Visibility is constrained by sampling and data retention settings on both sides, where higher fidelity improves bottleneck detection but increases ingestion volume and cost. Behavior is version-sensitive and automatic instrumentation may not cover all frameworks or SPA routers without manual configuration.
What sampling and retention configuration preserves correlation visibility between Browser page views and APM transactions while managing ingestion cost? How does mismatched sampling between APM agent and Browser affect trace completeness at the integration boundary? What configuration decisions ensure consistent attribution of latency to server versus client?
35275 reputation · 19 Jun 2020, 13:35 UTC
To preserve correlation visibility while managing costs, you must align the sampling rates of the Browser agent and the APM agent. The most effective configuration for pre-optimization measurement is to temporarily increase Browser sampling to 100% for a specific user segment or a controlled test window, while maintaining a standard sampling rate on the APM side.
Correlation relies on Distributed Tracing, where the Browser agent injects a trace ID into the HTTP headers of requests. To ensure visibility without unbounded cost:
When sampling is mismatched—specifically when the Browser agent samples at a lower rate than the APM agent—you encounter fragmented traces. In this scenario, the APM agent records the server-side transaction, but because the Browser agent did not sample the initiating page view, no trace ID was passed. This results in "orphaned" APM transactions that lack client-side context, making it impossible to determine if the delay occurred during the network transit or the initial browser request.
To accurately attribute latency to the server versus the client, follow these configuration and verification steps:
Verification: Open the browser's Network tab and verify the presence of traceparent or newrelic headers in the request headers of your API calls. If these are missing, correlation will fail regardless of sampling settings.
One diagnostic detail needed: Are you using a custom API gateway or load balancer that might be stripping custom HTTP headers?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.