Skip to content

0.7.0

Compare
Choose a tag to compare
@bednar bednar released this 11 Mar 07:53
· 107 commits to main since this release
  1. #107: Custom headers are also supported for the query (gRPC request)

    ClientConfig config = new ClientConfig.Builder()
        .host("https://us-east-1-1.aws.cloud2.influxdata.com")
        .token("my-token".toCharArray())
        .database("my-database")
        .headers(Map.of("X-Tracing-Id", "123"))
        .build();
    
    try (InfluxDBClient client = InfluxDBClient.getInstance(config)) {
        //
        // your code here
        //
    } catch (Exception e) {
        throw new RuntimeException(e);
    } 
  2. #108: Custom headers can be specified per request (query/write):

    ClientConfig config = new ClientConfig.Builder()
        .host("https://us-east-1-1.aws.cloud2.influxdata.com")
        .token("my-token".toCharArray())
        .database("my-database")
        .build();
    
    try (InfluxDBClient client = InfluxDBClient.getInstance(config)) {
        //
        // Write with custom headers
        //
        WriteOptions writeOptions = new WriteOptions(
            Map.of("X-Tracing-Id", "852")
        );
        client.writeRecord("mem,tag=one value=1.0", writeOptions);
        
        //
        // Query with custom headers
        //
        QueryOptions queryOptions = new QueryOptions(
            Map.of("X-Tracing-Id", "852")
        );
        Stream<Object[]> rows = client.query("select * from cpu", queryOptions);
    
    } catch (Exception e) {
        throw new RuntimeException(e);
    }