Show / Hide Table of Contents

Class TelemetryClientAdapter

Object adapter implementing ITelemetryClient but delegating to an Application Insight Microsoft.ApplicationInsights.TelemetryClient instance. It supports composition using MEF Import/Export

Inheritance
System.Object
TelemetryClientAdapter
Implements
ITelemetryClient
Namespace: DNVGL.One.Telemetry.Core.ApplicationInsights.Adapters
Assembly: DNVGL.One.Telemetry.Core.ApplicationInsights.dll
Syntax
public class TelemetryClientAdapter : object, ITelemetryClient

Constructors

View Source

TelemetryClientAdapter()

Initializes a new instance of the TelemetryClientAdapter class. Supports the use of composition with MEF. Instantiates an internal Microsoft.ApplicationInsights.TelemetryClient instance automatically.

Declaration
public TelemetryClientAdapter()
View Source

TelemetryClientAdapter(TelemetryClient)

Initializes a new instance of the TelemetryClientAdapter class.

Declaration
public TelemetryClientAdapter(TelemetryClient telemetryClient)
Parameters
Type Name Description
TelemetryClient telemetryClient

The telemetry client instance Microsoft.ApplicationInsights.TelemetryClient.

Properties

View Source

InstrumentationKey

Gets or sets the default instrumentation key for all telemetry objects logged in this ITelemetryClient.

Declaration
public string InstrumentationKey { get; set; }
Property Value
Type Description
System.String

Methods

View Source

Flush()

Flushes the in-memory buffer and any metrics being pre-aggregated.

Declaration
public void Flush()
Remarks

Learn more

View Source

IsEnabled()

Check to determine if the tracking is enabled.

Declaration
public bool IsEnabled()
Returns
Type Description
System.Boolean
View Source

StartDependencyOperation(String, String, String)

Start operation creates an operation object with a respective telemetry item.

Declaration
public IDependencyTelemetryOperationHolder StartDependencyOperation(string operationName, string operationId, string parentOperationId = null)
Parameters
Type Name Description
System.String operationName

Name of the operation that customer is planning to propagate.

System.String operationId

Operation ID to set in the new operation.

System.String parentOperationId

Optional parent operation ID to set in the new operation.

Returns
Type Description
IDependencyTelemetryOperationHolder

Operation item object with a new telemetry item having current start time and timestamp.

View Source

StartRequestOperation(String, String, String)

Start operation creates an operation object with a respective telemetry item.

Declaration
public IRequestTelemetryOperationHolder StartRequestOperation(string operationName, string operationId, string parentOperationId = null)
Parameters
Type Name Description
System.String operationName

Name of the operation that customer is planning to propagate.

System.String operationId

Operation ID to set in the new operation.

System.String parentOperationId

Optional parent operation ID to set in the new operation.

Returns
Type Description
IRequestTelemetryOperationHolder

Operation item object with a new telemetry item having current start time and timestamp.

View Source

TrackAvailability(String, DateTimeOffset, TimeSpan, String, Boolean, String, IDictionary<String, String>, IDictionary<String, Double>)

Send information about availability of an application.

