Пример #1
0
 public UnsupportedEventParserLevelException(Type eventParserType, CaptureLevel specifiedLevel, ISet <EventLevel> supportedLevels)
     : base($"The event parser '{eventParserType.Name}' does not support the level '{specifiedLevel}'- please use one of: {string.Join(", ", supportedLevels)}")
 {
     EventParserType = eventParserType;
     SpecifiedLevel  = specifiedLevel;
     SupportedLevels = supportedLevels;
 }
        public static ListenerRegistration Create <T>(CaptureLevel level, Func <IServiceProvider, T> factory)
            where T : IEventListener
        {
            var supportedLevels = EventParserTypes.GetLevelsFromParser(typeof(T));
            var eventLevel      = level.ToEventLevel();

            if (!supportedLevels.Contains(eventLevel))
            {
                throw new UnsupportedEventParserLevelException(typeof(T), level, supportedLevels);
            }


            return(new ListenerRegistration(eventLevel, typeof(T), sp => (object)factory(sp)));
        }
Пример #3
0
        public PrometheusMetricsProvider AddDotNetRuntimeStats(
            CaptureLevel contentionCaptureLevel = CaptureLevel.Counters,
            SampleEvery contentionSampleRate    = SampleEvery.TenEvents,
            CaptureLevel jitCaptureLevel        = CaptureLevel.Counters,
            SampleEvery jitSampleRate           = SampleEvery.HundredEvents,
            CaptureLevel threadPoolCaptureLevel = CaptureLevel.Counters,
            ThreadPoolMetricsProducer.Options threadPoolOptions = null)
        {
            if (_collector == null)
            {
                _collector = DotNetRuntimeStatsBuilder
                             .Customize()
                             .WithContentionStats(contentionCaptureLevel, contentionSampleRate)
                             .WithJitStats(jitCaptureLevel, jitSampleRate)
                             .WithThreadPoolStats(threadPoolCaptureLevel, threadPoolOptions)
                             .WithGcStats()
                             .StartCollecting();
            }

            return(this);
        }
Пример #4
0
 public record Source(MethodInfo Method, CaptureLevel Level)
 {
Пример #5
0
 public UnsupportedCaptureLevelException(CaptureLevel specifiedLevel, ISet <CaptureLevel> supportedLevels)
     : base($"The level '{specifiedLevel}' is not supported- please use one of: {string.Join(", ", supportedLevels)}")
 {
     SpecifiedLevel  = specifiedLevel;
     SupportedLevels = supportedLevels;
 }
Пример #6
0
 internal static EventLevel ToEventLevel(this CaptureLevel level)
 {
     return((EventLevel)(int)level);
 }