Example #1
0
        private StatsBufferize CreateStatsBufferize(
            Telemetry telemetry,
            ITransport transport,
            int bufferCapacity,
            AdvancedStatsConfig config)
        {
            var bufferHandler = new BufferBuilderHandler(telemetry, transport);
            var bufferBuilder = new BufferBuilder(bufferHandler, bufferCapacity, "\n");

            var statsBufferize = _factory.CreateStatsBufferize(
                bufferBuilder,
                config.MaxMetricsInAsyncQueue,
                config.MaxBlockDuration,
                config.DurationBeforeSendingNotFullBuffer);

            return statsBufferize;
        }
Example #2
0
        private StatsBufferize CreateStatsBufferize(
            Telemetry telemetry,
            ITransport transport,
            int bufferCapacity,
            AdvancedStatsConfig config,
            Serializers serializers,
            ClientSideAggregationConfig optionalClientSideAggregationConfig)
        {
            var bufferHandler = new BufferBuilderHandler(telemetry, transport);
            var bufferBuilder = new BufferBuilder(bufferHandler, bufferCapacity, "\n");

            Aggregators optionalAggregators = null;

            if (optionalClientSideAggregationConfig != null)
            {
                var parameters = new MetricAggregatorParameters(
                    serializers.MetricSerializer,
                    bufferBuilder,
                    optionalClientSideAggregationConfig.MaxUniqueStatsBeforeFlush,
                    optionalClientSideAggregationConfig.FlushInterval);

                optionalAggregators = new Aggregators
                {
                    OptionalCount = new CountAggregator(parameters),
                    OptionalGauge = new GaugeAggregator(parameters),
                    OptionalSet   = new SetAggregator(parameters, telemetry),
                };
            }

            var statsRouter = _factory.CreateStatsRouter(serializers, bufferBuilder, optionalAggregators);

            var statsBufferize = _factory.CreateStatsBufferize(
                statsRouter,
                config.MaxMetricsInAsyncQueue,
                config.MaxBlockDuration,
                config.DurationBeforeSendingNotFullBuffer);

            return(statsBufferize);
        }
Example #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StatsdConfig"/> class.
 /// </summary>
 public StatsdConfig()
 {
     StatsdPort             = 0;
     StatsdMaxUDPPacketSize = DefaultStatsdMaxUDPPacketSize;
     Advanced = new AdvancedStatsConfig();
 }