Tôi đang cố truy vấn dữ liệu từ Azure WadPerformanceCountersTable.Trường hợp Azure từ 0 đến 3 không ghi dữ liệu chẩn đoán trong WadPerformanceCountersTable
Tôi đang cố gắng lấy 5 phút dữ liệu cuối cùng.
Vấn đề là tôi chỉ nhận dữ liệu từ các trường hợp nr. 4,5 và 6, nhưng không phải từ 0,1,2 và 3.
Các kịch bản tôi đang sử dụng để kéo de dữ liệu là thế này:
Microsoft.WindowsAzure.CloudStorageAccount storageAccount = Microsoft.WindowsAzure.CloudStorageAccount.Parse(AppDefs.CloudStorageAccountConnectionString);
CloudTableClient cloudTableClient = storageAccount.CreateCloudTableClient();
TableServiceContext serviceContext = cloudTableClient.GetDataServiceContext();
IQueryable<PerformanceCountersEntity> traceLogsTable = serviceContext.CreateQuery<PerformanceCountersEntity>("WADPerformanceCountersTable");
var selection = from row in traceLogsTable
where row.PartitionKey.CompareTo("0" + DateTime.UtcNow.AddMinutes(-timespanInMinutes).Ticks) >= 0
&& row.DeploymentId == deploymentId
&& row.CounterName == @"\Processor(_Total)\% Processor Time"
select row;
CloudTableQuery<PerformanceCountersEntity> query = selection.AsTableServiceQuery<PerformanceCountersEntity>();
IEnumerable<PerformanceCountersEntity> result = query.Execute();
return result;
tập tin diagnostics.wadcfg của tôi là:
<?xml version="1.0" encoding="utf-8" ?>
<DiagnosticMonitorConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration" configurationChangePollInterval="PT1M" overallQuotaInMB="4096">
<PerformanceCounters bufferQuotaInMB="0" scheduledTransferPeriod="PT5M">
<PerformanceCounterConfiguration counterSpecifier="\Memory\Available Bytes" sampleRate="PT60S" />
<PerformanceCounterConfiguration counterSpecifier="\Processor(_Total)\% Processor Time" sampleRate="PT60S" />
</PerformanceCounters>
</DiagnosticMonitorConfiguration>
CHỈNH SỬA: Ngoài ra, tôi có mã này được triển khai trên môi trường thử nghiệm ở Azure và nó hoạt động tốt.
EDIT 2: Cập nhật để bao gồm dịch vụ định nghĩa XML:
<ServiceDefinition name="MyApp.Azure" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2012-05.1.7">
<WebRole name="MyApp.Website" vmsize="ExtraSmall">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WebRole>
<WorkerRole name="MyApp.Cache" vmsize="ExtraSmall">
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="Caching" />
</Imports>
<LocalResources>
<LocalStorage name="Microsoft.WindowsAzure.Plugins.Caching.FileStore" sizeInMB="1000" cleanOnRoleRecycle="false" />
</LocalResources>
</WorkerRole>
</ServiceDefinition>
Sau khi tôi đã đọc câu trả lời người dùng @Igorek 's Tôi đã bao gồm XML cấu hình ServiceDefinition.csdef tôi. Tôi vẫn không biết làm thế nào tôi phải cấu hình phần LocalResources> LocalStorage của cấu hình. Cấu hình phải được đặt cho "MyApp.Website".
EDIT 3: Tôi đã thực hiện các thay đổi này cho tài khoản thử nghiệm.
tôi đã thiết lập này trong ServiceDefinitions.csdef
<LocalResources>
<LocalStorage name="DiagnosticStore" sizeInMB="4096" cleanOnRoleRecycle="false"/>
</LocalResources>
Và tôi đã giảm OverallQuota và BufferQuota trong diagnostics.wadcfg Cuối cùng, trong WAD kiểm soát container Tôi có cấu hình này mỗi trường hợp: http://pastebin.com/aUywLUfE
Tôi sẽ phải đặt điều này vào tài khoản thực để xem kết quả.
CHỈNH SỬA CUỐI CÙNG: Dường như Hạn ngạch tổng thể là vấn đề, mặc dù tôi không thể đảm bảo.
Cuối cùng, sau một mới xuất bản, tôi nhận thấy điều này:
- một trường hợp vai trò có XML cấu hình trong
wad-control-container
với mộtoverall quota
của 1024MB và BufferQuotaInMB của 1024MB -> đây là đúng , - một trường hợp 2 vai trò khác có tổng hạn mức là 4080MB và BufferQuotaInMB of 500MB -> điều này không đúng, họ không viết trong WADPerfor bảng manceCounters.
- cả hai tệp cấu hình XML (nằm trong số
wad-control-container
) thuộc về từng thể hiện vai trò đã bị xóa trước khi xuất bản mới. - tập tin cấu hình
diagnostics.wadcfg
đã được cấu hình một cách chính xác: 1024MB everywere
Vì vậy, tôi nghĩ có một vấn đề với nhà xuất bản của họ.
hai phương pháp được thử:
tôi xóa 1 XML không chính xác từ 'wad-control-container và khởi động lại máy. XML đã được viết lại và cá thể vai trò bắt đầu viết trong WADPerfCountTable.
Tôi đã sử dụng tập lệnh bên dưới trên trường hợp không chính xác khác và trường hợp vai trò không chính xác bắt đầu viết trong WADPerfCountTable.
var storageAccount = CloudStorageAccount.Parse(AppDefs.CloudStorageAccountConnectionString); DeploymentDiagnosticManager diagManager = new DeploymentDiagnosticManager(storageAccount, deploymentId); IEnumerable<RoleInstanceDiagnosticManager> instanceManagers = diagManager.GetRoleInstanceDiagnosticManagersForRole(roleName); foreach (var roleInstance in instanceManagers) { DiagnosticMonitorConfiguration currentConfiguration = roleInstance.GetCurrentConfiguration(); TimeSpan configurationChangePollInterval = TimeSpan.FromSeconds(60); if (!IsCurrentConfigurationCorrect(currentConfiguration, overallQuotaInMb, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1))) { // Add a performance counter for processor time. PerformanceCounterConfiguration pccCPU = new PerformanceCounterConfiguration(); pccCPU.CounterSpecifier = @"\Processor(_Total)\% Processor Time"; pccCPU.SampleRate = TimeSpan.FromSeconds(60); // Add a performance counter for available memory. PerformanceCounterConfiguration pccMemory = new PerformanceCounterConfiguration(); pccMemory.CounterSpecifier = @"\Memory\Available Bytes"; pccMemory.SampleRate = TimeSpan.FromSeconds(60); currentConfiguration.ConfigurationChangePollInterval = TimeSpan.FromSeconds(60); currentConfiguration.OverallQuotaInMB = overallQuotaInMb; currentConfiguration.PerformanceCounters.BufferQuotaInMB = overallQuotaInMb; currentConfiguration.PerformanceCounters.DataSources.Add(pccCPU); currentConfiguration.PerformanceCounters.DataSources.Add(pccMemory); roleInstance.SetCurrentConfiguration(currentConfiguration); } }
Ngoài ra, tôi tiếp tục nhận được lỗi này bất cứ lúc nào The configuration file is missing a diagnostic connection string for one or more roles
.
Cuối cùng, tôi sẽ chọn câu trả lời hiện tại làm câu trả lời, vì tôi đã tìm thấy sự cố. Thật không may, tôi đã không tìm thấy nguyên nhân của vấn đề. Tại mỗi lần xuất bản, tôi có nguy cơ nhận được XML thay đổi.
Chúng tôi đang gặp sự cố tương tự khi hai trong số 5 trường hợp của chúng tôi không ghi các bộ đếm hiệu suất và phần còn lại thực hiện. Hy vọng ai đó có thể trả lời câu hỏi này! Tôi nghĩ rằng đó là một vấn đề với DLL chẩn đoán. Bạn đang sử dụng phiên bản SDK nào? – greg84
Xin chào, chúng tôi đang sử dụng 1.7. –
Thú vị - chúng tôi hiện đang sử dụng 1.6 - Tôi tự hỏi SDK xử lý các lỗi mà nó gặp phải khi viết chẩn đoán và liệu nó có "cố gắng" khi gặp lỗi không. Bạn có đang ở vị trí để cập nhật lên phiên bản SDK mới nhất không? – greg84