Share via


DevicesClient.GetServiceStatisticsAsync(CancellationToken) Method

Definition

Gets service statistics for the IoT hub. This call is made over HTTP.

public virtual System.Threading.Tasks.Task<Microsoft.Azure.Devices.ServiceStatistics> GetServiceStatisticsAsync (System.Threading.CancellationToken cancellationToken = default);
abstract member GetServiceStatisticsAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.ServiceStatistics>
override this.GetServiceStatisticsAsync : System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Devices.ServiceStatistics>
Public Overridable Function GetServiceStatisticsAsync (Optional cancellationToken As CancellationToken = Nothing) As Task(Of ServiceStatistics)

Parameters

cancellationToken
CancellationToken

A cancellation token to cancel the operation.

Returns

The service statistics that can be retrieved from IoT hub, eg. the number of devices connected to the hub.

Exceptions

If IoT hub responded to the request with a non-successful status code. For example, if the provided request was throttled, IotHubServiceException with ThrottlingException is thrown. For a complete list of possible error cases, see IotHubServiceErrorCode.

If the HTTP request fails due to an underlying issue such as network connectivity, DNS failure, or server certificate validation.

If the provided cancellation token has requested cancellation.

Applies to