共用方式為


TelemetryClient.FlushAsync(CancellationToken) Method

Definition

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

public System.Threading.Tasks.Task<bool> FlushAsync (System.Threading.CancellationToken cancellationToken);
member this.FlushAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<bool>
Public Function FlushAsync (cancellationToken As CancellationToken) As Task(Of Boolean)

Parameters

cancellationToken
CancellationToken

Returns

Returns true when telemetry data is transferred out of process (application insights server or local storage) and are emitted before the flush invocation. Returns false when transfer of telemetry data to server has failed with non-retriable http status. FlushAsync on InMemoryChannel always returns true, as the channel offers minimal reliability guarantees and doesn't retry sending telemetry after a failure.

Remarks

Learn more

Applies to