다음을 통해 공유


DiagnosticMonitorConfiguration.OverallQuotaInMB Property

 

Gets or sets the total amount of local storage allocated for all logging buffers.

Namespace:   Microsoft.WindowsAzure.Diagnostics
Assembly:  Microsoft.WindowsAzure.Diagnostics (in Microsoft.WindowsAzure.Diagnostics.dll)

Syntax

public int OverallQuotaInMB { get; set; }
public:
property int OverallQuotaInMB {
    int get();
    void set(int value);
}
member OverallQuotaInMB : int with get, set
Public Property OverallQuotaInMB As Integer

Property Value

Type: System.Int32

Type: System.Int32

Returns Int32.

Remarks

The diagnostics.wadcfg file is used to configure diagnostics in your application. For more information on how to configure your diagnostics.wadcfg file, see Enabling Diagnostics in Windows Azure. Once your application is running in Windows Azure, you can use the DiagnosticMonitorConfiguration class along with the RoleInstanceDiagnosticManager class to remotely change your application’s diagnostics configuration.

The OverallQuotaInMB property specifies the amount of local storage allocated for the combined total of all the data buffers’ BufferQuotaInMB properties. If your buffer exceeds the OverallQuotaInMB size, older entries will be deleted, so you should consider this when sizing your data buffers and setting the frequency of your transfer intervals.

By default, the OverallQuotaInMB is set to 4GB. If you want to specify a smaller amount, you can set this property to your desired value. You cannot specify a larger value using this property; instead you must add a <LocalStorage> element for DiagnosticStore to your ServiceDefinition.csdef file. For example:

ServiceDefinition.csdef

<LocalResources>
    <LocalStorage name="DiagnosticStore" sizeInMB="8192" cleanOnRoleRecycle="false"/>
</LocalResources>

Note that if you specify a larger size in your ServiceConfiguration.cscfg file, such as 8GB in the example above, you must also set the OverallQuotaInMB property to the same value or a smaller value. If you make no changes to the value of the OverallQuotaInMB property, your data buffers will be limited to the original 4GB value.

For more information see Configure Local Storage Resources.

Example

The following snippet gets the diagnostic monitor configuration for each instance of a specific role, specifies a smaller overall quota, and sets the new configuration.

// Get the connection string. It's recommended that you store the connection string in your web.config or app.config file.
// Use the ConfigurationManager type to retrieve your storage connection string.  You can find the account name and key in
// the Windows Azure Management Portal (https://manage.windowsazure.com).
//string connectionString = "DefaultEndpointsProtocol=https;AccountName=<AccountName>;AccountKey=<AccountKey>";
string connectionString = System.Configuration.ConfigurationManager.ConnectionStrings["StorageConnectionString"].ConnectionString;

// The deployment ID and role name for your application can be obtained from the 
// Windows Azure Management Portal (https://manage.windowsazure.com). See your 
// application dashboard under Cloud Services.
string deploymentID = "e2ab8b6667644666ba627bdf6f5e4daa";
string roleName = "WebRole1";

// Get the DeploymentDiagnosticManager object for your deployment.
DeploymentDiagnosticManager diagManager = new DeploymentDiagnosticManager(connectionString, deploymentID);

// Get the RoleInstanceDiagnosticManager objects for each instance of your role.
IEnumerable<RoleInstanceDiagnosticManager> instanceManagers = diagManager.GetRoleInstanceDiagnosticManagersForRole(roleName);

// Iterate through the role instances and update the configuration.
foreach (RoleInstanceDiagnosticManager roleInstance in instanceManagers)
{
   DiagnosticMonitorConfiguration diagnosticConfiguration = roleInstance.GetCurrentConfiguration();

   // Set an overall quota of 2GB.
   diagnosticConfiguration.OverallQuotaInMB = 2048;

   // Set the configuration.
   roleInstance.SetCurrentConfiguration(diagnosticConfiguration);
}

Warning

This API is not supported in Azure SDK versions 2.5 and higher. Instead, use the diagnostics.wadcfg XML configuration file. For more information, see Collect Logging Data by Using Azure Diagnostics.

See Also

DiagnosticMonitorConfiguration Class
Microsoft.WindowsAzure.Diagnostics Namespace

Return to top