Skip to content

Commit 8e36261

Browse files
Filter out cloud RoleInstance (#207)
1 parent 563450e commit 8e36261

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

src/Telemetry/Telemetry.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ private void InitializeTelemetry(string productVersion, IConfiguration config)
6767
try
6868
{
6969
var telemetryConfig = new TelemetryConfiguration(InstrumentationKey);
70+
telemetryConfig.TelemetryInitializers.Add(new TelemetryInitializer());
7071
this._client = new TelemetryClient(telemetryConfig);
7172
this._client.Context.Session.Id = CurrentSessionId;
7273
this._client.Context.Device.OperatingSystem = RuntimeInformation.OSDescription;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See License.txt in the project root for license information.
3+
4+
using Microsoft.ApplicationInsights.Channel;
5+
using Microsoft.ApplicationInsights.Extensibility;
6+
7+
namespace Microsoft.Azure.WebJobs.Extensions.Sql.Telemetry
8+
{
9+
public class TelemetryInitializer : ITelemetryInitializer
10+
{
11+
public void Initialize(ITelemetry telemetry)
12+
{
13+
// Filter out the Cloud RoleInstance - we don't care about that field and
14+
// it can contain information such as the machine and domain name of the client
15+
telemetry.Context.Cloud.RoleInstance = "-";
16+
}
17+
}
18+
19+
}

0 commit comments

Comments
 (0)