Exemplo n.º 1
0
        protected override void Harvest()
        {
            IDictionary <long, SqlTraceWireModel> oldSqlTraces;

            lock (_sqlTraceLock)
            {
                oldSqlTraces   = _sqlTraceStats.Collection;
                _sqlTraceStats = new SqlTraceStatsCollection();
            }

            var slowestTraces = oldSqlTraces.Values
                                .Where(trace => trace != null)
                                .OrderByDescending(trace => trace.MaxCallTime)
                                .Take(_configuration.SqlTracesPerPeriod)
                                .ToList();

            if (!slowestTraces.Any())
            {
                return;
            }

            var responseStatus = DataTransportService.Send(slowestTraces);

            HandleResponse(responseStatus, slowestTraces);
        }
Exemplo n.º 2
0
        protected override void Harvest()
        {
            ConcurrentPriorityQueue <PrioritizedNode <CustomEventWireModel> > originalCustomEvents;

            _readerWriterLockSlim.EnterWriteLock();
            try
            {
                originalCustomEvents = GetAndResetCollection(_customEvents.Size);
            }
            finally
            {
                _readerWriterLockSlim.ExitWriteLock();
            }

            var customEvents = originalCustomEvents.Where(node => node != null).Select(node => node.Data).ToList();

            // if we don't have any events to publish then don't
            if (customEvents.Count <= 0)
            {
                return;
            }

            var responseStatus = DataTransportService.Send(customEvents);

            HandleResponse(responseStatus, customEvents);
        }
        protected override void Harvest()
        {
            ConcurrentPriorityQueue <PrioritizedNode <ISpanEventWireModel> > spanEventsPriorityQueue;

            _readerWriterLockSlim.EnterWriteLock();
            try
            {
                spanEventsPriorityQueue = GetAndResetCollection();
            }
            finally
            {
                _readerWriterLockSlim.ExitWriteLock();
            }

            var eventHarvestData = new EventHarvestData(spanEventsPriorityQueue.Size, spanEventsPriorityQueue.GetAddAttemptsCount());
            var wireModels       = spanEventsPriorityQueue.Where(node => null != node).Select(node => node.Data).ToList();

            // if we don't have any events to publish then don't
            if (wireModels.Count <= 0)
            {
                return;
            }

            var responseStatus = DataTransportService.Send(eventHarvestData, wireModels);

            HandleResponse(responseStatus, wireModels);
        }
        protected override void Harvest()
        {
            ConcurrentPriorityQueue <PrioritizedNode <ErrorEventWireModel> > originalErrorEvents;
            ConcurrentList <ErrorEventWireModel> originalSyntheticsErrorEvents;

            _readerWriterLock.EnterWriteLock();
            try
            {
                originalErrorEvents           = GetAndResetErrorEvents(GetReservoirSize());
                originalSyntheticsErrorEvents = GetAndResetSyntheticsErrorEvents();
            }
            finally
            {
                _readerWriterLock.ExitWriteLock();
            }

            var errorEvents      = originalErrorEvents.Where(node => node != null).Select(node => node.Data).ToList();
            var aggregatedEvents = errorEvents.Union(originalSyntheticsErrorEvents).ToList();

            // Retrieve the number of add attempts before resetting the collection.
            var eventHarvestData = new EventHarvestData(originalErrorEvents.Size, originalErrorEvents.GetAddAttemptsCount());

            // if we don't have any events to publish then don't
            if (aggregatedEvents.Count <= 0)
            {
                return;
            }

            var responseStatus = DataTransportService.Send(eventHarvestData, aggregatedEvents);

            HandleResponse(responseStatus, aggregatedEvents);
        }
Exemplo n.º 5
0
        protected override void Harvest()
        {
            IResizableCappedCollection <PrioritizedNode <TransactionEventWireModel> > originalTransactionEvents;
            ConcurrentList <TransactionEventWireModel> originalSyntheticsTransactionEvents;

            _readerWriterLock.EnterWriteLock();
            try
            {
                originalTransactionEvents           = GetAndResetRegularTransactionEvents(_transactionEvents.Size);
                originalSyntheticsTransactionEvents = GetAndResetSyntheticsTransactionEvents();
            }
            finally
            {
                _readerWriterLock.ExitWriteLock();
            }

            var transactionEvents = originalTransactionEvents.Where(node => node != null).Select(node => node.Data).ToList();
            var aggregatedEvents  = transactionEvents.Union(originalSyntheticsTransactionEvents).ToList();

            // EventHarvestData is required for extrapolation in the UI.
            var eventHarvestData = new EventHarvestData(originalTransactionEvents.Size, originalTransactionEvents.GetAddAttemptsCount());

            // if we don't have any events to publish then don't
            if (aggregatedEvents.Count <= 0)
            {
                return;
            }

            var responseStatus = DataTransportService.Send(eventHarvestData, aggregatedEvents);

            HandleResponse(responseStatus, aggregatedEvents);
        }
Exemplo n.º 6
0
        protected override void Harvest()
        {
            var traces = _transactionCollectors
                         .Where(t => t != null)
                         .SelectMany(t => t.GetCollectedSamples())
                         .Distinct()
                         .Select(t => t.CreateWireModel())
                         .ToList();

            if (!traces.Any())
            {
                return;
            }

            LogUnencodedTraceData(traces);

            var responseStatus = DataTransportService.Send(traces);

            HandleResponse(responseStatus, traces);
        }
        protected override void Harvest()
        {
            Log.Info("Metric harvest starting.");

            foreach (var source in _outOfBandMetricSources)
            {
                source.CollectMetrics();
            }

            var oldMetrics = GetStatsEngineForHarvest();

            oldMetrics.MergeUnscopedStats(_metricBuilder.TryBuildMetricHarvestAttemptMetric());
            var metricsToSend = oldMetrics.ConvertToJsonForSending(_metricNameService);

            var responseStatus = DataTransportService.Send(metricsToSend);

            HandleResponse(responseStatus, metricsToSend);

            Log.Debug("Metric harvest finished.");
        }
        protected override void Harvest()
        {
            ICollection <ErrorTraceWireModel> errorTraceWireModels;

            _readerWriterLock.EnterWriteLock();
            try
            {
                errorTraceWireModels = GetAndResetCollection();
            }
            finally
            {
                _readerWriterLock.ExitWriteLock();
            }

            if (errorTraceWireModels.Count <= 0)
            {
                return;
            }

            var responseStatus = DataTransportService.Send(errorTraceWireModels);

            HandleResponse(responseStatus, errorTraceWireModels);
        }