Пример #1
0
        /// <summary>
        /// Configures the instance.
        /// Must be called before any other methods.
        /// </summary>
        /// <param name="config">The value of the config.</param>
        public void Configure(StatsdConfig config)
        {
            if (_statsdBuilder == null)
            {
                throw new ObjectDisposedException(nameof(DogStatsdService));
            }

            if (config == null)
            {
                throw new ArgumentNullException("config");
            }

            if (_config != null)
            {
                throw new InvalidOperationException("Configuration for DogStatsdService already performed");
            }

            _config        = config;
            _statsdData    = _statsdBuilder.BuildStatsData(config);
            _metricsSender = _statsdData.MetricsSender;
        }
Пример #2
0
 /// <summary>
 /// Disposes an instance of DogStatsdService.
 /// Flushes all metrics.
 /// </summary>
 public void Dispose()
 {
     _statsdData?.Dispose();
     _statsdData = null;
 }