Sdílet prostřednictvím


TelemetryClient Class

Definition

Send events, metrics and other telemetry to the Application Insights service. Learn more

public sealed class TelemetryClient
type TelemetryClient = class
Public NotInheritable Class TelemetryClient
Inheritance
TelemetryClient

Constructors

TelemetryClient()
Obsolete.

Initializes a new instance of the TelemetryClient class. Send telemetry with the active configuration, usually loaded from ApplicationInsights.config.

TelemetryClient(TelemetryConfiguration)

Initializes a new instance of the TelemetryClient class. Send telemetry with the specified configuration.

Properties

Context

Gets the current context that will be used to augment telemetry you send.

InstrumentationKey
Obsolete.

Gets or sets the default instrumentation key for all ITelemetry objects logged in this TelemetryClient.

Methods

Flush()

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

FlushAsync(CancellationToken)

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

GetMetric(MetricIdentifier, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(MetricIdentifier, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(MetricIdentifier)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, String, MetricConfiguration, MetricAggregationScope)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, String, MetricConfiguration)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String, String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

GetMetric(String)

Gets or creates a metric container that you can use to track, aggregate and send metric values.
Optionally specify a metric configuration to control how the tracked values are aggregated.

IsEnabled()

Check to determine if the tracking is enabled.

TrackAvailability(AvailabilityTelemetry)

Send information about availability of an application. Create a separate AvailabilityTelemetry instance for each call to TrackAvailability(AvailabilityTelemetry).

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

Send information about availability of an application.

TrackDependency(DependencyTelemetry)

Send information about external dependency call in the application. Create a separate DependencyTelemetry instance for each call to TrackDependency(DependencyTelemetry).

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

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

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

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

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

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

TrackEvent(EventTelemetry)

Send an EventTelemetry for display in Diagnostic Search and in the Analytics Portal. Create a separate EventTelemetry instance for each call to TrackEvent(EventTelemetry).

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

Send an EventTelemetry for display in Diagnostic Search and in the Analytics Portal.

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

Send an ExceptionTelemetry for display in Diagnostic Search.

TrackException(ExceptionTelemetry)

Send an ExceptionTelemetry for display in Diagnostic Search. Create a separate ExceptionTelemetry instance for each call to TrackException(ExceptionTelemetry).

TrackMetric(MetricTelemetry)

This method is not the preferred method for sending metrics. 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, then you can use this method. 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; see TrackEvent(EventTelemetry).

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

This method is not the preferred method for sending metrics. 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, then you can use this method. 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; see TrackEvent(EventTelemetry).

TrackPageView(PageViewTelemetry)

Send information about the page viewed in the application. Create a separate PageViewTelemetry instance for each call to TrackPageView(PageViewTelemetry).

TrackPageView(String)

Send information about the page viewed in the application.

TrackRequest(RequestTelemetry)

Send information about a request handled by the application. Create a separate RequestTelemetry instance for each call to TrackRequest(RequestTelemetry).

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

Send information about a request handled by the application.

TrackTrace(String, IDictionary<String,String>)

Send a trace message for display in Diagnostic Search.

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

Send a trace message for display in Diagnostic Search.

TrackTrace(String, SeverityLevel)

Send a trace message for display in Diagnostic Search.

TrackTrace(String)

Send a trace message for display in Diagnostic Search.

TrackTrace(TraceTelemetry)

Send a trace message for display in Diagnostic Search. Create a separate TraceTelemetry instance for each call to TrackTrace(TraceTelemetry).

Extension Methods

GetMetricManager(TelemetryClient, MetricAggregationScope)

Gets the MetricManager for this TelemetryClient at the specified scope. If a metric manager does not exist at the specified scope, it is created.

Applies to