Documentation for automated readers
A curated documentation index is available at: https://grafana.com/llms.txt
A complete documentation index is available at: https://grafana.com/llms-full.txt
These indexes can help with page discovery before fetching individual documents.
This page is also available in Markdown, which may be easier for automated readers and AI tools to parse than HTML. The Markdown version is available at https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/instrument/faro-react/component-profiler.md, or by sending Accept: text/markdown to https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/instrument/faro-react/component-profiler/. For broader documentation discovery, the curated index is available at https://grafana.com/llms.txt and the complete index is available at https://grafana.com/llms-full.txt.
React component profiling
Follow this guide to setup and use the Faro Profiler to get insights into the render performance of a React components.
Warning
Using the profiler has an impact on performance and should not be used in production.
To use the Faro profiler, import the Faro web-tracing package and initialize Faro-React as follows:
import { matchRoutes } from 'react-router-dom';
import { getWebInstrumentations, initializeFaro } from '@grafana/faro-react';
import { TracingInstrumentation } from '@grafana/faro-web-tracing';
initializeFaro({
// Mandatory, the URL of the Grafana collector
url: 'my/collector/url',
// Mandatory, the identification label of your application
app: {
name: 'my-react-app',
},
instrumentations: [
// Load the default Web instrumentations
...getWebInstrumentations(),
// Tracing Instrumentation is needed if you want to use the React Profiler
new TracingInstrumentation(),
// ...
],
});import { withFaroProfiler } from '@grafana/faro-react';
export default withFaroProfiler(MyReactComponent);Was this page helpful?
Related resources from Grafana Labs


