Tinkex.Telemetry.Reporter.Serializer (Tinkex v0.3.4)
View SourceEvent serialization and sanitization for telemetry.
Handles:
- Converting typed event structs to wire format maps
- Sanitizing data for JSON serialization (atoms to strings, etc)
- Platform detection
Summary
Functions
Build a telemetry request payload from events and state.
Convert a typed event struct to a wire format map.
Get the platform string (os_type/os_flavor).
Sanitize a value for JSON serialization.
Functions
Build a telemetry request payload from events and state.
Returns a map with session_id, platform, sdk_version, and serialized events.
Convert a typed event struct to a wire format map.
Delegates to the appropriate to_map/1 function based on event type.
@spec platform() :: String.t()
Get the platform string (os_type/os_flavor).
Example: "unix/linux"
Sanitize a value for JSON serialization.
Converts:
- Structs to maps (via Map.from_struct)
- Atoms to strings
- Lists recursively
- Maps recursively (keys and values)
- Numbers, binaries, booleans, nil - pass through
- Everything else - inspect