Global Attributes
Global attributes are automatically attached to all telemetry data (events, errors, spans) throughout your application's lifecycle.
Automatic Attributes
The Pulse Android SDK automatically includes the following attributes in all telemetry:
Device Information
device.model.name- Device model name (e.g., "Pixel 7")device.model.identifier- Device model identifierdevice.manufacturer- Device manufacturer (e.g., "Google")
Operating System
os.name- Always "Android"os.type- Always "linux"os.version- Android version (e.g., "13")os.description- Full OS descriptionos.api_level- Android API level
Service Information
service.name- Application name (from AndroidManifest)service.version- App version (e.g., "1.0.0_123")rum.sdk.version- Pulse SDK version
Network Information
Network attributes are automatically added when network monitoring is enabled:
network.connection.type- Connection type (e.g., "wifi", "cellular")network.connection.subtype- Connection subtype (e.g., "LTE", "5G") - requires permissionnetwork.carrier.name- Carrier name (e.g., "Verizon") - requires permissionnetwork.carrier.mcc- Mobile country code - requires permissionnetwork.carrier.mnc- Mobile network code - requires permissionnetwork.carrier.icc- ISO country code - requires permission
Note: To get detailed network information (subtype, carrier name, etc.), add
READ_PHONE_STATEorREAD_BASIC_PHONE_STATE(API 33+) permission to yourAndroidManifest.xml.
Session Information
session.id- Unique session identifier
Custom Global Attributes
You can add custom global attributes that will be merged with the automatic attributes:
PulseSDK.INSTANCE.initialize(
application = this,
endpointBaseUrl = "https://your-backend.com",
globalAttributes = {
Attributes.builder()
.put("deployment.environment", "production")
.put("service.version", BuildConfig.VERSION_NAME)
.put("device.type", "mobile")
.build()
}
)
Note: Custom global attributes are merged with automatic attributes. Event/span-specific attributes override global attributes when keys conflict.
Practical Example
Set global attributes during SDK initialization:
PulseSDK.INSTANCE.initialize(
application = this,
endpointBaseUrl = "https://your-backend.com",
globalAttributes = {
Attributes.builder()
.put("deployment.environment", if (BuildConfig.DEBUG) "development" else "production")
.put("app.build.type", BuildConfig.BUILD_TYPE)
.put("app.version.code", BuildConfig.VERSION_CODE.toString())
.put("app.version.name", BuildConfig.VERSION_NAME)
.build()
}
)
Attribute Priority
Event/span-specific attributes override global attributes when keys conflict:
// Global attribute
PulseSDK.INSTANCE.initialize(
application = this,
endpointBaseUrl = "https://your-backend.com",
globalAttributes = {
Attributes.of(AttributeKey.stringKey("environment"), "production")
}
)
// This event's 'environment' will be 'staging'
PulseSDK.INSTANCE.trackEvent(
name = "test",
observedTimeStampInMs = System.currentTimeMillis(),
params = mapOf("environment" to "staging")
)
Best Practices
- Set global attributes during initialization: Set static metadata (app version, environment, etc.) once during SDK initialization
- Use for static metadata: Global attributes are ideal for information that doesn't change during the session
- Avoid sensitive data: Don't include PII (Personally Identifiable Information) in global attributes
Common Use Cases for Custom Attributes
- Environment flags: Distinguish between development, staging, and production
- Build metadata: Include build type, version code, and version name
- Feature flags: Track which features are enabled
- Deployment information: Add deployment-specific context
- Custom metadata: Add any application-specific context
Note: Device and OS information are already automatically included, so you don't need to set them manually.
Next Steps
- Learn about User Identification to associate telemetry with users
- Review the API Reference for complete method documentation