예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ApplicationInsightsPipelineHandler" /> class.
        /// </summary>
        public ApplicationInsightsPipelineHandler(ILogger <ApplicationInsightsPipelineHandler> logger,
                                                  TelemetryClient telemetryClient,
                                                  IOptions <ApplicationInsightsPipelineOption> options)
        {
            _telemetryClient = telemetryClient;
            _logger          = logger;
            _options         = options.Value;

            if (string.IsNullOrEmpty(_options.Path))
            {
                _logger.LogDebug("The path is null or empty, initializing with default AWS whitelist.");
                InitWithDefaultAWSWhitelist();
            }
            else
            {
                using (Stream stream = new FileStream(_options.Path, FileMode.Open, FileAccess.Read))
                {
                    Init(stream);
                }
            }

            _jsonSerializerSettings = new JsonSerializerSettings();
            _jsonSerializerSettings.ContractResolver      = new SimpleTypeContractResolver();
            _jsonSerializerSettings.DefaultValueHandling  = DefaultValueHandling.Ignore;
            _jsonSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
        }
예제 #2
0
 public ApplicationInsightsPipelineCustomizer(IServiceProvider serviceProvider, IOptions <ApplicationInsightsPipelineOption> options)
 {
     _serviceProvider = serviceProvider;
     _option          = options.Value;
 }