コード例 #1
0
 /// <summary>
 /// Construct a factory
 /// </summary>
 /// <param name="telemetryClient">The telemetry client to send telemetry to</param>
 /// <param name="settings">Telemetry settings</param>
 public MongoClientFactory(
     TelemetryClient telemetryClient           = null,
     MongoApplicationInsightsSettings settings = null)
 {
     _telemetryClient = telemetryClient;
     Settings         = settings ?? new MongoApplicationInsightsSettings();
 }
 public MongoApplicationInsightsTelemetry(
     MongoClientSettings clientSettings,
     TelemetryClient telemetryClient,
     MongoApplicationInsightsSettings settings
     )
 {
     if (clientSettings == null)
     {
         throw new ArgumentNullException(nameof(clientSettings));
     }
     _settings        = settings ?? throw new ArgumentNullException(nameof(settings));
     _telemetryClient = telemetryClient ?? throw new ArgumentNullException(nameof(telemetryClient));
     clientSettings.ClusterConfigurator = clusterConfigurator =>
     {
         clusterConfigurator.Subscribe <CommandStartedEvent>(OnCommandStarted);
         clusterConfigurator.Subscribe <CommandSucceededEvent>(OnCommandSucceeded);
         clusterConfigurator.Subscribe <CommandFailedEvent>(OnCommandFailed);
     };
     _nextPruneTime = DateTime.UtcNow.Add(_settings.MaxQueryTime);
 }