Example #1
0
 public override void Init()
 {
     base.Init();
     if (Config.Current.GetValue <bool>("Metrics:Server:Enabled"))
     {
         Module.Init(this);
         _InfoGauge = prom.Metrics.CreateGauge("app_info", "Application info", "netfx_version", "version");
         _InfoGauge.Labels(AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName, "20.11").Set(1);
     }
 }
Example #2
0
        private void UpdateMetrics(object state)
        {
            Debug.WriteLine(string.Format("NodeCollector.WindowsBasic::UpdateMetrics(): Reading perfmon counters ({0}).", DateTime.Now.ToString()));

            foreach (CounterEntry entry in this.RegisteredCounts)
            {
                long  rawValue  = entry.PerfCounter.RawValue;
                float nextValue = entry.PerfCounter.NextValue();
                //Debug.WriteLine(String.Format(@"<PerfCounter> {0}\{1}\{2}: {3}", entry.PerfCounter.CategoryName, entry.PerfCounter.CounterName, entry.PerfCounter.InstanceName, nextValue));
                Prometheus.Gauge g = (Prometheus.Gauge)entry.PrometheusCollector;
                g.Labels(entry.PerfCounter.InstanceName).Set(nextValue);
            }
        }