/// <summary> /// Initializes a new instance of the <see cref="ApplicationInsightsReporter"/> class. /// </summary> /// <param name="options"> /// Configuration for <see cref="ApplicationInsightsReporter"/>. /// </param> public ApplicationInsightsReporter(ApplicationInsightsReporterOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } clientCfg = new TelemetryConfiguration(options.InstrumentationKey); client = new TelemetryClient(clientCfg); FlushInterval = options.FlushInterval > TimeSpan.Zero ? options.FlushInterval : AppMetricsConstants.Reporting.DefaultFlushInterval; Filter = options.Filter; Logger.Info($"Using metrics reporter {nameof(ApplicationInsightsReporter)}. FlushInterval: {FlushInterval}"); }
/// <summary> /// Initializes a new instance of the <see cref="ApplicationInsightsReporter"/> class. /// </summary> /// <param name="options"> /// Configuration for <see cref="ApplicationInsightsReporter"/>. /// </param> /// <param name="translator"></param> public ApplicationInsightsReporter(ApplicationInsightsReporterOptions options, IMetricsTranslator translator) { if (options == null) { throw new ArgumentNullException(nameof(options)); } this.translator = translator ?? throw new ArgumentNullException(nameof(translator)); clientCfg = new TelemetryConfiguration(options.InstrumentationKey, options.ITelemetryChannel); client = new TelemetryClient(clientCfg); FlushInterval = options.FlushInterval > TimeSpan.Zero ? options.FlushInterval : AppMetricsConstants.Reporting.DefaultFlushInterval; if (options.Filter != null) { Filter = options.Filter; } Logger.Info($"Using metrics reporter {nameof(ApplicationInsightsReporter)}. FlushInterval: {FlushInterval}"); }