Skip to content

[Question] How to check if a connection can be established? #296

@Tobist

Description

@Tobist

I am trying to check if the connection is valid or not. I can Ping the server and get a false or true, but I cannot read the version or the readiness of the server. Am I doing something wrong?

I would like to check the connection completely before I send other writing or reading requests.

Code

InfluxDBClientOptions.Builder builder = InfluxDBClientOptions.Builder.CreateNew();
builder.Url("https://westeurope-1.azure.cloud2.influxdata.com");
builder.AuthenticateToken(token);
builder.Bucket(bucket);
builder.Org(org);

using var client = InfluxDBClientFactory.Create(builder.Build()); 

var healthCheck = client.PingAsync().Result;
var ready = client.ReadyAsync().Result;
var version = client.VersionAsync().Result;

Steps to reproduce:

  1. request ReadyAsync on an influxdbclient
  2. request VersionAsync on an influxdbclient

Expected behavior:

  1. Gives state of the readiness
  2. Return version value

Actual behavior:

  1. Returns 'null'
  2. Returns 'unknown'

Specifications:

  • Client Version: 3.3.0
  • InfluxDB Version: unknown
  • Platform: InfluxDB Cloud

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions