ANNOUNCEMENT: UPDATED TO AZURE STORAGE API 2.1.0.3. MARKED THE MEMBERS FOR SETTING GETTING ANALYTICS PROPERTIES AS OBSOLETE.

 

Project Description
Azure Store XRay is a thin wrapper on Azure Storage Analytics functionality, that lets you turn on and off various analytics functions, and read from the logs and tables for your reporting needs.

XRay diagram.png

The Storage Analytics implementation came with some basic features to set and get metrics and logging properties, through the REST interface, as well as ability to retrieve metrics information on the storage service usage, through querying the special tables created by the underlying infrastructure, plus retrieving the usage logs generated on the blob storage.

The XRay library is introduced to hide some of the complexities of this infrastructure, through providing a managed interface to these functions. The interface exposed by the component let’s its users to turn on and off logging and metrics analytics gathering, set and get retention periods for those, and also retrieve log and metrics data through IEnumerable interfaces with strongly typed entities.

block.png

Sample charts generated in Cloud Ninja project are as follows:

sample charts.png

Two different usage patterns are available,

  • With a generic Analytics client.

 

// Initialize the client
var analyticsClient =
    new AnalyticsClient(
        new AzureCloudStorageAccount(new StorageCredentialsAccountAndKey(accountName, accountKey), true));

// Get table service settings
var tableSettings = analyticsClient.GetAnalyticsProperties(AzureStorageServiceEnum.Table);

// Modify some settings                
analyticsClient.DisableLoggingRetentionPeriod(AzureStorageServiceEnum.Table);

// Read metrics
var start = new DateTimeOffset(new DateTime(2012, 5, 1));
var end = new DateTimeOffset(new DateTime(2012, 5, 2));
var results = analyticsClient.GetAllMetrics(
    AzureStorageServiceEnum.Table, 
    start, 
    end);

// Read logs
var logs = analyticsClient.GetLogEntities(
    AzureStorageServiceEnum.Table, 
    start, 
    end);

 

  • With a specific Analytics client:

 

// Initialize the client
var tableAnalyticsClient =
    new TableAnalyticsClient(
        new AzureCloudStorageAccount(new StorageCredentialsAccountAndKey(accountName, accountKey), true));

// Get table service settings
var tableSettings = tableAnalyticsClient.GetAnalyticsProperties();

// Modify some settings                
tableAnalyticsClient.DisableLoggingRetentionPeriod();

// Read metrics
var start = new DateTimeOffset(new DateTime(2012, 5, 1));
var end = new DateTimeOffset(new DateTime(2012, 5, 2));
var results = tableAnalyticsClient.GetAllMetrics(
    start,
    end);

// Read logs
var logs = tableAnalyticsClient.GetLogEntities(
    start,
    end);

 


Team


Prerequisites

  • Visual Studio 2013
  • Windows Azure Subscription

Last edited Oct 29, 2013 at 6:40 PM by ercenk, version 14