/// <summary> /// Push metrics into InfluxDB 0.9+ /// </summary> public static MetricsReports WithInflux(this MetricsReports reports, string host, int port, string user, string pass, string database, TimeSpan interval, ConfigOptions config = null) { var cfg = config ?? new ConfigOptions(); var uri = cfg.BuildUri(host, port, database); return reports.WithInflux(uri, user, pass, interval, cfg); }
internal InfluxDbRecord(string name, object data, MetricTags tags, ConfigOptions config, Tuple <string, string>[] moreTags = null) : this(config) { var record = BuildRecordPreamble(name, tags, moreTags); record.Append("value=").Append(StringifyValue(data)); LineProtocol = record.ToString(); }
internal InfluxDbRecord(string name, object data, MetricTags tags, ConfigOptions config, Tuple<string, string>[] moreTags = null) : this(config) { var record = BuildRecordPreamble(name, tags, moreTags); record.Append("value=").Append(StringifyValue(data)); LineProtocol = record.ToString(); }
internal InfluxDbRecord(string name, IEnumerable<string> columns, IEnumerable<object> data, MetricTags tags, ConfigOptions config, Tuple<string, string>[] moreTags = null) : this(config) { var record = BuildRecordPreamble(name, tags, moreTags); var fieldKeypairs = new List<string>(); foreach (var pair in columns.Zip(data, (col, dat) => new { col, dat })) { fieldKeypairs.Add(string.Format("{0}={1}", Escape(pair.col), StringifyValue(pair.dat))); } record.Append(string.Join(",", fieldKeypairs)); LineProtocol = record.ToString(); }
internal InfluxDbHttpTransport(Uri uri, string username, string password, ConfigOptions config) { _uri = uri; _config = config; var byteArray = Encoding.ASCII.GetBytes(string.Format("{0}:{1}", username, password)); _client = new HttpClient() { DefaultRequestHeaders = { Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray)) } }; _policy = new Rate(_config.BreakerRate).AsPolicy(); }
internal InfluxDbReport(Uri influxdb, string username, string password, ConfigOptions config) { _transport = new InfluxDbHttpTransport(influxdb, username, password, config); _config = config; }
/// <summary> /// Push metrics into InfluxDB 0.9+ /// </summary> public static MetricsReports WithInflux(this MetricsReports reports, Uri influxdbUri, string username, string password, TimeSpan interval, ConfigOptions config = null) { return reports.WithReport(new InfluxDbReport(influxdbUri, username, password, config ?? new ConfigOptions()), interval); }
/// <summary> /// Push metrics into InfluxDB 0.9+ /// </summary> public static MetricsReports WithInflux(this MetricsReports reports, Uri influxdbUri, string username, string password, TimeSpan interval, ConfigOptions config = null) { return(reports.WithReport(new InfluxDbReport(influxdbUri, username, password, config ?? new ConfigOptions()), interval)); }
/// <summary> /// Push metrics into InfluxDB 0.9+ /// </summary> public static MetricsReports WithInflux(this MetricsReports reports, string host, int port, string user, string pass, string database, TimeSpan interval, ConfigOptions config = null) { var cfg = config ?? new ConfigOptions(); var uri = cfg.BuildUri(host, port, database); return(reports.WithInflux(uri, user, pass, interval, cfg)); }
internal InfluxDbRecord(ConfigOptions config) { _config = config; }
internal InfluxDbRecord(string name, IEnumerable <string> columns, IEnumerable <object> data, MetricTags tags, ConfigOptions config, Tuple <string, string>[] moreTags = null) : this(config) { var record = BuildRecordPreamble(name, tags, moreTags); var fieldKeypairs = new List <string>(); foreach (var pair in columns.Zip(data, (col, dat) => new { col, dat })) { fieldKeypairs.Add(string.Format("{0}={1}", Escape(pair.col), StringifyValue(pair.dat))); } record.Append(string.Join(",", fieldKeypairs)); LineProtocol = record.ToString(); }