Struct appinsights::TelemetryContext
source · [−]pub struct TelemetryContext { /* private fields */ }
Expand description
Encapsulates contextual data common to all telemetry submitted through a telemetry client.
Examples
use appinsights::telemetry::{ContextTags, Properties};
use appinsights::TelemetryContext;
let mut properties = Properties::default();
properties.insert("Resource Group".to_string(), "my-rg".to_string());
let mut tags = ContextTags::default();
tags.insert("account_id".to_string(), "123-345-777".to_string());
let context = TelemetryContext::new("instrumentation".to_string(), tags, properties);
assert_eq!(context.properties().get("Resource Group"), Some(&"my-rg".to_string()));
assert_eq!(context.tags().get("account_id"), Some(&"123-345-777".to_string()));
Implementations
sourceimpl TelemetryContext
impl TelemetryContext
sourcepub fn from_config(config: &TelemetryConfig) -> Self
pub fn from_config(config: &TelemetryConfig) -> Self
Creates a new instance of telemetry context from config
sourcepub fn new(i_key: String, tags: ContextTags, properties: Properties) -> Self
pub fn new(i_key: String, tags: ContextTags, properties: Properties) -> Self
Creates a new instance of telemetry context.
sourcepub fn properties_mut(&mut self) -> &mut Properties
pub fn properties_mut(&mut self) -> &mut Properties
Returns mutable reference to a collection of common properties to attach to telemetry event.
sourcepub fn properties(&self) -> &Properties
pub fn properties(&self) -> &Properties
Returns immutable reference to a collection of common properties to attach to telemetry event.
Returns mutable reference to a collection of common tags to attach to telemetry event.
Returns immutable reference to a collection of common tags to attach to telemetry event.
Trait Implementations
sourceimpl Clone for TelemetryContext
impl Clone for TelemetryContext
sourcefn clone(&self) -> TelemetryContext
fn clone(&self) -> TelemetryContext
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations
impl RefUnwindSafe for TelemetryContext
impl Send for TelemetryContext
impl Sync for TelemetryContext
impl Unpin for TelemetryContext
impl UnwindSafe for TelemetryContext
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