[][src]Struct appinsights::TelemetryContext

pub struct TelemetryContext { /* fields omitted */ }

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()));

Methods

impl TelemetryContext[src]

pub fn from_config(config: &TelemetryConfig) -> Self[src]

Creates a new instance of telemetry context from config

pub fn new(i_key: String, tags: ContextTags, properties: Properties) -> Self[src]

Creates a new instance of telemetry context.

pub fn properties_mut(&mut self) -> &mut Properties[src]

Returns mutable reference to a collection of common properties to attach to telemetry event.

pub fn properties(&self) -> &Properties[src]

Returns immutable reference to a collection of common properties to attach to telemetry event.

pub fn tags_mut(&mut self) -> &mut ContextTags[src]

Returns mutable reference to a collection of common tags to attach to telemetry event.

pub fn tags(&self) -> &ContextTags[src]

Returns immutable reference to a collection of common tags to attach to telemetry event.

Trait Implementations

impl Clone for TelemetryContext[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,