-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Fix][Connector-V2] Fix prometheus check time can not parse double value #9311
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
[Fix][Connector-V2] Fix prometheus check time can not parse double value #9311
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This pull request fixes a bug in the Prometheus connector related to time parameter parsing for Prometheus checks. Key changes include:
- Adding comprehensive tests in PrometheusParamCheckTest to validate multiple time formats.
- Modifying the time validation in PrometheusSourceParameter to support numeric timestamps.
- Updating the ISO8601 parsing to use Instant.parse for improved clarity.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| seatunnel-connectors-v2/connector-prometheus/src/test/java/org/apache/seatunnel/connectors/seatunnel/prometheus/PrometheusParamCheckTest.java | Added test cases to cover valid ISO8601, numeric, and CURRENT_TIMESTAMP time formats. |
| seatunnel-connectors-v2/connector-prometheus/src/main/java/org/apache/seatunnel/connectors/seatunnel/prometheus/config/PrometheusSourceParameter.java | Updated checkTimeParam to change ISO8601 parsing and to validate numeric time parameters. |
| ZonedDateTime now = ZonedDateTime.now(); | ||
| return now.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); | ||
| } | ||
| if (!time.endsWith("Z")) { |
Copilot
AI
May 14, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The 'checkTimeParam' method does not handle the 'CURRENT_TIMESTAMP' format, which is expected by test cases (e.g., map4). Consider adding an explicit check for 'CURRENT_TIMESTAMP' before attempting to parse the value as a number.
|
waiting for ci passed |
| ZonedDateTime now = ZonedDateTime.now(); | ||
| return now.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME); | ||
| } | ||
| if (!time.endsWith("Z")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's move it under isValidISO8601 method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved
Hisoka-X
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if ci passes.
Purpose of this pull request
Does this PR introduce any user-facing change?
How was this patch tested?
Check list
New License Guide