TelemetryEvent v2 is the canonical event format for tracker exports.
Schema file:
docs/schemas/telemetry_event_v2.schema.jsonRequired fields
All v2 telemetry events must include the following fields:schema_version(must be2)timestamp_ns- Timestamp in nanosecondsevent_type- Type of event (e.g., “sample”, “checkpoint”)collector- Collector identifiersampling_interval_ms- Sampling interval in millisecondspid- Process IDhost- Hostnamedevice_id- Device identifierallocator_allocated_bytes- Bytes allocated by the allocatorallocator_reserved_bytes- Bytes reserved by the allocatorallocator_active_bytes- Active bytes (nullable)allocator_inactive_bytes- Inactive bytes (nullable)allocator_change_bytes- Change in allocationdevice_used_bytes- Bytes used on devicedevice_free_bytes- Free bytes on device (nullable)device_total_bytes- Total bytes on device (nullable)context- Context information (nullable)metadata- Additional metadata (must be a JSON object)
Collector values
The following collector identifiers are used:gpumemprof.cuda_tracker- CUDA device trackergpumemprof.rocm_tracker- ROCm device trackergpumemprof.mps_tracker- Apple MPS trackergpumemprof.cpu_tracker- CPU fallback trackertfmemprof.memory_tracker- TensorFlow memory tracker
Backend capability metadata
Tracker exports may include backend capability hints undermetadata:
backend- Backend type (e.g., “cuda”, “rocm”, “mps”, “cpu”)supports_device_total- Whether total device memory is availablesupports_device_free- Whether free device memory is availablesampling_source- Source of memory samples
JSON schema definition
Legacy v1 to v2 conversion
Conversion is permissive by default ingpumemprof.telemetry.telemetry_event_from_record. Legacy conversion is attempted only when schema_version is absent.
Version handling
Ifschema_version is present:
- It must be an integer
- It must be exactly
2 - Any other value is rejected (no legacy fallback)
Default values for legacy records
When converting legacy records (withoutschema_version), the following defaults are applied:
| Field | Default Value |
|---|---|
pid | -1 (if missing) |
host | "unknown" (if missing) |
device_id | Inferred from device if possible, otherwise -1 |
allocator_reserved_bytes | allocator_allocated_bytes |
allocator_change_bytes | 0 |
device_used_bytes | allocator_allocated_bytes |
device_total_bytes | null (if missing) |
device_free_bytes | null (if missing) |
event_type | type field if present, else "sample" |
metadata | Legacy metadata_* fields folded into v2 metadata object |
If a legacy record is missing a valid timestamp, conversion fails.
Python API
Use the public conversion/validation helpers ingpumemprof.telemetry:
Loading events from JSON
path- Path to JSON file containing telemetry eventspermissive_legacy- Allow legacy record conversion (default:True)events_key- Optional key for events in JSON object (auto-detected ifNone)
Converting individual records
Validating records
Serializing events
Example usage
See also
- Architecture - System architecture overview
- Compatibility - Framework and platform compatibility