Skip to content

Commit 5843e96

Browse files
committed
pr review comment
1 parent 8579daa commit 5843e96

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

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

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ You can write and configure plug-ins for the Application Insights SDK to customi
2626

2727
Before you start:
2828

29-
* Install the appropriate SDK for you application. [ASP.NET](asp-net.md) or [ASP.NET Core](asp-net-core.md) or [Non Http/Worker for .NET](worker-service.md) or [Java](../../azure-monitor/app/java-get-started.md) in your app.
29+
* Install the appropriate SDK for you application. [ASP.NET](asp-net.md) or [ASP.NET Core](asp-net-core.md) or [Non HTTP/Worker for .NET/.NET Core](worker-service.md) or [Java](../../azure-monitor/app/java-get-started.md) in your app.
3030

3131
<a name="filtering"></a>
3232

@@ -50,39 +50,39 @@ To filter telemetry, you write a telemetry processor and register it with the `T
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

5252
```csharp
53-
using Microsoft.ApplicationInsights.Channel;
54-
using Microsoft.ApplicationInsights.Extensibility;
55-
56-
public class SuccessfulDependencyFilter : ITelemetryProcessor
57-
{
58-
private ITelemetryProcessor Next { get; set; }
59-
60-
// next will point to the next TelemetryProcessor in the chain.
61-
public SuccessfulDependencyFilter(ITelemetryProcessor next)
62-
{
63-
this.Next = next;
64-
}
53+
using Microsoft.ApplicationInsights.Channel;
54+
using Microsoft.ApplicationInsights.Extensibility;
6555

66-
public void Process(ITelemetry item)
56+
public class SuccessfulDependencyFilter : ITelemetryProcessor
6757
{
68-
// To filter out an item, return without calling the next processor.
69-
if (!OKtoSend(item)) { return; }
70-
71-
this.Next.Process(item);
58+
private ITelemetryProcessor Next { get; set; }
59+
60+
// next will point to the next TelemetryProcessor in the chain.
61+
public SuccessfulDependencyFilter(ITelemetryProcessor next)
62+
{
63+
this.Next = next;
64+
}
65+
66+
public void Process(ITelemetry item)
67+
{
68+
// To filter out an item, return without calling the next processor.
69+
if (!OKtoSend(item)) { return; }
70+
71+
this.Next.Process(item);
72+
}
73+
74+
// Example: replace with your own criteria.
75+
private bool OKtoSend (ITelemetry item)
76+
{
77+
var dependency = item as DependencyTelemetry;
78+
if (dependency == null) return true;
79+
80+
return dependency.Success != true;
81+
}
7282
}
73-
74-
// Example: replace with your own criteria.
75-
private bool OKtoSend (ITelemetry item)
76-
{
77-
var dependency = item as DependencyTelemetry;
78-
if (dependency == null) return true;
79-
80-
return dependency.Success != true;
81-
}
82-
}
8383
```
8484

85-
2. Add your processor
85+
2. Add your processor.
8686

8787
**ASP.NET apps**
8888
Insert this snippet in ApplicationInsights.config:

0 commit comments

Comments
 (0)