influxdata / influxdata/influxdb-client-java

[Question] The recommended way to use library

Open
#805 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
477
Forks
129
PR merge metrics
No merged PRs in 30d

Description

Hi guys, sorry for raising a bug. I didn't find better place to ask the question.

What's the best recommended way to use your library for reading and writing the data? String flux/measurements/anything else?
My concern is about data consistency. Look at the following code:

        Flux fluxQuery = Flux.from(influxDBProperties.getBucketChart())
                .range(-31L, ChronoUnit.DAYS)
                .filter(Restrictions.and(
                        Restrictions.measurement().equal("sentiment"),
                        Restrictions.tag("asset").equal(assetType.toString()),
                        Restrictions.tag("timeframe").equal(timeframeType.toString())
                ))
                .pivot()
                .withRowKey(new String[]{"_time"})
                .withColumnKey(new String[]{"_field"})
                .withValueColumn("_value")
                .tail(1);

I kinda worry on providing names of tags/measurements like this. I don't like to keep it as strings. Because later it's very difficult to change the code at every possible place in case of breaking change. Any small typo would cause the issue. For example, in case of JPA, there are entities and repositories and I do not worry about that. Here's a bit different case. I do not see any other choice at this moment.

Do you have any recommendation?
@bednar maybe you can take a look?

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 reviewing the Flux query example in the issue and the library's documented reading and writing APIs. The work is done when the project has a clear recommendation for avoiding fragile string names while preserving data consistency, with the relevant usage guidance documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
databases
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.