Microsoft.AI.Web Listens to ASP.NET DiagnosticSource and enables instrumentation with Activity: let ASP.NET create root Activity for the request. Indicates if module initialized successfully. Initializes the telemetry module. Telemetry configuration to use for initialization. Implements IObserver OnNext callback, subscribes to AspNet DiagnosticSource. DiagnosticListener value. Disposes all subscriptions to DiagnosticSources. IObserver OnError callback. Exception instance. IObserver OnCompleted callback. HttpRequest Extensions. HttpRequest Extensions. Request tracking constants and keys. Name of the HttpContext item containing RequestTelemetry object. Type name for the transfer handler. This handler is used to enable extension(less) URI and it produces extra request, which should not be counted. The name of the cookie which holds authenticated user context information. Creates request name on the base of HttpContext. Controller/Action for MVC or path for other cases. Allows configuration of patterns for synthetic traffic filters. Gets or sets the regular expression pattern applied to the user agent string to determine whether traffic is synthetic. Gets or sets the readable name for the synthetic traffic source. If not provided, defaults to the pattern match. ETW EventSource tracing class. Instance of the PlatformEventSource class. Keywords for the PlatformEventSource. Those keywords should match keywords in Core. Key word for user actionable events. Diagnostics tracing keyword. Keyword for errors that trace at Verbose level. Base class for WebOperationTelemetryInitializers. Base implementation of the initialization method. Telemetry item to initialize. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. Resolved web platform specific context. An instance of the context. Base web telemetry module. Initializes a new instance of the class. Gets the module name which is added to be used for internal tracing instead of GetType on each request to improve performance. Post initialization Web Telemetry Module callback. An instance of request telemetry context. Platform specific context. Request telemetry finalization - sending callback Web Telemetry Module callback. An instance of request telemetry context. Platform specific context. Http Error reporting Web Telemetry Module callback. An instance of request telemetry context. Platform specific context. A telemetry initializer that will set the User properties of Context corresponding to a RequestTelemetry object. User.AccountId is updated with properties derived from the RequestTelemetry.RequestTelemetry.Context.User. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. Platform agnostic module for web application instrumentation. Indicates if module initialized successfully. Initializes a new instance of the class. Initializes module for a given application. HttpApplication instance. Required IDisposable implementation. When sending the response headers, allow request module to add the IKey's target hash. HttpApplication instance. Creates open delegate for faster invocation than regular Invoke. MethodInfo for which open delegate is to be created. A telemetry initializer that will set the User properties of Context corresponding to a RequestTelemetry object. User.AuthenticatedUserId is updated with properties derived from the RequestTelemetry.RequestTelemetry.Context.User. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. A telemetry initializer that will set the correlation context for all telemetry items in web application. Initializes a new instance of the class. Gets or sets the name of the header to get parent operation Id from. Gets or sets the name of the header to get root operation Id from. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. Telemetry initializer populates client IP address for the current request. Initializes a new instance of the class. Gets a list of request header names that is used to check client id. Gets or sets a header values separator. Gets or sets a value indicating whether the first or the last IP should be used from the lists of IPs in the header. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. Telemetry module to collect unhandled exceptions caught by http module. Implements on error callback of http module. Initializes the telemetry module. Telemetry configuration to use for initialization. A telemetry initializer that will set the NAME property of OperationContext corresponding to a TraceTelemetry object. If the telemetry object is of type RequestTelemetry, then the Name of the RequestTelemetry is updated. For all other cases, Operation.Name is updated with the name derived from the HttpContext. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. Telemetry module tracking requests using http module. Gets or sets a value indicating whether child request suppression is enabled or disabled. True by default. This value is evaluated in Initialize(). See also . Child requests caused by . Unit tests should disable this. Gets or sets a value indicating the size of internal tracking dictionary. Must be a positive integer. See also . Gets the list of handler types for which requests telemetry will not be collected if request was successful. Gets or sets a value indicating whether the component correlation headers would be set on http responses. Gets or sets the endpoint that is to be used to get the application insights resource's profile (appId etc.). Implements on begin callback of http module. Implements on end callback of http module. Adds target response header response object. Initializes the telemetry module. Telemetry configuration to use for initialization. Verifies context to detect whether or not request needs to be processed. Current http context. True if request needs to be processed, otherwise - False. Simple test hook, that allows for using a stub rather than the implementation that calls the original service. Lookup header to use. Checks whether or not handler is a transfer handler. An instance of handler to validate. True if handler is a transfer handler, otherwise - False. can create a Child request to route extension-less requests to a controller. (ex: site/home -> site/HomeController.cs) We do not want duplicate telemetry logged for both the Parent and Child requests, so the activeRequests will be created OnBeginRequest. When the child request OnEndRequest, the id will be removed from this dictionary and telemetry will not be logged for the parent. Unit tests should disable the ChildRequestTrackingSuppressionModule. Unit test projects cannot create an [internal] IIS7WorkerRequest object. Without this object, we cannot modify the Request.Headers without throwing a PlatformNotSupportedException. Unit tests will have to initialize the RequestIdHeader. The second IF will ensure the id is added to the activeRequests. IIS Classic Pipeline should disable the ChildRequestTrackingSuppressionModule. Classic does not create IIS7WorkerRequest object and Headers will be read-only. (Exception System.PlatformNotSupportedException: This operation requires IIS integrated pipeline mode.) Using this as a hash-set of current active requests. The value of the Dictionary is not used. Initializes a new instance of the class. The maximum number of active requests to be tracked before resetting the dictionary. Gets the Max number of request ids to cache. Request will be tagged with an id to identify if it should be logged later. OnEndRequest - Should this request be logged? Will compare a request id against a hash-set of known requests. If this request is not known, add it to hash-set and return true (safe to log). If this request is known, return false (do not log twice). Additional requests with the same id will return false. Tag new requests. Transfer Ids to parent requests. Has this request been tracked. Track this requestId. Dictionary A will be read/write. When dictionary A is full, move to B and create new A. Dictionary B will be read-only. A telemetry initializer that will set the Session properties of Context corresponding to a RequestTelemetry object. Session is updated with properties derived from the RequestTelemetry.RequestTelemetry.Context.Session. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. A telemetry initializer that will update the User, Session and Operation contexts if request originates from a web test. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. A telemetry initializer that determines if the request came from a synthetic source based on the user agent string. Gets or sets the configured patterns for matching synthetic traffic filters through user agent string. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. A telemetry initializer that will set the User properties of Context corresponding to a RequestTelemetry object. User.Id are updated with properties derived from the RequestTelemetry.RequestTelemetry.Context.User. Implements initialization logic. Http context. Request telemetry object associated with the current request. Telemetry item to initialize. Checks if given RequestId is hierarchical. Request id. True if requestId is hierarchical false otherwise. ETW EventSource tracing class. ETW EventSource tracing class. Keywords for the . Key word for user actionable events. Key word for diagnostics events. Extension methods for the ConditionalWeakTable class. Check if a key exists before adding the key/value pair. A store for instrumentation App Ids. This makes sure we don't query the public endpoint to find an app Id for the same instrumentation key more than once. Max number of app ids to cache. Initializes a new instance of the class mostly to be used by the test classes to provide an override for fetching appId logic. The delegate to be called to fetch the appId. Initializes a new instance of the class mostly to be used by the test classes to seed the instrumentation key -> app Id relationship. A dictionary that contains known instrumentation key - app id relationship. Initializes a new instance of the class. Endpoint that is to be used to fetch appId. Retrieves the correlation id corresponding to a given instrumentation key. Instrumentation key string. AppId corresponding to the provided instrumentation key. true if correlationId was successfully retrieved; false otherwise. This method is purely a test helper at this point. It checks whether the task to get app ID is still running. True if fetch task is still in progress, false otherwise. Format and store an iKey and appId pair into the dictionary of known correlation ids. Instrumentation Key is expected to be a Guid string. Application Id is expected to be a Guid string. App Id needs to be Http Header safe, and all non-ASCII characters will be removed. Retrieves the app id given the instrumentation key. Instrumentation key for which app id is to be retrieved. App id. Strips off any relative path at the end of the base URI and then appends the known relative path to get the app id uri. AI resource's instrumentation key. Computed Uri. Registers failure for further action in future. Instrumentation key for which the failure occurred. Exception indicating failure. FetchAppIdFromService failed. Registers failure for further action in future. Instrumentation key for which the failure occurred. Response code from AppId Endpoint. Structure that represents a failed fetch app Id call. Initializes a new instance of the class. Time when the failure occurred. Failure response code. Initializes a new instance of the class. Time when the failure occurred. Gets the time of failure. Gets the integer value for response code representing the type of failure. Gets a value indicating whether the failure is likely to go away when a retry happens. Utility functions for dealing with exceptions. Get the string representation of this Exception with special handling for AggregateExceptions. The exception to convert to a string. The detailed string version of the provided exception. Generic functions that can be used to get and set Http headers. Get the key value from the provided HttpHeader value that is set up as a comma-separated list of key value pairs. Each key value pair is formatted like (key)=(value). The header values that may contain key name/value pairs. The name of the key value to find in the provided header values. The first key value, if it is found. If it is not found, then null. Given the provided list of header value strings, return a list of key name/value pairs with the provided keyName and keyValue. If the initial header value strings contains the key name, then the original key value should be replaced with the provided key value. If the initial header value strings don't contain the key name, then the key name/value pair should be added to the list and returned. The existing header values that the key/value pair should be added to. The name of the key to add. The value of the key to add. The result of setting the provided key name/value pair into the provided headerValues. Http Headers only allow Printable US-ASCII characters. Remove all other characters. An interface for getting a correlation id from a provided instrumentation key. Retrieves the correlation id corresponding to a given instrumentation key. Instrumentation key string. AppId corresponding to the provided instrumentation key. true if correlationId was successfully retrieved; false otherwise. Header names for requests / responses. Request-Context header. Source key in the request context header that is added by an application while making http requests and retrieved by the other application when processing incoming requests. Target key in the request context header that is added to the response and retrieved by the calling application when processing incoming responses. Source-RoleName key in the request context header that is added by an application while making http requests and retrieved by the other application when processing incoming requests. Target-RoleName key in the request context header that is added to the response and retrieved by the calling application when processing incoming responses. Legacy parent Id header. Legacy root id header. Standard Request-Id Id header. Standard Correlation-Context header. WebHeaderCollection extension methods. For the given header collection, for a given header of name-value type, find the value of a particular key. Header collection. Name of the header in the collection. Desired key of the key-value list. Value against the given parameters. For the given header collection, for a given header of name-value type, return list of KeyValuePairs. Header collection. Name of the header in the collection. List of KeyValuePairs in the given header. For the given header collection, adds KeyValuePair to header. Header collection. Name of the header that is to contain the name-value pair. Name in the name value pair. Value in the name value pair. For the given header collection, sets the header value based on the name value format. Header collection. Name of the header that is to contain the name-value pair. List of KeyValuePairs to format into header. HttpContextBaseExtension class provides extensions methods for accessing Web Application Insights objects. Provide access to request generated by Web Application Insights SDK. HttpContextBase instance. Request telemetry instance or null. HttpContextExtension class provides extensions methods for accessing Web Application Insights objects. Provide access to request generated by Web Application Insights SDK. HttpContext instance. Request telemetry instance or null.