Skip to content

Commit 9993564

Browse files
authored
Merge pull request #2465 from avshenuk/main
Fix a small bug with server metrics parsing + a few code cleanups.
2 parents b2692a3 + ea6f916 commit 9993564

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

client-v2/src/main/java/com/clickhouse/client/api/data_formats/internal/ProcessParser.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ public class ProcessParser {
2222
};
2323

2424
public static void parseSummary(String text, OperationMetrics metrics) {
25-
Map<String, Integer> map = parse(text == null ? "{}" : text);
25+
Map<String, Long> map = parse(text == null ? "{}" : text);
2626

2727
for (ServerMetrics m : ServerMetrics.values()) {
2828
metrics.updateMetric(m, -1);
2929
}
3030

3131
for (int i = 0; i < SUMMARY_FIELDS.length; i++) {
3232
String field = SUMMARY_FIELDS[i];
33-
Integer value = map.get(field);
33+
Long value = map.get(field);
3434
if (value != null) {
3535
metrics.updateMetric(SUMMARY_METRICS[i], value);
3636
}
3737
}
3838
}
3939

4040

41-
public static Map<String, Integer> parse(String json) {
41+
public static Map<String, Long> parse(String json) {
4242
if (json == null) {
4343
throw new IllegalArgumentException("json is null");
4444
}
@@ -50,7 +50,7 @@ public static Map<String, Integer> parse(String json) {
5050
throw new IllegalArgumentException("JSON must start with '{' and end with '}'");
5151
}
5252

53-
Map<String, Integer> result = new HashMap<>();
53+
Map<String, Long> result = new HashMap<>();
5454

5555
String content = json.substring(1, json.length() - 1).trim();
5656
if (content.isEmpty()) {
@@ -79,7 +79,7 @@ public static Map<String, Integer> parse(String json) {
7979
}
8080

8181
try {
82-
int value = Integer.parseInt(valueStr);
82+
long value = Long.parseLong(valueStr);
8383
result.put(key, value);
8484
} catch (NumberFormatException e) {
8585
// ignore error

client-v2/src/main/java/com/clickhouse/client/api/internal/Gauge.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ public class Gauge implements Metric {
66

77
private volatile long value;
88

9-
public Gauge(long readRows) {
10-
this.value = readRows;
9+
public Gauge(long value) {
10+
this.value = value;
1111
}
1212

1313
public void set(long value) {

client-v2/src/main/java/com/clickhouse/client/api/metrics/ClientMetrics.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
public enum ClientMetrics {
44

55
/**
6-
* Operation duration in nanoseconds.
6+
* Operation duration in milliseconds.
77
*/
88
OP_DURATION("client.opDuration"),
99

1010
/**
11-
* Duration of the operation serialization step in nanoseconds.
11+
* Duration of the operation serialization step in milliseconds.
1212
*/
1313
OP_SERIALIZATION("client.opSerialization");
1414

0 commit comments

Comments
 (0)