TelemetryEventData

Struct TelemetryEventData 

Source
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: String

The name of the command that was run, e.g. “dx build”, “dx bundle”, “dx serve”

§action: String

The action that was taken, e.g. “build”, “bundle”, “cli_invoked”, “cli_crashed” etc

§message: String

An 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: bool

Whether 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

Source

pub fn new(name: impl ToString, message: impl ToString) -> Self

Source

pub fn with_value<K: ToString, V: Serialize>(self, key: K, value: V) -> Self

Source

pub fn with_module(self, module: impl ToString) -> Self

Source

pub fn with_file(self, file: impl ToString) -> Self

Source

pub fn with_line_column(self, line: u32, column: u32) -> Self

Source

pub fn with_error_handled(self, error_handled: bool) -> Self

Source

pub fn with_error_type(self, error_type: String) -> Self

Source

pub fn with_stack_frames(self, stack_frames: Vec<StackFrame>) -> Self

Source

pub fn with_values(self, fields: Map<String, Value>) -> Self

Source

pub fn to_json(&self) -> Value

Trait Implementations§

Source§

impl Clone for TelemetryEventData

Source§

fn clone(&self) -> TelemetryEventData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TelemetryEventData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TelemetryEventData

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for TelemetryEventData

Display implementation for TelemetryEventData, such that you can use it in tracing macros with the “%” syntax.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for TelemetryEventData

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,