private static ConfigureBlobAnalyticsAsync ( Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient blobClient ) : System.Threading.Tasks.Task | ||
blobClient | Microsoft.WindowsAzure.Storage.Blob.CloudBlobClient | The Blob service client. |
Résultat | System.Threading.Tasks.Task |
private static async Task ConfigureBlobAnalyticsAsync(CloudBlobClient blobClient)
{
try
{
// Get current service property settings.
ServiceProperties serviceProperties = await blobClient.GetServicePropertiesAsync();
// Enable analytics logging and set retention policy to 14 days.
serviceProperties.Logging.LoggingOperations = LoggingOperations.All;
serviceProperties.Logging.RetentionDays = 14;
serviceProperties.Logging.Version = "1.0";
// Configure service properties for hourly and minute metrics.
// Set retention policy to 7 days.
serviceProperties.HourMetrics.MetricsLevel = MetricsLevel.ServiceAndApi;
serviceProperties.HourMetrics.RetentionDays = 7;
serviceProperties.HourMetrics.Version = "1.0";
serviceProperties.MinuteMetrics.MetricsLevel = MetricsLevel.ServiceAndApi;
serviceProperties.MinuteMetrics.RetentionDays = 7;
serviceProperties.MinuteMetrics.Version = "1.0";
// Set the default service version to be used for anonymous requests.
serviceProperties.DefaultServiceVersion = "2015-04-05";
// Set the service properties.
await blobClient.SetServicePropertiesAsync(serviceProperties);
}
catch (StorageException e)
{
Console.WriteLine(e.Message);
Console.ReadLine();
throw;
}
}