0

I've configured Azure Diagnostics to transfer Local Storage (10MB, my custom log and dump data files). My periodic transfer of directory -> blob work just fine. It's the on-demand ones that don't seem to work. I manually created the blob as well as the queue but it's still a no go! The code that does the on-demand transfer is

DiagHelper.cs

public void StartOnDemandTransfer()
{
    OnDemandTransferOptions odtOptions = new OnDemandTransferOptions();
    odtOptions.From = DateTime.UtcNow.AddMinutes(-10.0);
    odtOptions.To = DateTime.UtcNow;
    //odtOptions.LogLevelFilter = LogLevel.Verbose;
    odtOptions.NotificationQueueName = "wad-on-demand-transfer";

    RoleInstanceDiagnosticManager ridm = getRoleInstanceDiagnosticManager();
    Guid odtTransferId = ridm.BeginOnDemandTransfer(DataBufferName.Directories, odtOptions);
}

public void EndTransfers()
{
    RoleInstanceDiagnosticManager ridm = getRoleInstanceDiagnosticManager();

    IDictionary<DataBufferName, OnDemandTransferInfo> activeTransfers = ridm.GetActiveTransfers();

    foreach (KeyValuePair<DataBufferName, OnDemandTransferInfo> activeTransfer in activeTransfers)
    {
        OnDemandTransferInfo odtInfo = activeTransfer.Value;
        Guid requestId = odtInfo.RequestId;
        ridm.EndOnDemandTransfer(requestId);
    }
}

public RoleInstanceDiagnosticManager getRoleInstanceDiagnosticManager()
{
    if (roleInstanceDiagnosticManager == null)
    {
        CloudStorageAccount cloudStorageAccount = CloudStorageAccount.Parse(
               RoleEnvironment.GetConfigurationSettingValue(wadConnectionString));
        roleInstanceDiagnosticManager = 
               cloudStorageAccount.CreateRoleInstanceDiagnosticManager(
                    RoleEnvironment.DeploymentId,
                    RoleEnvironment.CurrentRoleInstance.Role.Name,
                    RoleEnvironment.CurrentRoleInstance.Id);
    }
    return roleInstanceDiagnosticManager;
}

With the actual flush/on demand transfer from admin/flushlogs.aspx.cs

protected void Button1_Click(object sender, EventArgs e)
{
    api.Diag.DiagHelper diag = new api.Diag.DiagHelper();
    diag.StartOnDemandTransfer();
    diag.EndTransfers();
}

Question:

Does anyone know why Windows Azure Diagnostics is NOT transferring the Local Storage I specified?


Extra Details:

I think I've initialized Azure Diagnostics correctly because the periodic transfers work alright (had to create the blob manually) but here is the init code nevertheless

// ... Other init stuff ...

// Custom logs
LocalResource localResource = RoleEnvironment.GetLocalResource("ApiLogFolder");
DirectoryConfiguration dirConfig = new DirectoryConfiguration();
dirConfig.Container = "apilog-blob";
dirConfig.DirectoryQuotaInMB = localResource.MaximumSizeInMegabytes;
dirConfig.Path = localResource.RootPath;
config.Directories.DataSources.Add(dirConfig);
config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(10.0);


roleInstanceDiagnosticManager.SetCurrentConfiguration(config); 

I've defined the local storage in ServiceDefinition.csdef as follows

<LocalResources>
  <LocalStorage name="Microsoft.WindowsAzure.Plugins.Caching.FileStore" sizeInMB="1000" cleanOnRoleRecycle="false" />
  <LocalStorage name="ApiLogFolder" cleanOnRoleRecycle="false" sizeInMB="10" />
</LocalResources>
DeepSpace101
  • 13,110
  • 9
  • 77
  • 127

1 Answers1

0

It might be because you're calling EndOnDemandTransfer immediately after you call BeginOnDemandTransfer. Based on the naming of those methods, it's easy to see why you might think that EndOnDemandTransfer would block until the transfer is done, or something along those lines. But according to MSDN (http://msdn.microsoft.com/en-us/library/windowsazure/microsoft.windowsazure.diagnostics.management.roleinstancediagnosticmanager.endondemandtransfer.aspx):

The EndOnDemandTransfer method stops an in-progress transfer of diagnostic data.