Skip to content

Commit 1765d59

Browse files
committed
few minor adjustments.
1 parent 59883e2 commit 1765d59

File tree

3 files changed

+23
-24
lines changed

3 files changed

+23
-24
lines changed

articles/azure-monitor/app/eventcounters.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ ms.author: cithomas
1515
---
1616
# EventCounters introduction
1717

18-
`EventCounter` is .NET/.NET Core mechanism to publish and consume counters or statistics. [This](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md) document gives an overview of `EventCounters` and examples on how to publish and consume them. EventCounters are supported in all OS Platforms, and can be thought of as a cross-platform equivalent for the [PerformanceCounters](https://docs.microsoft.com/dotnet/api/system.diagnostics.performancecounter) which is only supported in Windows systems.
18+
`EventCounter` is .NET/.NET Core mechanism to publish and consume counters or statistics. [This](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.Tracing/documentation/EventCounterTutorial.md) document gives an overview of `EventCounters` and examples on how to publish and consume them. EventCounters are supported in all OS Platforms - Windows, Linux and MacOS. It can be thought of as a cross-platform equivalent for the [PerformanceCounters](https://docs.microsoft.com/dotnet/api/system.diagnostics.performancecounter) that is only supported in Windows systems.
1919

20-
While users can publish any custom `EventCounters` to meet their needs, the .NET Core 3.0 ecosystem publishes a set of these counters out-of-the-box. The document will walk through the steps required to collect and view `EventCounters` (system defined or user defined) in Azure Application Insights.
20+
While users can publish any custom `EventCounters` to meet their needs, the .NET Core 3.0 runtime publishes a set of these counters by default. The document will walk through the steps required to collect and view `EventCounters` (system defined or user defined) in Azure Application Insights.
2121

22-
# Using Application Insights to collect EventCounters
22+
## Using Application Insights to collect EventCounters
2323

24-
Application Insights supports collecting `EventCounters` with its `EventCounterCollectionModule`, which is part of the newly released nuget package [Microsoft.ApplicationInsights.EventCounterCollector](https://www.nuget.org/packages/Microsoft.ApplicationInsights.EventCounterCollector). `EventCounterCollectionModule` is automatically enabled when using either [AspNetCore](asp-net-core.md) or [WorkerService](worker-service.md) instructions. `EventCounterCollectionModule` collects counters with a non-configurable collection frequency of 60 seconds.
24+
Application Insights supports collecting `EventCounters` with its `EventCounterCollectionModule`, which is part of the newly released nuget package [Microsoft.ApplicationInsights.EventCounterCollector](https://www.nuget.org/packages/Microsoft.ApplicationInsights.EventCounterCollector). `EventCounterCollectionModule` is automatically enabled when using either [AspNetCore](asp-net-core.md) or [WorkerService](worker-service.md) instructions. `EventCounterCollectionModule` collects counters with a non-configurable collection frequency of 60 seconds. There are no special permissions required to collect EventCounters.
2525

2626
## Default counters collected
2727

28-
For apps running in .NET Core 3.0 or higher, the following lists the default set of counters collected automatically by the SDK. These counters can be queried either in Metrics Explorer or using Analytics query. The name of the counters will be of the form "Category|Counter".
28+
For apps running in .NET Core 3.0, the following set of counters are collected automatically by the SDK. The name of the counters will be of the form "Category|Counter".
2929

3030
|Category | Counter|
3131
|---------------|-------|
@@ -57,32 +57,31 @@ Note: Counters of category Microsoft.AspNetCore.Hosting are only added in Asp.Ne
5757

5858
## Customizing counters to be collected
5959

60-
The following shows how to add/remove counters. This would be done in `ConfigureServices` of your application after application insights telemetry collection is enabled using either `AddApplicationInsightsTelemetry()` or `AddApplicationInsightsWorkerService()`. Following is an example code from an Asp.Net Core application. For other type of applications, refer to [this](worker-service.md#configuring-or-removing-default-telemetrymodules) document.
60+
The following example shows how to add/remove counters. This customization would be done in `ConfigureServices` of your application after application insights telemetry collection is enabled using either `AddApplicationInsightsTelemetry()` or `AddApplicationInsightsWorkerService()`. Following is an example code from an Asp.Net Core application. For other type of applications, refer to [this](worker-service.md#configuring-or-removing-default-telemetrymodules) document.
6161

6262
```csharp
6363
using Microsoft.ApplicationInsights.Extensibility.EventCounterCollector;
6464

6565
public void ConfigureServices(IServiceCollection services)
6666
{
67-
6867
//... other code...
6968
70-
// The following shows several customizations done to EventCounterCollectionModule.
69+
// The following code shows several customizations done to EventCounterCollectionModule.
7170
services.ConfigureTelemetryModule<EventCounterCollectionModule>(
72-
(module, o) =>
73-
{
74-
// The following removes all default counters.
75-
module.Counters.Clear();
71+
(module, o) =>
72+
{
73+
// This removes all default counters.
74+
module.Counters.Clear();
7675

77-
// The following adds a user defined counter "MyCounter" from EventSource named "MyEventSource"
78-
module.Counters.Add(new EventCounterCollectionRequest("MyEventSource", "MyCounter"));
76+
// This adds a user defined counter "MyCounter" from EventSource named "MyEventSource"
77+
module.Counters.Add(new EventCounterCollectionRequest("MyEventSource", "MyCounter"));
7978

80-
// The following adds the system counter "gen-0-size" from "System.Runtime"
81-
module.Counters.Add(new EventCounterCollectionRequest("System.Runtime", "gen-0-size"));
82-
}
83-
);
79+
// This adds the system counter "gen-0-size" from "System.Runtime"
80+
module.Counters.Add(new EventCounterCollectionRequest("System.Runtime", "gen-0-size"));
81+
}
82+
);
8483

85-
// The following removes EventCounterCollectionModule to disable the module completely.
84+
// The following code removes EventCounterCollectionModule to disable the module completely.
8685
var eventCounterModule = services.FirstOrDefault<ServiceDescriptor>
8786
(t => t.ImplementationType == typeof(EventCounterCollectionModule));
8887
if (eventCounterModule != null)
@@ -94,7 +93,7 @@ The following shows how to add/remove counters. This would be done in `Configure
9493

9594
## Event counters in Metric Explorer
9695

97-
To view EventCounter metrics in [Metric Explorer](https://docs.microsoft.com/azure/azure-monitor/platform/metrics-charts), select Application Insights resource, and chose Log-based metrics as metric namespace. Then EventCounter metrics gets displayed under PerformanceCounter category.
96+
To view EventCounter metrics in [Metric Explorer](https://docs.microsoft.com/azure/azure-monitor/platform/metrics-charts), select Application Insights resource, and chose Log-based metrics as metric namespace. Then EventCounter metrics get displayed under PerformanceCounter category.
9897

9998
![Event counters reported in Application Insights](./media/event-counters/meticsexplorer-counterlist.png)
10099

@@ -105,12 +104,12 @@ You can also search and display event counter reports in [Analytics](../../azure
105104
For example, run the following query to see what counters are collected and available to query:
106105

107106
```Kusto
108-
performanceCounters | summarize count(), avg(value) by name
107+
performanceCounters | summarize avg(value) by name
109108
```
110109

111110
![Event counters reported in Application Insights](./media/event-counters/analytics-event-counters.png)
112111

113-
To get a chart of a specific counter (eg:) over the recent period:
112+
To get a chart of a specific counter (for example: `ThreadPool Completed Work Item Count`) over the recent period, run the following query.
114113

115114
```Kusto
116115
performanceCounters
@@ -122,7 +121,7 @@ performanceCounters
122121

123122
![Chat of a single counter in Application Insights](./media/event-counters/analytics-completeditems-counters.png)
124123

125-
Like other telemetry, **performanceCounters** also has a column `cloud_RoleInstance` that indicates the identity of the host server instance on which your app is running. The above query shows the counter value per instance, and hence can be used to compare performance of different server instances.
124+
Like other telemetry, **performanceCounters** also has a column `cloud_RoleInstance` that indicates the identity of the host server instance on which your app is running. The above query shows the counter value per instance, and can be used to compare performance of different server instances.
126125

127126
## Alerts
128127
Like other metrics, you can [set an alert](../../azure-monitor/app/alerts.md) to warn you if an event counter goes outside a limit you specify. Open the Alerts pane and click Add Alert.
-67 KB
Loading

articles/azure-monitor/app/worker-service.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ Use this sample if you are using a Console Application written in either .NET Co
531531
Use this sample if you are in Asp.Net Core 2.1/2.2, and creating background tasks as per official guidance [here](https://docs.microsoft.com/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-2.2)
532532

533533
[.NET Core 3.0 Worker Service](https://github.com/microsoft/ApplicationInsights-Home/tree/master/Samples/WorkerServiceSDK/WorkerServiceSampleWithApplicationInsights)
534-
Use this sample if you have a .NET Core 3.0 Worker Service application as per official guidance [here](https://docs.microsoft.com/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-3.0&tabs=visual-studio#worker-service-template)
534+
Use this sample if you have a .NET Core 3.0 Worker Service application as per official guidance [here](https://docs.microsoft.com/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-3.0&tabs=visual-studio#worker-service-template)
535535

536536
## Open-source SDK
537537

0 commit comments

Comments
 (0)