ANNOUNCEMENT: BREAKING CHANGE WITH THE LATEST CHECK IN. PLEASE SEE BELOW.

 

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);

 

 

BREAKING CHANGE as of 5/2/2012 (CHANGESET 13372): 

We started to use Patterns and Practices Transient Fault handling block and you will need to modify the hosting application's config file with the correct settings. We included app.config file in the source as an example and use the defaultAzureStorageRetryStrategy  setting.


Team


Prerequisites

  • Visual Studio 2010 SP1
  • Windows Azure SDK 1.5
  • Windows Azure Subscription

Last edited May 2, 2012 at 5:30 PM by ercenk, version 13