pub struct Data<D>where
D: DiagnosticsData,{
pub data_source: DataSource,
pub metadata: <D as DiagnosticsData>::Metadata,
pub moniker: ExtendedMoniker,
pub payload: Option<DiagnosticsHierarchy<<D as DiagnosticsData>::Key>>,
pub version: u64,
}
Expand description
An instance of diagnostics data with typed metadata and an optional nested payload.
Fields§
§data_source: DataSource
The source of the data.
metadata: <D as DiagnosticsData>::Metadata
The metadata for the diagnostics payload.
moniker: ExtendedMoniker
Moniker of the component that generated the payload.
payload: Option<DiagnosticsHierarchy<<D as DiagnosticsData>::Key>>
Payload containing diagnostics data, if the payload exists, else None.
version: u64
Schema version.
Implementations§
Source§impl<D> Data<D>where
D: DiagnosticsData,
impl<D> Data<D>where
D: DiagnosticsData,
Sourcepub fn drop_payload(&mut self)
pub fn drop_payload(&mut self)
Returns a Data
with an error indicating that the payload was dropped.
Sourcepub fn sort_payload(&mut self)
pub fn sort_payload(&mut self)
Sorts this Data
’s payload if one is present.
Source§impl Data<Logs>
impl Data<Logs>
Sourcepub fn for_logs(
moniker: ExtendedMoniker,
payload: Option<DiagnosticsHierarchy<LogsField>>,
timestamp: impl Into<Instant<BootTimeline>>,
component_url: Option<FlyStr>,
severity: impl Into<Severity>,
errors: Vec<LogError>,
) -> Data<Logs>
pub fn for_logs( moniker: ExtendedMoniker, payload: Option<DiagnosticsHierarchy<LogsField>>, timestamp: impl Into<Instant<BootTimeline>>, component_url: Option<FlyStr>, severity: impl Into<Severity>, errors: Vec<LogError>, ) -> Data<Logs>
Creates a new data instance for logs.
Sourcepub fn set_raw_severity(&mut self, raw_severity: u8)
pub fn set_raw_severity(&mut self, raw_severity: u8)
Sets the severity from a raw severity number. Overrides the severity to match the raw severity.
Sourcepub fn set_severity(&mut self, severity: Severity)
pub fn set_severity(&mut self, severity: Severity)
Sets the severity of the log. This will unset the raw severity.
Sourcepub fn msg(&self) -> Option<&str>
pub fn msg(&self) -> Option<&str>
Returns the string log associated with the message, if one exists.
Sourcepub fn msg_mut(&mut self) -> Option<&mut String>
pub fn msg_mut(&mut self) -> Option<&mut String>
If the log has a message, returns a shared reference to the message contents.
Sourcepub fn payload_message(&self) -> Option<&DiagnosticsHierarchy<LogsField>>
pub fn payload_message(&self) -> Option<&DiagnosticsHierarchy<LogsField>>
If the log has message, returns an exclusive reference to it.
Sourcepub fn payload_keys(&self) -> Option<&DiagnosticsHierarchy<LogsField>>
pub fn payload_keys(&self) -> Option<&DiagnosticsHierarchy<LogsField>>
If the log has structured keys, returns an exclusive reference to them.
Sourcepub fn payload_keys_strings(&self) -> Box<dyn Iterator<Item = String> + '_>
pub fn payload_keys_strings(&self) -> Box<dyn Iterator<Item = String> + '_>
Returns an iterator over the payload keys as strings with the format “key=value”.
Sourcepub fn payload_message_mut(
&mut self,
) -> Option<&mut DiagnosticsHierarchy<LogsField>>
pub fn payload_message_mut( &mut self, ) -> Option<&mut DiagnosticsHierarchy<LogsField>>
If the log has a message, returns a mutable reference to it.
Sourcepub fn file_path(&self) -> Option<&str>
pub fn file_path(&self) -> Option<&str>
Returns the file path associated with the message, if one exists.
Sourcepub fn line_number(&self) -> Option<&u64>
pub fn line_number(&self) -> Option<&u64>
Returns the line number associated with the message, if one exists.
Returns the tags associated with the message, if any exist.
Sourcepub fn dropped_logs(&self) -> Option<u64>
pub fn dropped_logs(&self) -> Option<u64>
Returns number of dropped logs if reported in the message.
Sourcepub fn rolled_out_logs(&self) -> Option<u64>
pub fn rolled_out_logs(&self) -> Option<u64>
Returns number of rolled out logs if reported in the message.
Sourcepub fn component_name(&self) -> Cow<'_, str>
pub fn component_name(&self) -> Cow<'_, str>
Returns the component nam. This only makes sense for v1 components.
Trait Implementations§
Source§impl<D: DiagnosticsData> CheckResponse for Data<D>
impl<D: DiagnosticsData> CheckResponse for Data<D>
fn has_payload(&self) -> bool
Source§impl<D> Clone for Data<D>where
D: Clone + DiagnosticsData,
<D as DiagnosticsData>::Metadata: Clone,
<D as DiagnosticsData>::Key: Clone,
impl<D> Clone for Data<D>where
D: Clone + DiagnosticsData,
<D as DiagnosticsData>::Metadata: Clone,
<D as DiagnosticsData>::Key: Clone,
Source§impl<D> Debug for Data<D>where
D: Debug + DiagnosticsData,
<D as DiagnosticsData>::Metadata: Debug,
<D as DiagnosticsData>::Key: Debug,
impl<D> Debug for Data<D>where
D: Debug + DiagnosticsData,
<D as DiagnosticsData>::Metadata: Debug,
<D as DiagnosticsData>::Key: Debug,
Source§impl<'de, D> Deserialize<'de> for Data<D>
impl<'de, D> Deserialize<'de> for Data<D>
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Data<D>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Data<D>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Ord for Data<Logs>
impl Ord for Data<Logs>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<D> PartialEq for Data<D>where
D: PartialEq + DiagnosticsData,
<D as DiagnosticsData>::Metadata: PartialEq,
<D as DiagnosticsData>::Key: PartialEq,
impl<D> PartialEq for Data<D>where
D: PartialEq + DiagnosticsData,
<D as DiagnosticsData>::Metadata: PartialEq,
<D as DiagnosticsData>::Key: PartialEq,
Source§impl PartialOrd for Data<Logs>
impl PartialOrd for Data<Logs>
Source§impl<D> Serialize for Data<D>
impl<D> Serialize for Data<D>
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Data<Logs>
impl<D> StructuralPartialEq for Data<D>where
D: DiagnosticsData,
Auto Trait Implementations§
impl<D> Freeze for Data<D>
impl<D> RefUnwindSafe for Data<D>
impl<D> Send for Data<D>
impl<D> Sync for Data<D>
impl<D> Unpin for Data<D>
impl<D> UnwindSafe for Data<D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)