Navigation Instrumentation
Generates: Spans
Tracks screen navigation and route changes when using React Navigation.
Setup
Navigation instrumentation requires React Navigation v5.x or higher. The SDK currently supports:
- Stack Navigator - JavaScript-based stack navigation
- Native Stack Navigator - Native platform navigation
Register the navigation container to start tracking:
import { NavigationContainer } from '@react-navigation/native';
import { Pulse } from '@horizoneng/pulse-react-native';
const navigationIntegration = Pulse.createNavigationIntegration();
function App() {
return (
<NavigationContainer
onReady={(ref) => navigationIntegration.registerNavigationContainer(ref)}
>
{/* Your screens */}
</NavigationContainer>
);
}
Configuration
Navigation instrumentation is enabled by default. You can disable it if needed:
Pulse.start({
autoDetectNavigation: true // Enabled by default
});
When autoDetectNavigation: false, navigation spans are not automatically tracked. No spans are created for screen transitions.
Generated Telemetry
Type: Span
Span Name: Navigated
Span Kind: INTERNAL
Attributes
Navigation-Specific Attributes
| Attribute | Description | Example | Always Present |
|---|---|---|---|
pulse.type | Instrumentation type | "screen_load" | ✅ Yes |
screen.name | Current screen name | "DetailsHome", "DetailsInfo" | ✅ Yes |
last.screen.name | Previous screen name | "DetailsInfo", "DetailsHome" | ⚠️ Only if previous screen exists |
routeHasBeenSeen | Whether route was visited before | true, false | ✅ Yes |
routeKey | Unique route identifier | "DetailsHome-Oht5epi34smXv9IlxNggQ" | ✅ Yes |
phase | Navigation phase | "start" | ✅ Yes |
platform | React Native platform | "react-native" | ✅ Yes |
Note: The
screen.nameattribute in navigation spans refers to the React Native screen name, whilescreen.namein global attributes refers to the native Android activity.
Sample Payload: First Visit to Screen
{
"name": "Navigated",
"kind": "INTERNAL",
"startTimeUnixNano": "1732737006000000000",
"endTimeUnixNano": "1732737006014440000",
"duration": "14.44ms",
"attributes": {
"pulse.type": "screen_load",
"screen.name": "DetailsInfo",
"last.screen.name": "DetailsHome",
"routeHasBeenSeen": false,
"routeKey": "DetailsInfo-z46JYmBeWWnsPCJU4H7A8",
"phase": "start",
"platform": "react-native",
"session.id": "dce09977c69b0a5c15aa5fd01f817514"
}
}
Sample Payload: Returning to Screen
{
"name": "Navigated",
"kind": "INTERNAL",
"startTimeUnixNano": "1732737007000000000",
"endTimeUnixNano": "1732737007007270000",
"duration": "7.27ms",
"attributes": {
"pulse.type": "screen_load",
"screen.name": "DetailsHome",
"last.screen.name": "DetailsInfo",
"routeHasBeenSeen": true,
"routeKey": "DetailsHome-Oht5epi34smXv9IlxNggQ",
"phase": "start",
"platform": "react-native",
"session.id": "dce09977c69b0a5c15aa5fd01f817514"
}
}
Note: All navigation spans include global attributes (service, device, OS, session, network carrier, etc.). See Global Attributes for complete list.