influxdata / influxdata/influxdb-client-java
Problem query runs with beforeTime and afterTime, with exact time in minutes
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 477
- Fork
- 129
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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](https://docs.oracle.com/javase/8/docs/api/java/time/OffsetDateTime.html) 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
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu tại TasksApiImpl.java:501, nơi TaskApi#getRuns xuất hiện trong stack trace, và kiểm tra lời gọi liên quan trong InfluxDbClientTest.java:459. Tái hiện trường hợp afterTime và beforeTime nằm đúng trong cùng một phút, sau đó thêm hoặc cập nhật một regression test cho thấy request trả về runs mà không có BadRequestException.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- api, backend
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 45/100