Microsoft.AI.DependencyCollector
Remote dependency monitoring.
Gets or sets a value indicating whether to disable runtime instrumentation.
Gets or sets a value indicating whether to disable Http Desktop DiagnosticSource instrumentation.
Gets the component correlation configuration.
Gets the list of diagnostic sources and activities to exclude from collection.
Gets or sets a value indicating whether the correlation headers would be set on outgoing http requests.
Gets or sets the endpoint that is to be used to get the application insights resource's profile (appId etc.).
IDisposable implementation.
Initialize method is called after all configuration properties have been loaded from the configuration.
IDisposable implementation.
The method has been called directly or indirectly by a user's code.
Initialize for framework event source (not supported for Net40).
Initialize for runtime instrumentation or framework event source.
Base implementation of diagnostic event handler.
Implements EventHubs DiagnosticSource events handling.
Implements ServiceBus DiagnosticSource events handling.
Get the DependencyTelemetry objects that are still waiting for a response from the dependency. This will most likely only be used for testing purposes.
Notifies the observer that the provider has finished sending push-based notifications.
Notifies the observer that the provider has experienced an error condition.
An object that provides additional information about the error.
Provides the observer with new data.
The current notification information.
Handler for Exception event, it is sent when request processing cause an exception (e.g. because of DNS or network issues)
Stop event will be sent anyway with null response.
Handler for Activity start event (outgoing request is about to be sent).
Handler for Activity stop event (response is received for the outgoing request).
Diagnostic event handler method for 'System.Net.Http.Request' event.
Diagnostic event handler method for 'System.Net.Http.Response' event.
This event will be fired only if response was received (and not called for faulted or canceled requests).
Diagnostic listener implementation that listens for events specific to outgoing dependency requests.
This method gets called once for each existing DiagnosticListener when this
DiagnosticListener is added to the list of DiagnosticListeners
(). This method will
also be called for each subsequent DiagnosticListener that is added to the list of
DiagnosticListeners.
The DiagnosticListener that exists when this listener was added to
the list, or a DiagnosticListener that got added after this listener was added.
Notifies the observer that the provider has finished sending push-based notifications.
Notifies the observer that the provider has experienced an error condition.
An object that provides additional information about the error.
Determines whether an URL is application insights URL.
HTTP URL.
True if URL is application insights url, otherwise false.
Determines whether an URL is application insights URL.
HTTP URL.
True if URL is application insights url, otherwise false.
ETW EventSource tracing class.
Logs the information when the DependencyTelemetry item is null as warning.
Logs the information when the HttpWebRequest is null as warning.
Logs the information when a telemetry item that is already existing in the tables (that is currently being tracked) is tracked again.
Logs the information when the telemetry item to track is null.
Keywords for the .
Key word for user actionable events.
Key word for resource discovery module failures.
Dependency TargetName helper.
Returns dependency target name from the given Uri.
Port name is included in target for non-standard ports.
Dependency uri from which target is to be extracted.
Dependency target name.
Concrete class with all processing logic to generate RDD data from the callbacks received from HttpDesktopDiagnosticSourceListener.
Implemented by the derived class for adding the tuple to its specific cache.
The request which acts the key.
The dependency telemetry for the tuple.
Boolean value that tells if the current telemetry item is being added by the customer or not.
Implemented by the derived class for getting the tuple from its specific cache.
The request which acts as the key.
The tuple for the given request.
Implemented by the derived class for removing the tuple from its specific cache.
The request which acts as the key.
Base implementation of DiagnosticSource listener.
Takes care of managing subscriptions to multiple sources and their events.
The type of processing context for given diagnostic source.
This method gets called once for each existing DiagnosticListener when this
DiagnosticListener is added to the list of DiagnosticListeners
(). This method will
also be called for each subsequent DiagnosticListener that is added to the list of
DiagnosticListeners.
The DiagnosticListener that exists when this listener was added to
the list, or a DiagnosticListener that got added after this listener was added.
Notifies the observer that the provider has finished sending push-based notifications.
Notifies the observer that the provider has experienced an error condition.
An object that provides additional information about the error.
Checks if the diagnostic source is enabled by this listener.
The diagnostic source.
true
if Diagnostic Source is enabled.
Checks if the Activity is enabled by configuration based on the event name.
The event name.
The diagnostic source-specific context ().
true
if Diagnostic Source Activity and corresponding event are enabled.
Gets diagnostic source-specific context for processing events from that source.
The diagnostic source.
The context.
Gets event handler for specific diagnostic source.
The diagnostic source name.
Event handler.
Event listener for a single Diagnostic Source.
Notifies the observer that the provider has finished sending push-based notifications.
Notifies the observer that the provider has experienced an error condition.
An object that provides additional information about the error.
Diagnostic listener implementation that listens for Http DiagnosticSource to see all outgoing HTTP dependency requests.
IDisposable implementation.
This method gets called once for each event from the Http DiagnosticSource.
The pair containing the event name, and an object representing the payload. The payload
is essentially a dynamic object that contain different properties depending on the event.
Notifies the observer that the provider has finished sending push-based notifications.
Notifies the observer that the provider has experienced an error condition.
An object that provides additional information about the error.
IDisposable implementation.
The method has been called directly or indirectly by a user's code.
HTTP Dependency parser that attempts to parse dependency as Azure Blob call.
Tries parsing given dependency telemetry item.
Dependency item to parse. It is expected to be of HTTP type.
true
if successfully parsed dependency.
HTTP Dependency parser that attempts to parse dependency as Azure IoT Hub call.
Tries parsing given dependency telemetry item.
Dependency item to parse. It is expected to be of HTTP type.
true
if successfully parsed dependency.
HTTP Dependency parser that attempts to parse dependency as Azure Queue call.
Tries parsing given dependency telemetry item.
Dependency item to parse. It is expected to be of HTTP type.
true
if successfully parsed dependency.
HTTP Dependency parser that attempts to parse dependency as Azure Service Bus call.
Tries parsing given dependency telemetry item.
Dependency item to parse. It is expected to be of HTTP type.
true
if successfully parsed dependency.
HTTP Dependency parser that attempts to parse dependency as Azure Table call.
Tries parsing given dependency telemetry item.
Dependency item to parse. It is expected to be of HTTP type.
true
if successfully parsed dependency.
HTTP Dependency parser that attempts to parse dependency as Azure DocumentDB call.
Tries parsing given dependency telemetry item.
Dependency item to parse. It is expected to be of HTTP type.
true
if successfully parsed dependency.
HTTP Dependency parser that attempts to parse dependency as generic WCF or Web Service call.
Tries parsing given dependency telemetry item.
Dependency item to parse. It is expected to be of HTTP type.
true
if successfully parsed dependency.
Builds a resource operation moniker in the format of "VERB /a/*/b/*/c".
The HTTP verb.
The resource path represented as a list of resource type and resource ID pairs.
Operation moniker string.
Parses request path into REST resource path represented as a list of resource type and resource ID pairs.
The request path.
A list of resource type and resource ID pairs.
Tokenizes request path.
E.g. the string "/a/b/c/d?e=f"
will be tokenized into [ "a", "b", "c", "d" ]
.
The request path.
List of tokens.
Extracts parameters from query string.
The request path.
Dictionary of query parameters.
If parameter is specified more than once then the last value is returned.
Extracts the HTTP verb from dependency name.
The dependency name.
The extracted verb (null
if not matched).
The dependency name sans the extracted verb.
List of supported verbs to extract.
Splits substring by given delimiters.
The string to split.
The delimiters.
The index at which splitting will start.
This is not validated and expected to be within input string range.
The index at which splitting will end.
If -1 then string will be split till it's end.
This is not validated and expected to be less than string length.
A list of substrings.
Checks if a string ends with any of the specified suffixes.
The string to check.
The suffixes.
true
if string ends with any of the suffixes.
DiagnosticsSource events handler.
Handles event and tracks telemetry if needed.
The event.
DiagnosticListener that sent this event.
Checks if the event is enabled by this listener.
The event name.
First event input object ().
Second event input object ().
Single high precision clock used by operations.
High precision stopwatch.
Number of 100 nanoseconds per high-precision clock tick.
The time clock started.
Gets number of ticks elapsed on the clock since the start.
Calculates time between two clock readings.
Start time in ticks.
End time in ticks.
Time between two clock readings.
Converts time on the operation clock (in ticks) to date and time structure.
Ticks elapsed according to operation watch.
Date time structure representing the date and time that corresponds to the operation clock reading.
The memory cache instance used to hold items. MemoryCache.Default is not used as it is shared
across application and can potentially collide with customer application.
The cache item policy which identifies the expiration time.
Adds telemetry tuple to MemoryCache. DO NOT call it for the id that already exists in the cache.
This is a known Memory Cache race-condition issue when items with same id are added concurrently
and MemoryCache leaks memory. It should be fixed sometime AFTER .NET 4.7.1.
Efficient implementation of fetching properties of anonymous types with reflection.
Create a property fetcher from a .NET Reflection PropertyInfo class that
represents a property of a particular type.
Given an object, fetch the property that this propertyFetch represents.
Gets or sets a value indicating whether pretending the profiler is attached or not.
The function that needs to be called before sending a request to the server. Creates and initializes dependency telemetry item.
Telemetry client object to initialize the context of the telemetry item.
Function that needs to be invoked after the request call to the sever. Computes the duration of the request and tracks the dependency telemetry
item.
Telemetry client object to track the telemetry item.
Telemetry item to compute the duration and track.
Stops telemetry operation. Doesn't track the telemetry item.
Telemetry item to stop.
Gets the tuple from either conditional weak table or cache (based on the framework for the input web request).
Target web request.
Tuple of dependency telemetry and a boolean that tells if the tuple is custom created or not.
Adds the tuple to either conditional weak table or cache (based on the framework for the input web request).
Target web request.
Dependency telemetry item to add to the table for the corresponding web request.
Boolean value that tells if the current telemetry item is being added by the customer or not.
Gets the tuple from either conditional weak table or cache (based on the framework for the input SQL request).
Target SQL request.
Tuple of dependency telemetry and a boolean that tells if the tuple is custom created or not.
Adds the tuple to either conditional weak table or cache (based on the framework for the input SQL request).
Target SQL request.
Dependency telemetry item to add to the table for the corresponding SQL request.
Boolean value that tells if the current telemetry item is being added by the customer or not.
Provides methods for listening to events from FrameworkEventSource for HTTP.
The Http processor.
The Framework EventSource name.
BeginGetResponse Event ID.
EndGetResponse Event ID.
BeginGetRequestStream Event ID.
EndGetRequestStream Event ID.
Enables HTTP event source when EventSource is created. Called for all existing
event sources when the event listener is created and when a new event source is attached to the listener.
Called whenever an event has been written by an event source for which the event listener has enabled events.
The event arguments that describe the event.
Called when a postfix of a (HttpWebRequest|FileWebRequest|FtpWebRequest).BeginGetResponse method has been invoked.
The event arguments that describe the event.
Called when a postfix of a (HttpWebRequest|FileWebRequest|FtpWebRequest).EndGetResponse method has been invoked.
The event arguments that describe the event.
Called when a postfix of a (HttpWebRequest|FileWebRequest|FtpWebRequest).BeginGetRequestStream method has been invoked.
The event arguments that describe the event.
Concrete class with all processing logic to generate RDD data from the callbacks received from FrameworkHttpEventListener.
On begin callback from Framework event source.
This object.
URI of the web request.
On end callback from Framework event source.
The id.
The success to indicate if the dependency call completed successfully or not.
The synchronous flag to indicate if the dependency call was synchronous or not.
The HTTP status code of the response.
Implemented by the derived class for adding the tuple to its specific cache.
The request which acts the key.
The dependency telemetry for the tuple.
Boolean value that tells if the current telemetry item is being added by the customer or not.
Implemented by the derived class for getting the tuple from its specific cache.
The request which acts as the key.
The tuple for the given request.
Implemented by the derived class for removing the tuple from its specific cache.
The request which acts as the key.
Provides methods for listening to events from FrameworkEventSource for SQL.
The SQL processor.
The Framework EventSource name for SQL.
BeginExecute Event ID.
EndExecute Event ID.
Enables SQL event source when EventSource is created. Called for all existing
event sources when the event listener is created and when a new event source is attached to the listener.
Called whenever an event has been written by an event source for which the event listener has enabled events.
The event arguments that describe the event.
Called when a postfix of a SQLCommand begin methods have been invoked.
The event arguments that describe the event.
Called when a postfix of a postfix of a SQLCommand end methods have been invoked.
The event arguments that describe the event.
Initializes a new instance of the class.
On begin callback from Framework event source.
Identifier of SQL connection object.
Data source name.
Database name.
Command text.
On end callback from Framework event source.
Identifier of SQL connection object.
Indicate whether operation completed successfully.
Indicates whether operation was called synchronously or asynchronously.
SQL exception number.
Gets SQL command resource name.
DataSource name.
Database name.
CommandText name.
The resource name if possible otherwise empty string.
A helper subscriber class helping the parent object, which is a HttpDiagnosticSourceListener, to subscribe
to the Http DiagnosticSource. That way the parent object can subscribe to the DiagnosticSource without worry
about the details around subscription.
IDisposable implementation.
This method gets called once for each existing DiagnosticListener when this
DiagnosticListener is added to the list of DiagnosticListeners
(). This method
will also be called for each subsequent DiagnosticListener that is added to
the list of DiagnosticListeners.
The DiagnosticListener that exists when this listener was added to
the list, or a DiagnosticListener that got added after this listener was added.
Notifies the observer that the provider has finished sending push-based notifications.
Notifies the observer that the provider has experienced an error condition.
An object that provides additional information about the error.
IDisposable implementation.
The method has been called directly or indirectly by a user's code.
Concrete class with all processing logic to generate RDD data from the callbacks
received from Profiler instrumentation for HTTP or HTTP EventSource/DiagnosticSource events.
Initializes a new instance of the class.
Gets HTTP request url.
Represents web request.
The url if possible otherwise empty string.
Simple test hook, that allows for using a stub rather than the implementation that calls the original service.
Lookup header to use.
Common helper for all Begin Callbacks.
This object.
Flag that enables Request-Id and Correlation-Context headers injection.
Should be set to true only for profiler and old versions of DiagnosticSource Http hook events.
Null object as all context is maintained in this class via weak tables.
Common helper for all End Callbacks.
The exception object if any.
This object.
Return value of the function if any.
Implemented by the derived class for adding the tuple to its specific cache.
The request which acts the key.
The dependency telemetry for the tuple.
Boolean value that tells if the current telemetry item is being added by the customer or not.
Implemented by the derived class for getting the tuple from its specific cache.
The request which acts as the key.
The tuple for the given request.
Implemented by the derived class for removing the tuple from its specific cache.
The request which acts as the key.
Concrete class with all processing logic to generate RDD data from the callbacks
received from Profiler instrumentation for HTTP .
Initializes a new instance of the class.
On begin callback for GetResponse.
This object.
The context for end callback.
On end callback for GetResponse.
The context.
The return value.
This object.
The resulting return value.
On exception callback for GetResponse callback.
The context.
The exception object.
This object.
On begin callback for GetRequestStream callback.
This object.
The transport context parameter.
The context for end callback.
On exception for GetRequestStream callback.
Note: There is no call back required for GetRequestStream except on exception cases.
The context.
The exception.
This object.
The transport context parameter.
On begin for BeginGetResponse callback.
This object.
The callback parameter.
The state parameter.
The context for end callback.
On end for EndGetResponse callbacks.
The context.
The return value.
This object.
The asyncResult parameter.
The return value passed.
On exception for EndGetResponse callbacks.
The context.
The exception.
This object.
The asyncResult parameter.
On begin for BeginGetRequestStream callback.
This object.
The callback parameter.
The state parameter.
The context for end callback.
On exception for EndGetRequestStream callback.
Note: There is no call back required for EndGetRequestStream except on exception cases.
The context.
The exception.
This object.
The asyncResult parameter.
The transportContext parameter.
Implemented by the derived class for adding the tuple to its specific cache.
The request which acts the key.
The dependency telemetry for the tuple.
Boolean value that tells if the current telemetry item is being added by the customer or not.
Implemented by the derived class for getting the tuple from its specific cache.
The request which acts as the key.
The tuple for the given request.
Implemented by the derived class for removing the tuple from its specific cache.
The request which acts as the key.
Concrete class with all processing logic to generate dependencies from the callbacks received from Profiler instrumentation for SQL command.
Initializes a new instance of the class.
Gets SQL command resource name.
The SQL command.
The resource name if possible otherwise empty string.
Gets SQL resource target name.
The SQL command.
The resource target name if possible otherwise empty string.
Gets SQL resource command text.
The SQL command.
Returns the command text or empty.
Concrete class with all processing logic to generate dependencies from the callbacks received from Profiler instrumentation for SQL connection.
Constant command text to return.
Initializes a new instance of the class.
Gets SQL connection resource name.
The SQL connection.
The resource name if possible otherwise empty string.
Gets SQL connection resource target name.
The SQL connection.
The resource target name if possible otherwise empty string.
Gets SQL connection command text.
The SQL connection.
Returns predefined command text.
Base class with all processing logic to generate dependencies from the callbacks received from Profiler instrumentation for SQL.
Initializes a new instance of the class.
On begin callback for methods with 1 parameter.
On begin callback for methods with 2 parameter.
On begin callback for methods with 3 parameters.
On begin callback for methods with 4 parameter.
On end callback for methods with 1 parameter.
On end callback for methods with 1 parameter. Doesn't track the telemetry item, just stops activity and removes object from the table.
On end async callback for methods with 1 parameter.
On end async callback for methods with 1 parameter. Sends data only if returned task (returnValue) is faulted.
On end callback for methods with 2 parameter.
On end async callback for methods with 2 parameter.
On end async callback for methods with 2 parameter. Sends data only if returned task (returnValue) is faulted.
On end callback for methods with 3 parameter.
On exception callback for methods with 1 parameter.
On exception callback for methods with 2 parameter.
On exception callback for methods with 3 parameter.
Gets SQL resource name.
The SQL object.
The resource name if possible otherwise empty string.
Gets SQL resource target name.
The SQL object.
The resource target name if possible otherwise empty string.
Gets SQL resource command text.
The SQL object.
Returns the command text or empty.
Common helper for all Begin Callbacks.
This object.
The context for end callback.
Common helper for all EndAsync Callbacks.
Returned task by the async method.
This object.
Common helper for all EndAsync Callbacks that should send data only in the case of exception happened.
Returned task by the async method.
This object.
Common helper for all End Callbacks.
The exception object if any.
This object.
True if telemetry item should be sent, otherwise it only stops the telemetry item.
Common helper for all End Callbacks.
The exception object if any.
This object.
True if telemetry item should be sent, otherwise it only stops the telemetry item.
Client-Server dependency tracking.
Populates WebRequest using the user, session initialized in telemetry item.
Dependency telemetry item.
Http web request.
Populates WebRequest using the operation context in telemetry item.
Dependency telemetry item.
Http web request.
Creates and adds cookie to the web request.
Web request object.
Cookie key.
Cookie value.
Telemetry Initializer that parses http dependencies into well-known types like Azure Storage.
If telemetry item is http dependency - converts it to the well-known type of the dependency.
Telemetry item to convert.
Sanitized collection on host strings.
We sanitize before adding to the list. We try our best to extract the host name from the passed in item and store that in the collection.
Item to be added.
Dependency Telemetry extension methods to associate with request objects and to store in conditional/cache tables to avoid duplicate tracking.
Associates telemetry item to a web request to avoid duplicate tracking, and populates cookies with data from initialized telemetry item if setCookies is set to true.
When there is an existing telemetry item in the corresponding to the given WEB REQUEST, we return the existing telemetry and associate the same with the WEB REQUEST.
Telemetry object that needs to be associated with the web request.
Web request object which we use to populate from the information obtained from the initialized telemetry.
Set cookies enables the process of setting the cookies to the web request. By default it is set to false.
Set request headers to correlate dependency telemetry item with the request telemetry item that will process this http request.
Dependency telemetry item with an associated dependency telemetry item.
Associates telemetry item to a SQL command object to to avoid duplicate tracking.
When there is an existing telemetry item in the corresponding to the given SQL REQUEST, we return the existing telemetry and associate the same with the SQL REQUEST.
Telemetry object that needs to be associated with the web request.
SQL request object which is used as a key to store in the tables.
Dependency telemetry item with an associated dependency telemetry item.
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.