예제 #1
0
        public void ReportReceivedBatch(
            string contentType,
            string contentEncoding,
            int contentLength,
            int batchSize,
            int[] logEventSizes)
        {
            if (Start == null)
            {
                Start = _clock.Now;
            }

            // Request
            ContentType     = contentType;
            ContentEncoding = contentEncoding;
            ContentLength.Update(contentLength);

            // Batch
            BatchSize.Update(batchSize);
            _batchDistribution.AddOrUpdate(
                SizeBucketConverter.From(batchSize),
                1,
                (key, oldValue) => oldValue + 1);

            // Log events
            LogEventsPerBatch.Update(logEventSizes.Length);

            foreach (var logEventSize in logEventSizes)
            {
                LogEventSize.Update(logEventSize);

                var sizeBucket = SizeBucketConverter.From(logEventSize);
                _logEventDistribution.AddOrUpdate(sizeBucket, 1, (key, oldValue) => oldValue + 1);
            }
        }
예제 #2
0
        public void ReturnLogEventSize(int logEventSize, SizeBucket want)
        {
            // Act
            var got = SizeBucketConverter.From(logEventSize);

            // Assert
            got.ShouldBe(want);
        }