Declaration
public void TrackAvailability(string name, DateTimeOffset timeStamp, TimeSpan duration, string runLocation, bool success, string message = null, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
Parameters
Type Name Description
System.String name

Availability test name.

DateTimeOffset timeStamp

The time when the availability was captured.

TimeSpan duration

The time taken for the availability test to run.

System.String runLocation

Name of the location the availability test was run from.

System.Boolean success

True if the availability test ran successfully.

System.String message

Error message on availability test run failure.

IDictionary<System.String, System.String> properties

Named string values you can use to classify and search for this availability telemetry.

IDictionary<System.String, System.Double> metrics

Additional values associated with this availability telemetry.

Remarks

Learn more

View Source

TrackDependency(String, String, String, DateTimeOffset, TimeSpan, Boolean)

Send information about an external dependency (outgoing call) in the application.

Declaration
public void TrackDependency(string dependencyTypeName, string dependencyName, string data, DateTimeOffset startTime, TimeSpan duration, bool success)
Parameters
Type Name Description
System.String dependencyTypeName

External dependency type. Very low cardinality value for logical grouping and interpretation of fields. Examples are SQL, Azure table, and HTTP.

System.String dependencyName

Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template.

System.String data

Command initiated by this dependency call. Examples are SQL statement and HTTP URLs with all query parameters.

DateTimeOffset startTime

The time when the dependency was called.

TimeSpan duration

The time taken by the external dependency to handle the call.

System.Boolean success

True if the dependency call was handled successfully.

Remarks

Learn more

View Source

TrackDependency(String, String, String, String, DateTimeOffset, TimeSpan, String, Boolean)

Send information about an external dependency (outgoing call) in the application.

Declaration
public void TrackDependency(string dependencyTypeName, string target, string dependencyName, string data, DateTimeOffset startTime, TimeSpan duration, string resultCode, bool success)
Parameters
Type Name Description
System.String dependencyTypeName

External dependency type. Very low cardinality value for logical grouping and interpretation of fields. Examples are SQL, Azure table, and HTTP.

System.String target

External dependency target.

System.String dependencyName

Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template.

System.String data

Command initiated by this dependency call. Examples are SQL statement and HTTP URLs with all query parameters.

DateTimeOffset startTime

The time when the dependency was called.

TimeSpan duration

The time taken by the external dependency to handle the call.

System.String resultCode

Result code of dependency call execution.

System.Boolean success

True if the dependency call was handled successfully.

Remarks

Learn more

View Source

TrackEvent(String, IDictionary<String, String>, IDictionary<String, Double>)

Send an event telemetry instance for display in Diagnostic Search and in the Analytics Portal.

Declaration
public void TrackEvent(string eventName, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
Parameters
Type Name Description
System.String eventName

A name for the event.

IDictionary<System.String, System.String> properties

Named string values you can use to search and classify events.

IDictionary<System.String, System.Double> metrics

Measurements associated with this event.

Remarks

Learn more

View Source

TrackException(Exception, IDictionary<String, String>, IDictionary<String, Double>)

Send an exception telemetry instance for display in Diagnostic Search.

Declaration
public void TrackException(Exception exception, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null)
Parameters
Type Name Description
Exception exception

The exception to log.

IDictionary<System.String, System.String> properties

Named string values you can use to classify and search for this exception.

IDictionary<System.String, System.Double> metrics

Additional values associated with this exception.

Remarks

Learn more

View Source

TrackMetric(String, Double, IDictionary<String, String>)

This method is deprecated. Metrics should always be pre-aggregated across a time period before being sent.
Use one of the GetMetric(..) overloads to get a metric object for accessing SDK pre-aggregation capabilities.
If you are implementing your own pre-aggregation logic, you can use the Track(ITelemetry metricTelemetry) method to send the resulting aggregates.
If your application requires sending a separate telemetry item at every occasion without aggregation across time, you likely have a use case for event telemetry.

Declaration
public void TrackMetric(string name, double value, IDictionary<string, string> properties = null)
Parameters
Type Name Description
System.String name

Metric name.

System.Double value

Metric value.

IDictionary<System.String, System.String> properties

Named string values you can use to classify and filter metrics.

View Source

TrackPageView(String)

Send information about the page viewed in the application.

Declaration
public void TrackPageView(string name)
Parameters
Type Name Description
System.String name

Name of the page.

Remarks

Learn more

View Source

TrackRequest(String, DateTimeOffset, TimeSpan, String, Boolean)

Send information about a request handled by the application.

Declaration
public void TrackRequest(string name, DateTimeOffset startTime, TimeSpan duration, string responseCode, bool success)
Parameters
Type Name Description
System.String name

The request name.

DateTimeOffset startTime

The time when the page was requested.

TimeSpan duration

The time taken by the application to handle the request.

System.String responseCode

The response status code.

System.Boolean success

True if the request was handled successfully by the application.

Remarks

Learn more

View Source

TrackTrace(String)

Send a trace message for display in Diagnostic Search.

Declaration
public void TrackTrace(string message)
Parameters
Type Name Description
System.String message

Message to display.

Remarks

Learn more

View Source

TrackTrace(String, SeverityLevel)

Send a trace message for display in Diagnostic Search.

Declaration
public void TrackTrace(string message, SeverityLevel severityLevel)
Parameters
Type Name Description
System.String message

Message to display.

SeverityLevel severityLevel

Trace severity level.

Remarks

Learn more

View Source

TrackTrace(String, SeverityLevel, IDictionary<String, String>)

Send a trace message for display in Diagnostic Search.

Declaration
public void TrackTrace(string message, SeverityLevel severityLevel, IDictionary<string, string> properties)
Parameters
Type Name Description
System.String message

Message to display.

SeverityLevel severityLevel

Trace severity level.

IDictionary<System.String, System.String> properties

Named string values you can use to search and classify events.

Remarks

Learn more

View Source

TrackTrace(String, IDictionary<String, String>)

Send a trace message for display in Diagnostic Search.

Declaration
public void TrackTrace(string message, IDictionary<string, string> properties)
Parameters
Type Name Description
System.String message

Message to display.

IDictionary<System.String, System.String> properties

Named string values you can use to search and classify events.

Remarks

Learn more

Implements

ITelemetryClient
  • View Source
Back to top Copyright © DNV GL AS. All rights reserved.