/// <summary> /// Add a listener on sources that match a given Name predicate. /// </summary> /// <param name="client">The <see cref="IInfluxDBClient"/> to write data to.</param> /// <param name="sourceNamePredicate">A predicate to match <see cref="DiagnosticSource"/> names.</param> /// <param name="optionsCallback">Configuration callback</param> public static IDisposable Listen(IInfluxDBClient client, Func <string, bool> sourceNamePredicate, Action <DiagnosticListenerOptions> optionsCallback = null) { var listener = new DiagnosticSourceInfluxDB(client, sourceNamePredicate, optionsCallback); DiagnosticListener.AllListeners.Subscribe(listener); return(listener); }
private DiagnosticSourceInfluxDB(IInfluxDBClient client, Func <string, bool> sourceNamePredicate, Action <DiagnosticListenerOptions> optionsCallback) { _sourceNamePredicate = sourceNamePredicate; _client = client; _listenerOptions = new DiagnosticListenerOptions(); optionsCallback?.Invoke(_listenerOptions); }
internal DiagnosticListenerObserver(DiagnosticListener listener, IInfluxDBClient client, DiagnosticListenerOptions options) { _listener = listener; _client = client; _formatters = new InfluxLineFormatterCollection(listener.Name, options); _onError = options.OnError; _subscription = listener.Subscribe(this); }
public InfluxDBRecorder(IConfiguration configuration, IModuleClient moduleClient, CancellationTokenSource cancellationTokenSource, IInfluxDBClient influxDBClient) { Configuration = configuration; ModuleClient = moduleClient; CancellationTokenSource = cancellationTokenSource; InfluxDBClient = influxDBClient; }
public InfluxDBMonitor(IOptions <InfluxDBOptions> options, ILogger <InfluxDBMonitor> logger) { _logger = logger; if (!string.IsNullOrWhiteSpace(options.Value.Server) && !string.IsNullOrWhiteSpace(options.Value.Database)) { _client = new InfluxDBClientBuilder(options.Value.Server, options.Value.Database) .ForceFlushInterval(TimeSpan.FromSeconds(10)) .OnError(LogError) .Build(); } }
public InfluxClient(IInfluxDBClient client, string dbName) { influx = client; database = dbName; }
public InfluxClient(string url, string dbName) { influx = new InfluxDBClient(url); database = dbName; }