示例#1
0
 /// <summary>
 /// Creates a new instance of the observer.
 /// </summary>
 /// <param name="poller">The poller.</param>
 /// <param name="client">The InfluxDB client.</param>
 /// <param name="options">The observer options.</param>
 public InfluxDbObserver(IMetricPoller poller, IInfluxDbClient client, InfluxDbObserverOptions options)
 {
     this.poller  = poller ?? throw new ArgumentNullException(nameof(poller));
     this.client  = client ?? throw new ArgumentNullException(nameof(client));
     this.options = options ?? throw new ArgumentNullException(nameof(options));
     poller.RegisterObserver(Update);
 }
示例#2
0
        public static void Main(string[] args)
        {
            // Get the default registry instance. This is the registry used when adding metrics
            // through OkanshiMonitor.
            var registry = DefaultMonitorRegistry.Instance;

            // Create a new poller to get data from the registry every 10 seconds
            poller = new MetricMonitorRegistryPoller(registry, TimeSpan.FromSeconds(10), false);

            observer = new ConsoleObserver(poller, x => JsonConvert.SerializeObject(x, Formatting.Indented));

            // Start the actual program
            Start();
        }