Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem query runs with beforeTime and afterTime, with exact time in minutes #565

Open
tiwatta opened this issue May 23, 2023 · 0 comments

Comments

@tiwatta
Copy link

tiwatta commented May 23, 2023

When execute TaskApi#getRuns with beforeTime and afterTime on exact time in minutes, it throws BadRequestException and can not get result.

Steps to reproduce:
List the minimal actions needed to reproduce the behavior.

  1. Set afterTime and beforeTime, with exact time
OffsetDateTime afterTime = OffsetDateTime.parse("2023-05-20T10:15:00+09:00");
OffsetDateTime beforeTime = OffsetDateTime.parse("2023-05-20T11:15:00+09:00");
Integer limit = 100;


InfluxDBClient client = getClient();
client.getTasksApi().getRuns(task.getId(), afterTime, beforeTime, limit);

Expected behavior:
Returns the runs without error, executed between afterTime and beforeTime.

Actual behavior:
Got BadGrammerExeception.

The reason is, TaskApi#getRuns ( and InfluxDB itself) expects afterTime and beforeTime as strictly rfc3339 format, but parameter value type is OffsetDateTime which is ISO-8601 format. Therefore, it formats timestamp as ISO-8601 format omitting some part when the timestamp is exact minute time.

HTTP status code: 400; Message: failed to decode request: parsing time "2023-05-20T10:15+09:00" as "2006-01-02T15:04:05Z07:00": cannot parse "+09:00" as ":"
com.influxdb.exceptions.BadRequestException: HTTP status code: 400; Message: failed to decode request: parsing time "2023-05-20T10:15+09:00" as "2006-01-02T15:04:05Z07:00": cannot parse "+09:00" as ":"
	at com.influxdb.internal.AbstractRestClient.responseToError(AbstractRestClient.java:113)
	at com.influxdb.internal.AbstractRestClient.execute(AbstractRestClient.java:84)
	at com.influxdb.client.internal.TasksApiImpl.getRuns(TasksApiImpl.java:501)
	at jp.co.iim.collie.ui.common.repository.influxdb.InfluxDbClientTest.taskTest(InfluxDbClientTest.java:459)

Specifications:

  • Client Version: 6.7.0
  • InfluxDB Version: InfluxDB 2.1.1
  • JDK Version: OpenJDK 1.8.0_281
  • Platform: CentOS 7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant