pub struct TelemetryEventData {
pub command: String,
pub action: String,
pub message: String,
pub error_type: Option<String>,
pub error_handled: bool,
pub values: HashMap<String, Value>,
pub time: DateTime<Utc>,
pub module: Option<String>,
pub file: Option<String>,
pub line: Option<u32>,
pub column: Option<u32>,
pub stack_frames: Vec<StackFrame>,
}Expand description
An event’s data, corresponding roughly to data collected from an individual trace.
This can be something like a build, bundle, translate, etc We collect the phases of the build in a list of events to get a better sense of how long it took.
Note that this is just the data and does not include the reporter information.
On the analytics, side, we reconstruct the trace messages into a sequence of events, using the stage as a marker.
If the event contains a stack trace, it is considered a crash event and will be sent to the crash reporting service.
We store this type on disk without the reporter information or any information about the CLI.
Fields§
§command: StringThe name of the command that was run, e.g. “dx build”, “dx bundle”, “dx serve”
action: StringThe action that was taken, e.g. “build”, “bundle”, “cli_invoked”, “cli_crashed” etc
message: StringAn additional message to include in the event, e.g. “start”, “end”, “error”, etc
error_type: Option<String>The “name” of the error. In our case, usually“ “RustError” or “RustPanic”. In other languages this might be the exception type. In Rust, this is usually the name of the error type. (e.g. “std::io::Error”, etc)
error_handled: boolWhether the event was handled or not. Unhandled errors are the default, but some we recover from (like hotpatching issues).
values: HashMap<String, Value>Additional values to include in the event, e.g. “duration”, “enabled”, etc.
time: DateTime<Utc>Timestamp of the event, in UTC, derived from the user’s system time. Might not be reliable.
module: Option<String>The module where the event occurred, stripped of paths for privacy.
file: Option<String>The file or module where the event occurred, stripped of paths for privacy, relative to the monorepo root.
line: Option<u32>The line and column where the event occurred, if applicable.
column: Option<u32>The column where the event occurred, if applicable.
stack_frames: Vec<StackFrame>The stack frames of the event, if applicable.
Implementations§
Source§impl TelemetryEventData
impl TelemetryEventData
pub fn new(name: impl ToString, message: impl ToString) -> Self
pub fn with_value<K: ToString, V: Serialize>(self, key: K, value: V) -> Self
pub fn with_module(self, module: impl ToString) -> Self
pub fn with_file(self, file: impl ToString) -> Self
pub fn with_line_column(self, line: u32, column: u32) -> Self
pub fn with_error_handled(self, error_handled: bool) -> Self
pub fn with_error_type(self, error_type: String) -> Self
pub fn with_stack_frames(self, stack_frames: Vec<StackFrame>) -> Self
pub fn with_values(self, fields: Map<String, Value>) -> Self
pub fn to_json(&self) -> Value
Trait Implementations§
Source§impl Clone for TelemetryEventData
impl Clone for TelemetryEventData
Source§fn clone(&self) -> TelemetryEventData
fn clone(&self) -> TelemetryEventData
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TelemetryEventData
impl Debug for TelemetryEventData
Source§impl<'de> Deserialize<'de> for TelemetryEventData
impl<'de> Deserialize<'de> for TelemetryEventData
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TelemetryEventData
Display implementation for TelemetryEventData, such that you can use it in tracing macros with the “%” syntax.
impl Display for TelemetryEventData
Display implementation for TelemetryEventData, such that you can use it in tracing macros with the “%” syntax.