Skip to content

Commit

Permalink
Filter out more default telemetry properties
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles-Gagnon committed Mar 31, 2023
1 parent 8ef2763 commit d6ea6d7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 20 deletions.
9 changes: 8 additions & 1 deletion src/Telemetry/Telemetry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using Microsoft.Extensions.Configuration;
using System.Globalization;
using Microsoft.Data.SqlClient;
using Microsoft.ApplicationInsights.Extensibility.Implementation;

namespace Microsoft.Azure.WebJobs.Extensions.Sql.Telemetry
{
Expand Down Expand Up @@ -72,10 +73,16 @@ private void InitializeTelemetry(string productVersion, IConfiguration config)
{
ConnectionString = $"InstrumentationKey={InstrumentationKey};"
};
telemetryConfig.TelemetryInitializers.Add(new TelemetryInitializer());
this._client = new TelemetryClient(telemetryConfig);
this._client.Context.Session.Id = CurrentSessionId;
this._client.Context.Device.OperatingSystem = RuntimeInformation.OSDescription;
// Filter out sensitive information that we don't need
// RoleInstance - It can contain information such as the machine and domain name of the client
// NodeName - It can contain information such as the machine and domain name of the client
// Ip - We don't need any location info
this._client.Context.Cloud.RoleInstance = "-";
this._client.Context.GetInternalContext().NodeName = "-";
this._client.Context.Location.Ip = "0.0.0.0";

this._commonProperties = new TelemetryCommonProperties(productVersion, this._client, config).GetTelemetryCommonProperties();
this._commonMeasurements = new Dictionary<string, double>();
Expand Down
19 changes: 0 additions & 19 deletions src/Telemetry/TelemetryInitializer.cs

This file was deleted.

0 comments on commit d6ea6d7

Please sign in to comment.