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 - Application version. Information in the application context fields is always about the application that is sending the telemetry.
- CLOUD_
ROLE - Name of the role the application is a part of. Maps directly to the role name in azure.
- CLOUD_
ROLE_ INSTANCE - Name of the instance where the application is running. Computer name for on-premisis, instance name for Azure.
- CUSTOM_
EVENT_ NAME - Name for a custom event recorded with special name “ai.custom”.
- DEVICE_
ID - Unique client device id. Computer name in most cases.
- DEVICE_
LOCALE - Device locale using <language>-<REGION> pattern, following RFC 5646. Example ‘en-US’.
- DEVICE_
MODEL - 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.
- DEVICE_
OEM_ NAME - Client device OEM name taken from the browser.
- DEVICE_
OS_ VERSION - 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’
- DEVICE_
TYPE - 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.
- INTERNAL_
AGENT_ VERSION - Agent version. Used to indicate the version of StatusMonitor installed on the computer if it is used for data collection.
- INTERNAL_
NODE_ NAME - This is the node name used for billing purposes. Use it to override the standard detection of nodes.
- INTERNAL_
SDK_ VERSION - SDK version. See https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification for information.
- LOCATION_
CITY - 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.
- LOCATION_
COUNTRY - 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.
- LOCATION_
IP - 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.
- LOCATION_
PROVINCE - 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.
- OPERATION_
CORRELATION_ VECTOR - The correlation vector is a light weight vector clock which can be used to identify and order related events across clients and services.
- OPERATION_
ID - 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.
- OPERATION_
NAME - 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’).
- OPERATION_
PARENT_ ID - The unique identifier of the telemetry item’s immediate parent.
- OPERATION_
SYNTHETIC_ SOURCE - 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 - 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.
- SESSION_
IS_ FIRST - Boolean value indicating whether the session identified by ai.session.id is first for the user or not.
- USER_
ACCOUNT_ ID - 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.
- USER_
AUTH_ USER_ ID - 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.
- USER_ID
- 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.