Skip to main content
This page is unlisted and can only be accessed directly via URL. It is excluded from the site navigation and search results.

App performance monitoring

Use Retool's performance monitoring integration to send page load and query traces to Datadog or Sentry. Once enabled, you can view detailed performance information that helps provide context on potential performance issues on which you can improve.

Queries and page loads that occur while editing an app are not reported.

If you don't use Datadog or Sentry, reach out to iva@retool.com or your account team and let us know which provider(s) you use.

1. Configure observability provider

Perform the following steps to configure your chosen observability provider.

To configure Datadog:

  1. Create a Datadog pipeline to consume traces. Retool spans will stream from service:retool_performance_monitoring.
  2. Create a Datadog API key to use in the next step. Note your organization's Datadog Site.
  3. Contact your Datadog account manager for access to the Datadog OTLP Traces Intake Endpoint, which is in preview.

2. Connect providers to Retool

Next, configure your Retool organization to connect to your observability provider. You can configure the connection by either:

  • Navigating to Settings > Observability.
  • Using the Retool API to programmatically configure observability provider connections.

Configure the API key setting with the Datadog API key you created in the previous step. Make sure you specify the correct Datadog Site

Traces

Retool sends traces to Sentry and Datadog, where they appear in the form of a flame graph. Traces are primarily made up of query spans. A query span includes raw query duration and the time that Retool takes to process the result and update the app model. Child spans are included only if they take longer than 10 ms.

  • For resource queries, the raw query duration measures the time spent retrieving the result from an external service.
  • For JavaScript queries, the raw query duration measures the time spent executing the code (including waiting on async functions called from JavaScript).

Refer to the Query best practices documentation for more information on how to optimize your queries. Retool provides traces in the following categories:

Page initialization

Page initialization traces show how your app performs from initial page load until all initialization queries are completed. Page initialization is broken down into the following metrics:

  • Init: Time from when the app is opened to when all queries that were triggered on load have completed or the end of Time to Productivity, whichever is longest.
  • Time to First Query (TTFQ): Time from when the app is opened to when the first query is run. Can be affected by app size, number of plugins, and complexity of custom Javascript.
  • Time to Productivity (TTP): Time from when the first query is run to when the first long task (longer than 50 ms) has been completed. This is a proxy for when the app is ready to interact.

The rest of the span shows traces of initialization queries and any dependent queries.

Page navigation traces show how your app performs when switching pages. Page navigation is broken down into the following metrics:

  • Time to First Query (TTFQ): Time from when the user initiates a page transition to when the first query on the new page runs.
  • updatePreloadedJS: Time to run the preloaded JS of the items on the new page. Subset of TTFQ.
  • batchedUpdateTemplate: Time to load the components on the page. Subset of TTFQ.
  • Time to Productivity (TTP): Time from when the first query is run to when the first long task (longer than 50 ms) has been completed. This is a proxy for when the page is ready to interact.

This trace also includes the previousPage and currentPage attributes, which help identify the pages that the user navigated between.

User interaction

User interaction traces are triggered when a user performs an action, such as clicking a Button or typing into a Text Input, that triggers query runs.

Query subspans

Query subspans are portions of the query run that show a breakdown of what the different actions Retool takes when executing a query.

MetricDefinition
PrepareMeasures the time to calculate all query inputs, format them, and send requests to the Retool backend.
BackendFor resource queries only. Measures the time to execute the query and transfer data to and from the Retool backend. This usually makes up the majority of the query duration.
Response handlingMeasures the time to handle the raw query response by downloading a file containing query data, or uploading a file to a cloud provider (as in S3 and GCS queries).
FrontendFor JavaScript queries, parentWindow queries, and Query JSON with SQL. Measures the duration of the JavaScript function. This usually makes up the majority of the query duration.
TransformerIf the query transforms data, measures the time to transform the data.
Post-processingMeasures the time for Retool to process the data and update the app state.

Tags

Retool provides tags on traces and individual spans to provide additional context around the conditions that generated a specific measurement.

Trace tags

TagDefinitionExample
appNameThe name of the app.Pets
appUuidThe app identifier.16423e12-eef4-11ef-b170-eb7362451ab0
browserThe browser type.chrome
browserVersionThe browser version.133.0.0
environmentThe app environment.production
osThe host operating system.Mac OS
releaseThe Retool version.3.165.0
traceTypeThe type of action the trace represents.init
urlThe page URL.http://localhost:3000/apps/16423e12-eef4-11ef-b170-eb7362451ab0/Pets/page1
userThe user info.username:Alex Wang
viewModeThe app view mode.presentation

Span tags

TagContextExample
appNameThe name of the app.Store Manager
appTemplatePluginsThe number of components.22 (number)
currentPageThe current page.franchises
dbconnectortimeThe time to execute resource on backend.600.00ms
isEmbeddedWhether the app is embedded.false
isFirstPageLoadWhether the user navigated to the page directly.true
javaScriptLinksThe number of pre-loaded JS queries.3 (number)
operationThe type of action the span represents.pageload
previousPageThe previous page.home
queryIdThe query identifier.dogAPI
queryParamsThe additional query parameters.{}
resourceIdThe resource identifier.92c3cbec-bf16-4872-a859-2a8975dd4cf3
resourceTypeThe type of resource.restapi
responsesizeThe query response size.3.1 KiB
servedFromCacheWhether the result was served from a cache.false
statusThe query completion status.Success
traceTypeThe type of action the trace represents.init
truncatedWhether the trace ended before the span could complete.false

Troubleshooting performance monitoring metrics

Use the recommendations in this section to address issues that you identify with your app performance. Refer to the web app best practices and query best practices guides for more general recommendations.

Time to First Query (TTFQ)

Most of the TTFQ value can be attributed to Retool's initialization process, but there are some areas where the app itself can affect load times. To improve your TTFQ metric, Retool recommends investigating the following spans:

SpanRecommendations
generateDependencyGraph
  • This reflects how long it took for Retool to initialize the app’s dependency graph. If this span is long, consider reducing the number of app plugins across all pages.
  • You can also simplify complex and deep dependency chains by pulling logic from components into JavaScript queries, calculating iterative values only once, and removing nested modules and containers.
  • Complex modules should be used sparingly as they can quickly bloat the dependency graph. It is better to use a module once and populate the data dynamically rather than reusing a module multiple times with different data.
fetchScriptsThis reflects the time spent running your org’s pre-loaded JavaScript. If this span is long, consider reducing complexity or removing unnecessary functions in pre-loaded JavaScript.

Time to Productivity (TTP)

To improve your TTP metric, Retool recommends investigating the following:

  • Identify the bottleneck query: Look for the query or query chain in the flamegraph that extends TTP the furthest. Reducing the run time of this query or its downstream events will shorten TTP.
  • Find opportunities to parallelize queries: If a chain of queries is extending TTP, consider re-architecting the app to run more queries in parallel.

Query run times

To improve your query run times, Retool recommends investigating the following:

  • Consider whether the query needed to run: By default, many queries run on page load or when referenced values change. If the query was not needed at the time it ran, you could modify your query’s run behavior to be more controlled.
  • Use the run time breakdown: If a lot of time is spent on the backend, this suggests the query itself needs to be more performant. If a lot of time is spent on the frontend, this suggests that the dependencies downstream of the query need to be simplified.
  • Look at query response size: A large payload slows down both backend and frontend processing. Modify the query or use pagination to reduce response size.
  • Check the servedFromCache tag: If the query hasn’t been cached yet and the app doesn’t need immediate data updates, consider caching the query.