示例#1
0
        public override void Start()
        {
            _monitors.addMonitorListener(_listener);

            LogRotationMonitor monitor = this._logRotationMonitorSupplier.get();

            _registry.register(LogRotationEvents, (Gauge <long>)monitor.numberOfLogRotationEvents);
            _registry.register(LogRotationTotalTime, (Gauge <long>)monitor.logRotationAccumulatedTotalTimeMillis);
        }
示例#2
0
        public override void Start()
        {
            _monitors.addMonitorListener(_listener);

            CheckPointerMonitor checkPointerMonitor = _checkPointerMonitorSupplier.get();

            _registry.register(CheckPointEvents, (Gauge <long>)checkPointerMonitor.numberOfCheckPointEvents);
            _registry.register(CheckPointTotalTime, (Gauge <long>)checkPointerMonitor.checkPointAccumulatedTotalTimeMillis);
        }
示例#3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void metricsRegisteredAfterStartShouldBeIncluded() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MetricsRegisteredAfterStartShouldBeIncluded()
        {
            MetricRegistry registry = new MetricRegistry();
            DynamicAddressPrometheusOutput dynamicOutput = new DynamicAddressPrometheusOutput("localhost", registry, mock(typeof(Log)));

            System.Action <long> callback = l =>
            {
                SortedDictionary <string, Gauge> gauges = new SortedDictionary <string, Gauge>();
                gauges.put("my.event", () => l);
                dynamicOutput.Report(gauges, emptySortedMap(), emptySortedMap(), emptySortedMap(), emptySortedMap());
            };

            registry.register("my.metric", ( Gauge )() => 10);

            dynamicOutput.Init();
            dynamicOutput.Start();

            callback(20);

            string serverAddress = dynamicOutput.ServerAddress;
            string response      = GetResponse(serverAddress);

            assertTrue(response.Contains("my_metric 10.0"));
            assertTrue(response.Contains("my_event 20.0"));
        }
示例#4
0
        public override void Report(SortedDictionary <string, Gauge> gauges, SortedDictionary <string, Counter> counters, SortedDictionary <string, Histogram> histograms, SortedDictionary <string, Meter> meters, SortedDictionary <string, Timer> timers)
        {
            // Prometheus does not support events, just output the latest event that occurred
            string metricKey = gauges.firstKey();

            if (!_registeredEvents.ContainsKey(metricKey))
            {
                _eventRegistry.register(metricKey, ( Gauge )() => _registeredEvents[metricKey]);
            }

            _registeredEvents[metricKey] = gauges[metricKey].Value;
        }
示例#5
0
 public override void Start()
 {
     _registry.register(ThreadJettyIdle, (Gauge <int>)() => _serverThreadView.idleThreads());
     _registry.register(ThreadJettyAll, (Gauge <int>)() => _serverThreadView.allThreads());
 }
示例#6
0
 public override void Start()
 {
     _registry.register(ThreadCount, (Gauge <int>)Thread.activeCount);
     _registry.register(ThreadTotal, (Gauge <int>)_threadMXBean.getThreadCount);
 }