influxdata / influxdata/influxdb-java

Set timeout for influxdb connection

Open
#544 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.2k
Forks
469
PR merge metrics
No merged PRs in 30d

Description

I'm using Influxdb client for writing and have a requirement to set a connection timeout, so the data not written within that specified time interval (ex: 5 seconds), the connection for that request will be closed.

I've researched around and found a solution here in this PR:
https://github.com/influxdata/influxdb-java/commit/4514191f645c71c51189459a80000837dbf01662
where I can see timeout methods been added, however the version of this influxdb is 2.0-SNAPSHOT. I'm already using version 2.8

This is my current code:

build.gradle

compile("org.influxdb:influxdb-java:2.8")

logger.kt

influxDB?.write(Point.measurement("mup_stats")
.addField("example1", params["example1"] ?: "")
.addField("example2", params["example2"] ?: "")
.time(System.currentTimeMillis(), TimeUnit.MILLISECONDS).build())

The methods setTimeout(), setReadTimeout() and setWriteTimeout() are not available in my version. Do I need to change the version? Or is there another way to set a timeout?

Thanks

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the timeout methods in commit 4514191f645c71c51189459a80000837dbf01662 with the 2.8 client API and its connection code. Check how the Gradle dependency exposes the client used by logger.kt. Done means the supported client version or configuration path for connection, read, and write timeouts is documented or implemented and covered by relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.