public TelemetryClientProvider(ITelemetrySettings settings) { var configuration = TelemetryConfiguration.CreateDefault(); configuration.TelemetryChannel.DeveloperMode = settings.IsDeveloperMode; configuration.InstrumentationKey = settings.ApiKey; configuration.DisableTelemetry = !settings.IsEnabled; TelemetryClient = new TelemetryClient(configuration); }
public TelemetryClientProvider (ITelemetrySettings settings) { var configuration = TelemetryConfiguration.CreateDefault(); configuration.TelemetryChannel.DeveloperMode = settings.IsDeveloperMode; configuration.InstrumentationKey = settings.ApiKey; configuration.DisableTelemetry = !settings.IsEnabled; TelemetryClient = new TelemetryClient (configuration); }
public static void InitializeTelemetry() { string dll = Assembly.GetEntryAssembly().GetName().Name; if (dll == "aggregator-cli") { telemetrySettings = CliTelemetrySettings.Get(); WaitAtShutdown = false; } else if (dll == "aggregator-host") { telemetrySettings = HostTelemetrySettings.Get(); WaitAtShutdown = true; } else { // another option would be to disable telemetry throw new InvalidOperationException("Telemetry can be used only in CLI or Host"); } TelemetryConfiguration configuration = TelemetryConfiguration.CreateDefault(); configuration.InstrumentationKey = ApplicationInsightsKey; // use default InMemory channel, if there are network issues, who cares configuration.TelemetryChannel.DeveloperMode = Debugger.IsAttached; #if DEBUG configuration.TelemetryChannel.DeveloperMode = true; #endif Enabled = telemetrySettings.Enabled; if (Enabled) { telemetryClient = new TelemetryClient(configuration); // this is portable telemetryClient.Context.User.Id = telemetrySettings.UserId; // this is time based, cannot be a new one at each run telemetryClient.Context.Session.Id = telemetrySettings.SessionId; telemetryClient.Context.Session.IsFirst = telemetrySettings.IsNewSession; ///Environment.Is64BitOperatingSystem; telemetryClient.Context.Device.OperatingSystem = Environment.OSVersion.ToString(); telemetryClient.Context.Device.Id = telemetrySettings.DeviceId; telemetryClient.Context.Component.Version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); Trace.WriteLine(string.Format("SessionID: {0}", telemetryClient.Context.Session.Id)); } }
public TelemetrySettings(ITelemetrySettings previousSettings) { InstrumentationKey = previousSettings.InstrumentationKey; ApplicationWideLogCollectionIsEnabled = previousSettings.ApplicationWideLogCollectionIsEnabled; }
public TelemetrySettings(ITelemetrySettings previousSettings) { InstrumentationKey = previousSettings.InstrumentationKey; }