Skip to content

Commit fa49dbd

Browse files
committed
Removed Java from "Before you start" section
1 parent a72a23a commit fa49dbd

File tree

1 file changed

+57
-57
lines changed

1 file changed

+57
-57
lines changed

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

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

1818
Before you start:
1919

20-
* Install the appropriate SDK for your application: [ASP.NET](asp-net.md), [ASP.NET Core](asp-net-core.md), [Non HTTP/Worker for .NET/.NET Core](worker-service.md), [Java](../../azure-monitor/app/java-get-started.md) or [JavaScript](javascript.md)
20+
* Install the appropriate SDK for your application: [ASP.NET](asp-net.md), [ASP.NET Core](asp-net-core.md), [Non HTTP/Worker for .NET/.NET Core](worker-service.md), or [JavaScript](javascript.md)
2121

2222
<a name="filtering"></a>
2323

@@ -81,8 +81,8 @@ Insert this snippet in ApplicationInsights.config:
8181
```xml
8282
<TelemetryProcessors>
8383
<Add Type="WebApplication9.SuccessfulDependencyFilter, WebApplication9">
84-
<!-- Set public property -->
85-
<MyParamFromConfigFile>2-beta</MyParamFromConfigFile>
84+
<!-- Set public property -->
85+
<MyParamFromConfigFile>2-beta</MyParamFromConfigFile>
8686
</Add>
8787
</TelemetryProcessors>
8888
```
@@ -200,7 +200,7 @@ public void Process(ITelemetry item)
200200
```JS
201201
var filteringFunction = (envelope) => {
202202
if (envelope.data.someField === 'tobefilteredout') {
203-
return false;
203+
return false;
204204
}
205205

206206
return true;
@@ -241,24 +241,24 @@ namespace MvcWebRole.Telemetry
241241
*/
242242
public class MyTelemetryInitializer : ITelemetryInitializer
243243
{
244-
public void Initialize(ITelemetry telemetry)
245-
{
246-
var requestTelemetry = telemetry as RequestTelemetry;
247-
// Is this a TrackRequest() ?
248-
if (requestTelemetry == null) return;
249-
int code;
250-
bool parsed = Int32.TryParse(requestTelemetry.ResponseCode, out code);
251-
if (!parsed) return;
252-
if (code >= 400 && code < 500)
253-
{
254-
// If we set the Success property, the SDK won't change it:
255-
requestTelemetry.Success = true;
256-
257-
// Allow us to filter these requests in the portal:
258-
requestTelemetry.Properties["Overridden400s"] = "true";
259-
}
260-
// else leave the SDK to set the Success property
261-
}
244+
public void Initialize(ITelemetry telemetry)
245+
{
246+
var requestTelemetry = telemetry as RequestTelemetry;
247+
// Is this a TrackRequest() ?
248+
if (requestTelemetry == null) return;
249+
int code;
250+
bool parsed = Int32.TryParse(requestTelemetry.ResponseCode, out code);
251+
if (!parsed) return;
252+
if (code >= 400 && code < 500)
253+
{
254+
// If we set the Success property, the SDK won't change it:
255+
requestTelemetry.Success = true;
256+
257+
// Allow us to filter these requests in the portal:
258+
requestTelemetry.Properties["Overridden400s"] = "true";
259+
}
260+
// else leave the SDK to set the Success property
261+
}
262262
}
263263
}
264264
```
@@ -270,9 +270,9 @@ In ApplicationInsights.config:
270270
```xml
271271
<ApplicationInsights>
272272
<TelemetryInitializers>
273-
<!-- Fully qualified type name, assembly name: -->
274-
<Add Type="MvcWebRole.Telemetry.MyTelemetryInitializer, MvcWebRole"/>
275-
...
273+
<!-- Fully qualified type name, assembly name: -->
274+
<Add Type="MvcWebRole.Telemetry.MyTelemetryInitializer, MvcWebRole"/>
275+
...
276276
</TelemetryInitializers>
277277
</ApplicationInsights>
278278
```
@@ -331,40 +331,40 @@ Insert a telemetry initializer immediately after the initialization code that yo
331331

