Module opentelemetry_application_insights::attrs

source ·
Expand description

§Attributes for Application Insights context fields

You can use these attributes in spans to set any of the Application Insights context fields.

§Usage

use opentelemetry::{global, trace::Tracer as _, KeyValue};
use opentelemetry_application_insights::attrs as ai;

let tracer = global::tracer("my-component");
let _span = tracer
    .span_builder("span-name")
    .with_attributes(vec![
        KeyValue::new(ai::SESSION_ID, "42"),
        KeyValue::new(ai::DEVICE_LOCALE, "en-GB"),
    ])
    .start(&tracer);

Constants§

  • Application version. Information in the application context fields is always about the application that is sending the telemetry.
  • Name of the role the application is a part of. Maps directly to the role name in azure.
  • Name of the instance where the application is running. Computer name for on-premisis, instance name for Azure.
  • Name for a custom event recorded with special name “ai.custom”.
  • Unique client device id. Computer name in most cases.
  • Device locale using <language>-<REGION> pattern, following RFC 5646. Example ‘en-US’.
  • Model of the device the end user of the application is using. Used for client scenarios. If this field is empty then it is derived from the user agent.
  • Client device OEM name taken from the browser.
  • Operating system name and version of the device the end user of the application is using. If this field is empty then it is derived from the user agent. Example ‘Windows 10 Pro 10.0.10586.0’
  • The type of the device the end user of the application is using. Used primarily to distinguish JavaScript telemetry from server side telemetry. Examples: ‘PC’, ‘Phone’, ‘Browser’. ‘PC’ is the default value.
  • Agent version. Used to indicate the version of StatusMonitor installed on the computer if it is used for data collection.
  • This is the node name used for billing purposes. Use it to override the standard detection of nodes.
  • The city of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.
  • The country of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.
  • The IP address of the client device. IPv4 and IPv6 are supported. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.
  • The province/state of the client device. If any of Country, Province, or City is specified, those values will be preferred over geolocation of the IP address field. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.
  • The correlation vector is a light weight vector clock which can be used to identify and order related events across clients and services.
  • A unique identifier for the operation instance. The operation.id is created by either a request or a page view. All other telemetry sets this to the value for the containing request or page view. Operation.id is used for finding all the telemetry items for a specific operation instance.
  • The name (group) of the operation. The operation.name is created by either a request or a page view. All other telemetry items set this to the value for the containing request or page view. Operation.name is used for finding all the telemetry items for a group of operations (i.e. ‘GET Home/Index’).
  • The unique identifier of the telemetry item’s immediate parent.
  • Name of synthetic source. Some telemetry from the application may represent a synthetic traffic. It may be web crawler indexing the web site, site availability tests or traces from diagnostic libraries like Application Insights SDK itself.
  • Session ID - the instance of the user’s interaction with the app. Information in the session context fields is always about the end user. When telemetry is sent from a service, the session context is about the user that initiated the operation in the service.
  • Boolean value indicating whether the session identified by ai.session.id is first for the user or not.
  • In multi-tenant applications this is the account ID or name which the user is acting with. Examples may be subscription ID for Azure portal or blog name blogging platform.
  • Authenticated user id. The opposite of ai.user.id, this represents the user with a friendly name. Since it’s PII information it is not collected by default by most SDKs.
  • Anonymous user id. Represents the end user of the application. When telemetry is sent from a service, the user context is about the user that initiated the operation in the service.