Esempio n. 1
0
        protected internal void HandleHeapEvent(CLRRuntimeSource.HeapMetrics metrics)
        {
            StatsRecorder
            .NewMeasureMap()
            .Put(memoryUsedMeasure, metrics.TotalMemory)
            .Record(memoryTagValues);

            for (int i = 0; i < metrics.CollectionCounts.Count; i++)
            {
                var count = metrics.CollectionCounts[i];
                if (previous.CollectionCounts != null && i < previous.CollectionCounts.Count)
                {
                    if (previous.CollectionCounts[i] <= count)
                    {
                        count = count - previous.CollectionCounts[i];
                    }
                }

                var tagContext = Tagger
                                 .EmptyBuilder
                                 .Put(generationKey, TagValue.Create(GENERATION_TAGVALUE_NAME + i.ToString()))
                                 .Build();

                StatsRecorder
                .NewMeasureMap()
                .Put(collectionCountMeasure, count)
                .Record(tagContext);
            }

            previous = metrics;
        }
Esempio n. 2
0
        protected internal void HandleStopEvent(Activity current, HttpContext arg)
        {
            if (ShouldIgnoreRequest(arg.Request.Path))
            {
                Logger?.LogDebug("HandleStopEvent: Ignoring path: {path}", arg.Request.Path);
                return;
            }

            // attempt to calculate a duration if a start time is provided
            TimeSpan duration = current.Duration;

            if (current.Duration.Ticks == 0)
            {
                duration = DateTime.UtcNow - current.StartTimeUtc;
            }

            if (duration.TotalMilliseconds > 0)
            {
                ITagContext tagContext = GetTagContext(arg);
                StatsRecorder
                .NewMeasureMap()
                .Put(responseTimeMeasure, duration.TotalMilliseconds)
                .Put(serverCountMeasure, 1)
                .Record(tagContext);
            }
        }
Esempio n. 3
0
        protected internal void HandleThreadsEvent(CLRRuntimeSource.ThreadMetrics metrics)
        {
            var activeWorkers  = metrics.MaxThreadPoolWorkers - metrics.AvailableThreadPoolWorkers;
            var activeCompPort = metrics.MaxThreadCompletionPort - metrics.AvailableThreadCompletionPort;

            StatsRecorder
            .NewMeasureMap()
            .Put(activeThreadsMeasure, activeWorkers)
            .Put(availThreadsMeasure, metrics.AvailableThreadPoolWorkers)
            .Record(threadPoolWorkerTagValues);

            StatsRecorder
            .NewMeasureMap()
            .Put(activeThreadsMeasure, activeCompPort)
            .Put(availThreadsMeasure, metrics.AvailableThreadCompletionPort)
            .Record(threadPoolCompPortTagValues);
        }
Esempio n. 4
0
        protected internal void HandleStopEvent(Activity current, HttpWebRequest request, HttpStatusCode statusCode)
        {
            if (ShouldIgnoreRequest(request.RequestUri.AbsolutePath))
            {
                Logger?.LogDebug("HandleStopEvent: Ignoring path: {path}", request.RequestUri.AbsolutePath);
                return;
            }

            if (current.Duration.TotalMilliseconds > 0)
            {
                ITagContext tagContext = GetTagContext(request, statusCode);
                StatsRecorder
                .NewMeasureMap()
                .Put(clientTimeMeasure, current.Duration.TotalMilliseconds)
                .Put(clientCountMeasure, 1)
                .Record(tagContext);
            }
        }
Esempio n. 5
0
        protected internal void HandleStopEvent(Activity current, IOwinContext arg)
        {
            if (ShouldIgnoreRequest(arg.Request.Path.Value))
            {
                Logger?.LogDebug("HandleStopEvent: Ignoring path: {path}", arg.Request.Path.Value);
                return;
            }

            if (current.Duration.TotalMilliseconds > 0)
            {
                ITagContext tagContext = GetTagContext(arg);
                StatsRecorder
                .NewMeasureMap()
                .Put(responseTimeMeasure, current.Duration.TotalMilliseconds)
                .Put(serverCountMeasure, 1)
                .Record(tagContext);
            }
        }
        protected internal void HandleStopEvent(Activity current, HttpRequestMessage request, HttpResponseMessage response, TaskStatus taskStatus)
        {
            if (ShouldIgnoreRequest(request.RequestUri.AbsolutePath))
            {
                Logger?.LogDebug("HandleStopEvent: Ignoring path: {path}", SecurityUtilities.SanitizeInput(request.RequestUri.AbsolutePath));
                return;
            }

            if (current.Duration.TotalMilliseconds > 0)
            {
                ITagContext tagContext = GetTagContext(request, response, taskStatus);
                StatsRecorder
                .NewMeasureMap()
                .Put(clientTimeMeasure, current.Duration.TotalMilliseconds)
                .Put(clientCountMeasure, 1)
                .Record(tagContext);
            }
        }