Ejemplo 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;
        }
Ejemplo n.º 2
0
        protected internal void HandleHeapEvent(CLRRuntimeSource.HeapMetrics metrics)
        {
            var context = default(SpanContext);

            _memoryUsed.Record(context, metrics.TotalMemory, _memoryLabels);
            for (int i = 0; i < metrics.CollectionCounts.Count; i++)
            {
                var count = metrics.CollectionCounts[i];
                if (_previous.CollectionCounts != null && i < _previous.CollectionCounts.Count && _previous.CollectionCounts[i] <= count)
                {
                    count -= _previous.CollectionCounts[i];
                }

                var genKeylabelSet = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>(_generationKey, GENERATION_TAGVALUE_NAME + i.ToString())
                };
                _collectionCount.Record(context, count, genKeylabelSet);
            }

            _previous = metrics;
        }