public InfluxDbClientAutoVersion(InfluxDbClientConfiguration influxDbClientConfiguration) { _influxDbClient = new InfluxDbClientBase(influxDbClientConfiguration); var errorHandlers = new List<ApiResponseErrorHandlingDelegate>(); // TODO: needs testing - potentially bad if it's going to ping for every request var result = _influxDbClient.Ping(errorHandlers).Result; var databaseVersion = result.Body; if (databaseVersion.StartsWith("0.9")) { switch (databaseVersion) { case "0.9.2": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; case "0.9.5": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; case "0.9.6": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; } } else { throw new InvalidOperationException(String.Format("Version {0} is not supported by the Auto configuration.", databaseVersion)); } }
public InfluxDbClientAutoVersion(InfluxDbClientConfiguration influxDbClientConfiguration) { _influxDbClient = new InfluxDbClientBase(influxDbClientConfiguration); var errorHandlers = new List <ApiResponseErrorHandlingDelegate>(); // TODO: needs testing - potentially bad if it's going to ping for every request var result = _influxDbClient.Ping(errorHandlers).Result; var databaseVersion = result.Body; if (databaseVersion.StartsWith("0.9")) { switch (databaseVersion) { case "0.9.2": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; case "0.9.5": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; case "0.9.6": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; } } else { throw new InvalidOperationException(String.Format("Version {0} is not supported by the Auto configuration.", databaseVersion)); } }
/// <summary> /// Ping this InfluxDB /// </summary> /// <returns>The response of the ping execution.</returns> public async Task <Pong> PingAsync() { Stopwatch watch = Stopwatch.StartNew(); InfluxDbApiResponse response = await _influxDbClient.Ping(NoErrorHandlers); watch.Stop(); var pong = response.ReadAs <Pong>(); pong.ResponseTime = watch.ElapsedMilliseconds; return(pong); }
public InfluxDbClientAutoVersion(InfluxDbClientConfiguration influxDbClientConfiguration) { _influxDbClient = new InfluxDbClientBase(influxDbClientConfiguration); var errorHandlers = new List <ApiResponseErrorHandlingDelegate>(); //NOTE: Only performs ping when the client is connected. (Do not use multiple connections with the "Client Auto Version" setting.) var result = _influxDbClient.Ping(errorHandlers).Result; var databaseVersion = result.Body; if (databaseVersion.StartsWith("1.1.")) { _influxDbClient = new InfluxDbClientV013x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.13.")) { _influxDbClient = new InfluxDbClientV013x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.12.")) { _influxDbClient = new InfluxDbClientV012x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.11.")) { _influxDbClient = new InfluxDbClientV011x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.10.")) { _influxDbClient = new InfluxDbClientV010x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.9.")) { switch (databaseVersion) { case "0.9.2": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; case "0.9.5": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; case "0.9.6": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; } } else { _influxDbClient = new InfluxDbClientV0x(influxDbClientConfiguration); } }
/// <summary> /// Ping this InfluxDB. /// </summary> /// <returns>The response of the ping execution.</returns> public async Task <Pong> PingAsync() { var watch = Stopwatch.StartNew(); var response = await _influxDbClient.Ping(NoErrorHandlers); watch.Stop(); return(new Pong { Version = response.Body, ResponseTime = watch.Elapsed, Success = true }); }
public InfluxDbClientAutoVersion(InfluxDbClientConfiguration influxDbClientConfiguration) { _influxDbClient = new InfluxDbClientBase(influxDbClientConfiguration); var errorHandlers = new List <ApiResponseErrorHandlingDelegate>(); // TODO: needs testing - potentially bad if it's going to ping for every request var result = _influxDbClient.Ping(errorHandlers).Result; var databaseVersion = result.Body; if (databaseVersion.StartsWith("0.13.")) { _influxDbClient = new InfluxDbClientV013x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.12.")) { _influxDbClient = new InfluxDbClientV012x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.11.")) { _influxDbClient = new InfluxDbClientV011x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.10.")) { _influxDbClient = new InfluxDbClientV010x(influxDbClientConfiguration); } else if (databaseVersion.StartsWith("0.9.")) { switch (databaseVersion) { case "0.9.2": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; case "0.9.5": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; case "0.9.6": _influxDbClient = new InfluxDbClientV092(influxDbClientConfiguration); break; } } else { _influxDbClient = new InfluxDbClientV0x(influxDbClientConfiguration); } }
public async Task <InfluxDbApiResponse> Ping(IEnumerable <ApiResponseErrorHandlingDelegate> errorHandlers) { return(await _influxDbClient.Ping(errorHandlers)); }