Skip to content

Commit bb3aee2

Browse files
committed
Fixed sonar errors
1 parent 14a11e3 commit bb3aee2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

api/src/main/java/io/kafbat/ui/service/metrics/scrape/prometheus/PrometheusTextFormatParser.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,12 @@ public class PrometheusTextFormatParser {
3939
// Regex to capture metric name, optional labels, value, and optional timestamp.
4040
// Groups: 1=name, 2=labels (content), 3=value, 4=timestamp
4141
private static final Pattern METRIC_LINE_PATTERN = Pattern.compile(
42-
"^([a-zA-Z_:][a-zA-Z0-9_:]*)" // Group 1: Metric name
43-
+ "(?:\\{(?>[^}]*)\\})?" // Group 2: Atomic label content
44-
+ "\\s+"
45-
+ "(-?(?:Inf|NaN|(?:\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)))" // Group 3: Value
46-
+ "(?:\\s+([0-9]+))?$"); // Group 4: Optional timestamp
42+
"^([a-zA-Z_:][a-zA-Z0-9_:]*)" + // Metric name
43+
"(?:\\{(?>[^}]*)\\})?" + // Optional labels (atomic group)
44+
"\\s+" +
45+
"(-?(?:Inf|NaN|(?:\\d+(?:\\.\\d+)?(?:[eE][+-]?\\d+)?)))" + // Metric value
46+
"(?:\\s+([0-9]+))?$" // Optional timestamp
47+
); // Group 4: Optional timestamp
4748

4849

4950
private static final Pattern HELP_PATTERN =

0 commit comments

Comments
 (0)