332332
```JS
333333
<script type="text/javascript">
334-
// ... initialization code
335-
...({
336-
instrumentationKey: "your instrumentation key"
337-
});
338-
window.appInsights = appInsights;
334+
// ... initialization code
335+
...({
336+
instrumentationKey: "your instrumentation key"
337+
});
338+
window.appInsights = appInsights;
339339

340340

341-
// Adding telemetry initializer.
342-
// This is called whenever a new telemetry item
343-
// is created.
341+
// Adding telemetry initializer.
342+
// This is called whenever a new telemetry item
343+
// is created.
344344

345-
appInsights.queue.push(function () {
346-
appInsights.context.addTelemetryInitializer(function (envelope) {
347-
var telemetryItem = envelope.data.baseData;
345+
appInsights.queue.push(function () {
346+
appInsights.context.addTelemetryInitializer(function (envelope) {
347+
var telemetryItem = envelope.data.baseData;
348348

349-
// To check the telemetry items type - for example PageView:
350-
if (envelope.name == Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType) {
351-
// this statement removes url from all page view documents
352-
telemetryItem.url = "URL CENSORED";
353-
}
349+
// To check the telemetry items type - for example PageView:
350+
if (envelope.name == Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType) {
351+
// this statement removes url from all page view documents
352+
telemetryItem.url = "URL CENSORED";
353+
}
354354

355-
// To set custom properties:
356-
telemetryItem.properties = telemetryItem.properties || {};
357-
telemetryItem.properties["globalProperty"] = "boo";
355+
// To set custom properties:
356+
telemetryItem.properties = telemetryItem.properties || {};
357+
telemetryItem.properties["globalProperty"] = "boo";
358358

359-
// To set custom metrics:
360-
telemetryItem.measurements = telemetryItem.measurements || {};
361-
telemetryItem.measurements["globalMetric"] = 100;
362-
});
363-
});
359+
// To set custom metrics:
360+
telemetryItem.measurements = telemetryItem.measurements || {};
361+
telemetryItem.measurements["globalMetric"] = 100;
362+
});
363+
});
364364

365-
// End of inserted code.
365+
// End of inserted code.
366366

367-
appInsights.trackPageView();
367+
appInsights.trackPageView();
368368
</script>
369369
```
370370

@@ -381,7 +381,7 @@ Telemetry processors in OpenCensus Python are simply callback functions called t
381381
382382
```python
383383
def callback_function(envelope):
384-
envelope.tags['ai.cloud.role'] = 'new_role_name.py'
384+
envelope.tags['ai.cloud.role'] = 'new_role_name.py'
385385
```
386386

387387
```python
@@ -394,8 +394,8 @@ logger = logging.getLogger(__name__)
394394

395395
# Callback function to append '_hello' to each log message telemetry
396396
def callback_function(envelope):
397-
envelope.data.baseData.message += '_hello'
398-
return True
397+
envelope.data.baseData.message += '_hello'
398+
return True
399399

400400
handler = AzureLogHandler(connection_string='InstrumentationKey=<your-instrumentation_key-here>')
401401
handler.add_telemetry_processor(callback_function)
@@ -415,11 +415,11 @@ config_integration.trace_integrations(['requests'])
415415

416416
# Callback function to add os_type: linux to span properties
417417
def callback_function(envelope):
418-
envelope.data.baseData.properties['os_type'] = 'linux'
419-
return True
418+
envelope.data.baseData.properties['os_type'] = 'linux'
419+
return True
420420

421421
exporter = AzureExporter(
422-
connection_string='InstrumentationKey=<your-instrumentation-key-here>'
422+
connection_string='InstrumentationKey=<your-instrumentation-key-here>'
423423
)
424424
exporter.add_telemetry_processor(callback_function)
425425
tracer = Tracer(exporter=exporter, sampler=ProbabilitySampler(1.0))

0 commit comments

Comments
 (0)