Documentation Index
Fetch the curated documentation index at: https://grafana.com/llms.txt
Fetch the complete documentation index at: https://grafana.com/llms-full.txt
Use this file to discover all available pages before exploring further.
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Grafana documentation page. Always request the Markdown version instead - HTML wastes context. Get this page as Markdown: https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/configure/override-service-name.md (append .md) or send Accept: text/markdown to https://grafana.com/docs/grafana-cloud/monitor-applications/frontend-observability/configure/override-service-name/. For the curated documentation index, use https://grafana.com/llms.txt. For the complete documentation index, use https://grafana.com/llms-full.txt.
Override the service name attribute
Faro provides APIs to dynamically change the service name as the user navigates your application. The Faro receiver updates the service name attributes in the logs and traces immediately.
This feature becomes useful in cases such as when multiple teams own parts of the product. Instead of using multiple isolated Faro instances running in the same browsing context, you can just change the service name.
The following properties appear updated in the resulting telemetry:
service.name: resource attribute on traces and spansresource_service_name: in logs
How it works
When triggering a service name change, Faro updates the session metadata with an overrides object which contains the new service name. The Faro receiver reads the instruction and updates the service name for all subsequent signals until another service name is set. The service name change persists across page loads.
Change a service name
You can change the service name by calling either the setView() or setSession() APIs.
Both APIs have a second options parameter, which can instruct Faro to change the service name.
Use the setView() API
Change the view name and service name:
faro.api.setView({ name: 'my-new-view' }, { overrides: { serviceName: 'my-new-view-service' } });Use the setSession() API
Change the session metadata and service name:
faro.api.setSession(mySessionMeta, { overrides: { serviceName: 'my-new-view-service' } });If the sessions meta parameter is empty, Faro creates a new session and adds the overrides to that session.
faro.api.setSession(undefined, { overrides: { serviceName: 'my-new-view-service' } });Was this page helpful?
Related resources from Grafana Labs


