Struct appinsights::telemetry::RemoteDependencyTelemetry
source · [−]pub struct RemoteDependencyTelemetry { /* private fields */ }
Expand description
Represents interactions of the monitored component with a remote component/service like SQL or an HTTP endpoint.
Examples
use appinsights::telemetry::{Telemetry, RemoteDependencyTelemetry};
use std::time::Duration;
// create a telemetry item
let mut telemetry = RemoteDependencyTelemetry::new(
"GET https://api.github.com/dmolokanov/appinsights-rs",
"HTTP",
Duration::from_secs(2),
"api.github.com",
true,
);
// attach custom properties, measurements and context tags
telemetry.properties_mut().insert("component".to_string(), "data_processor".to_string());
telemetry.tags_mut().insert("os_version".to_string(), "linux x86_64".to_string());
telemetry.measurements_mut().insert("body_size".to_string(), 115.0);
// submit telemetry item to server
client.track(telemetry);
Implementations
sourceimpl RemoteDependencyTelemetry
impl RemoteDependencyTelemetry
sourcepub fn new(
name: impl Into<String>,
dependency_type: impl Into<String>,
duration: StdDuration,
target: impl Into<String>,
success: bool
) -> Self
pub fn new(
name: impl Into<String>,
dependency_type: impl Into<String>,
duration: StdDuration,
target: impl Into<String>,
success: bool
) -> Self
Creates a new telemetry item with specified name, dependency type, target site and success status.
sourcepub fn measurements(&self) -> &Measurements
pub fn measurements(&self) -> &Measurements
Returns custom measurements to submit with the telemetry item.
sourcepub fn measurements_mut(&mut self) -> &mut Measurements
pub fn measurements_mut(&mut self) -> &mut Measurements
Returns mutable reference to custom measurements.
sourcepub fn set_id(&mut self, id: impl Into<String>)
pub fn set_id(&mut self, id: impl Into<String>)
Sets the dependency id. Use this to link other telemetry to this dependency by setting their operation parent id to this id.
let operation_id = "...".to_string();
let dependency_id = "...".to_string();
let mut dependency = RemoteDependencyTelemetry::new(
"Data processing",
"InProc",
Duration::from_millis(42),
"internal",
true,
);
dependency.set_id(dependency_id.clone());
dependency.tags_mut().operation_mut().set_id(operation_id.clone());
client.track(dependency);
let mut trace = TraceTelemetry::new("Start", SeverityLevel::Information);
trace.tags_mut().operation_mut().set_id(operation_id);
trace.tags_mut().operation_mut().set_parent_id(dependency_id);
client.track(trace);
Trait Implementations
sourceimpl Debug for RemoteDependencyTelemetry
impl Debug for RemoteDependencyTelemetry
sourceimpl Telemetry for RemoteDependencyTelemetry
impl Telemetry for RemoteDependencyTelemetry
sourcefn properties(&self) -> &Properties
fn properties(&self) -> &Properties
Returns custom properties to submit with the telemetry item.
sourcefn properties_mut(&mut self) -> &mut Properties
fn properties_mut(&mut self) -> &mut Properties
Returns mutable reference to custom properties.
Returns context data containing extra, optional tags. Overrides values found on client telemetry context.
Returns mutable reference to custom tags.
Auto Trait Implementations
impl RefUnwindSafe for RemoteDependencyTelemetry
impl Send for RemoteDependencyTelemetry
impl Sync for RemoteDependencyTelemetry
impl Unpin for RemoteDependencyTelemetry
impl UnwindSafe for RemoteDependencyTelemetry
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more