Beispiel #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;
        }
Beispiel #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);
        }