Skip to content

Commit 4a3ab43

Browse files
committed
ac
1 parent 6b24900 commit 4a3ab43

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

articles/azure-monitor/app/api-filtering-sampling.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ms.author: mbullwin
1717
---
1818
# Filtering and preprocessing telemetry in the Application Insights SDK
1919

20-
You can write and configure plug-ins for the Application Insights SDK to customize how telemetry can be enriched and processed before it is sent to the Application Insights service.
20+
You can write and configure plug-ins for the Application Insights SDK to customize how telemetry can be enriched and processed before it's sent to the Application Insights service.
2121

2222
* [Sampling](../../azure-monitor/app/sampling.md) reduces the volume of telemetry without affecting your statistics. It keeps together related data points so that you can navigate between them when diagnosing a problem. In the portal, the total counts are multiplied to compensate for the sampling.
2323
* Filtering with Telemetry Processors [for ASP.NET or ASP.NET Core](#filtering) or [Java](../../azure-monitor/app/java-filter-telemetry.md) lets you select or modify telemetry in the SDK before it is sent to the server. For example, you could reduce the volume of telemetry by excluding requests from robots. But filtering is a more basic approach to reducing traffic than sampling. It allows you more control over what is transmitted, but you have to be aware that it affects your statistics - for example, if you filter out all successful requests.
@@ -34,7 +34,7 @@ Before you start:
3434

3535
This technique gives you more direct control over what is included or excluded from the telemetry stream. Filtering can be used to drop telemetry items from being sent to Application Insights. You can use it in conjunction with Sampling, or separately.
3636

37-
To filter telemetry, you write a telemetry processor and register it with the `TelemetryConfiguration`. All telemetry goes through your processor, and you can choose to drop it from the stream, or add properties. This includes telemetry from the standard modules such as the HTTP request collector and the dependency collector, as well as telemetry you have written yourself. You can, for example, filter out telemetry about requests from robots, or successful dependency calls.
37+
To filter telemetry, you write a telemetry processor and register it with the `TelemetryConfiguration`. All telemetry goes through your processor, and you can choose to drop it from the stream or give it to the next processor in the chain. This includes telemetry from the standard modules such as the HTTP request collector and the dependency collector, and telemetry you have tracked yourself. You can, for example, filter out telemetry about requests from robots, or successful dependency calls.
3838

3939
> [!WARNING]
4040
> Filtering the telemetry sent from the SDK using processors can skew the statistics that you see in the portal, and make it difficult to follow related items.
@@ -45,7 +45,7 @@ To filter telemetry, you write a telemetry processor and register it with the `T
4545
4646
### Create a telemetry processor (C#)
4747

48-
1. To create a filter, implement ITelemetryProcessor. This is another extensibility point like telemetry module, telemetry initializer, and telemetry channel.
48+
1. To create a filter, implement `ITelemetryProcessor`. `ITelemetryProcessor` is another extensibility point like telemetry module, telemetry initializer, and telemetry channel.
4949

5050
Notice that Telemetry Processors construct a chain of processing. When you instantiate a telemetry processor, you are given a reference to the next processor in the chain. When a telemetry data point is passed to the Process method, it does its work and then calls (or not calls) the next Telemetry Processor in the chain.
5151

@@ -85,7 +85,7 @@ public class SuccessfulDependencyFilter : ITelemetryProcessor
8585
2. Add your processor
8686

8787
**ASP.NET apps**
88-
Insert this in ApplicationInsights.config:
88+
Insert this snippet in ApplicationInsights.config:
8989

9090
```xml
9191
<TelemetryProcessors>
@@ -96,14 +96,11 @@ Insert this in ApplicationInsights.config:
9696
</TelemetryProcessors>
9797
```
9898

99-
(This is the same section where you initialize a sampling filter.)
100-
10199
You can pass string values from the .config file by providing public named properties in your class.
102100

103101
> [!WARNING]
104102
> Take care to match the type name and any property names in the .config file to the class and property names in the code. If the .config file references a non-existent type or property, the SDK may silently fail to send any telemetry.
105103
>
106-
>
107104
108105
**Alternatively,** you can initialize the filter in code. In a suitable initialization class - for example AppStart in Global.asax.cs - insert your processor into the chain:
109106

@@ -124,7 +121,7 @@ TelemetryClients created after this point will use your processors.
124121
> [!NOTE]
125122
> Adding processor using `ApplicationInsights.config` or using `TelemetryConfiguration.Active` is not valid for ASP.NET Core applications or if you are using Microsoft.ApplicationInsights.WorkerService SDK.
126123
127-
For apps written using [ASP.NET Core](asp-net-core.md#adding-telemetry-processors) pr [WorkerService](worker-service.md#adding-telemetry-processors), adding a new `TelemetryProcessor` is done by using `AddApplicationInsightsTelemetryProcessor` extension method on `IServiceCollection`, as shown below. This is done in `ConfigureServices` method of your `Startup.cs` class.
124+
For apps written using [ASP.NET Core](asp-net-core.md#adding-telemetry-processors) pr [WorkerService](worker-service.md#adding-telemetry-processors), adding a new `TelemetryProcessor` is done by using `AddApplicationInsightsTelemetryProcessor` extension method on `IServiceCollection`, as shown below. This method is called in `ConfigureServices` method of your `Startup.cs` class.
128125

129126
```csharp
130127
public void ConfigureServices(IServiceCollection services)
@@ -207,9 +204,9 @@ public void Process(ITelemetry item)
207204

208205
Use telemetry initializers to enrich telemetry with additional information and/or to override telemetry properties set by the standard telemetry modules.
209206

210-
For example, the Application Insights for Web package collects telemetry about HTTP requests. By default, it flags as failed any request with a response code >= 400. But if you want to treat 400 as a success, you can provide a telemetry initializer that sets the Success property.
207+
For example, the Application Insights for Web package collect telemetry about HTTP requests. By default, it flags as failed any request with a response code >= 400. But if you want to treat 400 as a success, you can provide a telemetry initializer that sets the Success property.
211208

212-
If you provide a telemetry initializer, it is called whenever any of the Track*() methods are called. This includes methods called by the standard telemetry modules. By convention, these modules do not set any property that has already been set by an initializer. Telemetry initializers are called before calling telemetry processors. So any enrichment done by initializers are visible to processors.
209+
If you provide a telemetry initializer, it is called whenever any of the Track*() methods are called. This includes `Track()` methods called by the standard telemetry modules. By convention, these modules do not set any property that has already been set by an initializer. Telemetry initializers are called before calling telemetry processors. So any enrichments done by initializers are visible to processors.
213210

214211
**Define your initializer**
215212

0 commit comments

Comments
 (0)