Claus Ibsen created CAMEL-27606:
-----------------------------------
Summary: camel-influxdb2: PING creates org/bucket, writePrecision
ignored for Point, metadata fixes
Key: CAMEL-27606
URL: https://issues.apache.org/jira/browse/CAMEL-27606
Project: Camel
Issue Type: Bug
Components: camel-influxdb
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-influxdb2 for
CAMEL-23832 (PR https://github.com/apache/camel/pull/30936).
These are separate problems of the component; the descriptions PR only
documents the current behavior.
h4. 1. A PING endpoint needs an organization and a bucket, and creates them at
startup
{{InfluxDb2Endpoint.doInit()}} runs {{ensureOrgExists()}} and
{{ensureBucketExists()}} for every endpoint, also for {{operation=PING}}, which
never uses {{org}} or {{bucket}}.
With the defaults {{autoCreateOrg=true}} and {{autoCreateBucket=true}}, a ping
endpoint looks up the organization and the bucket when it starts and creates
them when they are missing.
Without {{org}}, {{findOrganization()}} finds nothing and
{{OrganizationsApi.createOrganization(null)}} throws an
{{IllegalArgumentException}} ("Expecting a non-empty string for Organization
name"), so the route does not start.
The user must set an organization and a bucket that a ping does not need, or
turn off both auto-create options.
Proposed change: skip the organization and bucket checks in {{doInit()}} when
the operation is PING.
h4. 2. writePrecision and CamelInfluxDB2WritePrecision have no effect for
Point, Map and Points bodies
{{InfluxDb2Producer.insertPoint()}} and {{insertPoints()}} call
{{WriteApiBlocking.writePoint(bucket, org, point)}} and {{writePoints(bucket,
org, points)}}, which take no precision.
The client (influxdb-client-java 8.0.0) writes each {{Point}} with its own
precision ({{ns}} unless set with {{Point.time(...)}}).
The option and the header only apply to {{Measurement}}, {{Record}},
{{Measurements}} and {{Records}} bodies, so a user who sets
{{writePrecision=s}} for a {{Point}} or a {{Map}} body sees no change.
Proposed change: decide whether the option should apply to a {{Point}}
converted from a {{Map}} (which the component creates itself), and log at DEBUG
or document when the header is set for a body that ignores it.
h4. 3. CamelInfluxDB2MeasurementName is documented as a header, but it is a key
of the Map body
{{InfluxDb2Constants.MEASUREMENT}} is listed in the headers of the component
({{headersClass}}), but only {{CamelInfluxDb2Converters.fromMapToPoint()}}
reads it, as a key of a {{Map}} body.
No code reads a message header of this name, so setting it as a header does
nothing.
Proposed change: remove it from the headers metadata (for example a separate
constant without {{@Metadata}}) and document the Map key on the doc page only.
h4. 4. org and bucket are marked as required also for PING
{{org}} and {{bucket}} have {{@Metadata(required = true)}} in
{{InfluxDb2Endpoint}}, but {{InfluxDb2Producer.doPing()}} does not use them.
Tooling that checks required options asks for both on a ping endpoint.
Proposed change: drop the required flag (a write without them already fails in
the client), or document that they are needed only for INSERT.
h4. 5. Display name of the component option influxDBClient
The component option {{influxDBClient}} of {{InfluxDb2Component}} gets the
generated display name "Influx DBClient".
Proposed change: set {{displayName = "InfluxDB Client"}}.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)