Skip to content

Conversation

@chl-wxp
Copy link
Contributor

@chl-wxp chl-wxp commented May 13, 2025

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@hailin0 hailin0 requested a review from Copilot May 14, 2025 09:43
Copy link
Contributor

Copilot AI left a 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")) {
Copy link

Copilot AI May 14, 2025

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.

Copilot uses AI. Check for mistakes.
@hailin0
Copy link
Member

hailin0 commented May 14, 2025

waiting for ci passed

ZonedDateTime now = ZonedDateTime.now();
return now.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
}
if (!time.endsWith("Z")) {
Copy link
Member

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moved

Copy link
Member

@Hisoka-X Hisoka-X left a 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.

@Hisoka-X Hisoka-X changed the title [Bugfix] [Connector-V2]fix prometheus check time error bug [Fix][Connector-V2] Fix prometheus check time can not parse double value May 21, 2025
@hailin0 hailin0 merged commit fbf7872 into apache:dev May 21, 2025
5 checks passed
dybyte pushed a commit to dybyte/seatunnel that referenced this pull request Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants