Global Attributes
Global attributes are automatically attached to all telemetry data (spans, logs, events) throughout your application. These provide essential context about the device, OS, app, and environment.
How Global Attributes Work
Global attributes appear in two places within telemetry payloads:
attributesobject - Session, network, screen, and custom React Native attributesresourcesobject - Device, OS, app, and SDK information from the native platform
All these attributes are automatically collected by the SDK and included with every piece of telemetry.
Automatic Attributes
The following attributes are automatically included in all telemetry:
Device Information
| Attribute | Description | Example |
|---|---|---|
device.manufacturer | Device manufacturer | "Google", "Samsung" |
device.model.name | Device model name | "Pixel 7", "Galaxy S23" |
device.model.identifier | Device model identifier | "sdk_gphone64_arm64" |
Operating System
| Attribute | Description | Example |
|---|---|---|
os.name | Operating system name | "Android" |
os.type | OS type | "linux" |
os.version | OS version | "16", "13" |
os.description | Full OS description | "BE2A.250530.026.D1" |
android.os.api_level | Android API level | "36", "33" |
Application
| Attribute | Description | Example |
|---|---|---|
service.name | Application name | "MyApp" |
service.version | App version with build | "1.0_123" |
app.build_name | App build name | "1.0_1" |
app.build_id | App build ID | "123" |
SDK Information
| Attribute | Description | Example |
|---|---|---|
rum.sdk.version | Pulse SDK version | "0.16.0-alpha" |
telemetry.sdk.name | Telemetry SDK name | "opentelemetry" |
telemetry.sdk.language | SDK language | "java" |
telemetry.sdk.version | OpenTelemetry version | "1.54.1" |
Network
| Attribute | Description | Example |
|---|---|---|
network.connection.type | Connection type | "cell", "wifi" |
network.carrier.name | Mobile carrier | "T-Mobile", "Verizon" |
network.carrier.mcc | Mobile country code | "310" |
network.carrier.mnc | Mobile network code | "260" |
network.carrier.icc | ISO country code | "us" |
Session & Screen
| Attribute | Description | Example |
|---|---|---|
session.id | Unique session ID | "dce09977c69b0a5c15aa5fd01f817514" |
screen.name | Current screen/activity | "MainActivity", "ScreenStackFragment" |
Note: These attributes are automatically collected by the native platform SDK and cannot be modified from React Native. To customize native global attributes, see the Android SDK configuration.
Custom Global Attributes
Add your own global attributes that will be included in all telemetry:
import { Pulse } from '@horizoneng/pulse-react-native';
// Set custom attributes
Pulse.setGlobalAttribute('environment', 'production');
Pulse.setGlobalAttribute('releaseChannel', 'beta');
Pulse.setGlobalAttribute('featureFlags', 'new-checkout,dark-mode');
Once set, these attributes are automatically included in all subsequent spans, events, and logs.
Common Use Cases
Environment Information:
Pulse.setGlobalAttribute('environment', __DEV__ ? 'development' : 'production');
Pulse.setGlobalAttribute('releaseChannel', 'production'); // or 'beta', 'staging'
Build Metadata:
import DeviceInfo from 'react-native-device-info';
Pulse.setGlobalAttribute('appVersion', DeviceInfo.getVersion());
Pulse.setGlobalAttribute('buildNumber', DeviceInfo.getBuildNumber());
Feature Flags:
Pulse.setGlobalAttribute('darkModeEnabled', true);
Pulse.setGlobalAttribute('experimentalFeatures', 'checkout-v2,payments-v3');
User Segments:
Pulse.setGlobalAttribute('userTier', 'premium');
Pulse.setGlobalAttribute('region', 'north-america');
Attribute Priority
Event-specific attributes override global attributes when keys conflict:
Pulse.setGlobalAttribute('environment', 'production');
// This event's 'environment' will be 'staging', not 'production'
Pulse.trackEvent('test_event', {
environment: 'staging'
});
Scope
React Native Telemetry: Custom global attributes set via setGlobalAttribute() apply to all telemetry originating from React Native (events, custom spans, manual error reports).
Native Android Telemetry: Native events (ANR, frozen frames, activity lifecycle) automatically include the device, OS, and app attributes listed above, but not custom attributes set from React Native. To set global attributes for native telemetry, see Android Global Attributes.
Related
- User Identification - Associate telemetry with specific users
- CodePush Tracking - Track OTA deployment versions