public StatsdData BuildStatsData(StatsdConfig config) { var endPoint = BuildEndPoint(config); var transportData = CreateTransportData(endPoint, config); var transport = transportData.Transport; var globalTags = GetGlobalTags(config); var telemetry = CreateTelemetry(config, globalTags, endPoint, transportData.Transport); var serializers = CreateSerializers(config.Prefix, globalTags, config.Advanced.MaxMetricsInAsyncQueue); var statsBufferize = CreateStatsBufferize( telemetry, transportData.Transport, transportData.BufferCapacity, config.Advanced, serializers, config.ClientSideAggregation); var metricsSender = new MetricsSender( statsBufferize, new RandomGenerator(), new StopWatchFactory(), telemetry, config.StatsdTruncateIfTooLong, config.Advanced.MaxMetricsInAsyncQueue * 2); return(new StatsdData(metricsSender, statsBufferize, transport, telemetry)); }
public StatsdData( MetricsSender metricsSender, StatsBufferize statsBufferize, ITransport transport, Telemetry telemetry) { MetricsSender = metricsSender; Telemetry = telemetry; _statsBufferize = statsBufferize; _transport = transport; }
/// <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; }