Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ public class WriterMetricGroup extends AbstractMetricGroup {
private final Histogram bytesPerBatch;
private final Histogram recordPerBatch;

private volatile long sendLatencyInMs;

private volatile long batchQueueTimeMs;
private volatile long sendLatencyInMs = -1;
private volatile long batchQueueTimeMs = -1;

public WriterMetricGroup(ClientMetricGroup parent) {
super(parent.getMetricRegistry(), makeScope(parent, name), parent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ void testMetricsReport() throws Exception {
assertThat(metricsList).hasSize(1);
Metric sendLatencyMetrics = metricsList.get(0).f2;
assertThat(sendLatencyMetrics).isInstanceOf(Gauge.class);
// just check send latency is greater than 0
assertThat((Long) ((Gauge<?>) sendLatencyMetrics).getValue()).isGreaterThan(0);
// the default send latency is -1, so check it is >= 0, as the latency maybe very small 0ms
assertThat((Long) ((Gauge<?>) sendLatencyMetrics).getValue()).isGreaterThanOrEqualTo(0);

// test scan
tableResult = tEnv.executeSql("select * from test");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public OperatorMetricGroup getMetricGroup() {

Metric currentSendTime = interceptingOperatorMetricGroup.get(MetricNames.CURRENT_SEND_TIME);
assertThat(currentSendTime).isInstanceOf(Gauge.class);
assertThat(((Gauge<Long>) currentSendTime).getValue()).isGreaterThan(0);
// the default send latency is -1, so check it is >= 0, as the latency maybe very small 0ms
assertThat(((Gauge<Long>) currentSendTime).getValue()).isGreaterThanOrEqualTo(0);

Metric numRecordSend = interceptingOperatorMetricGroup.get(MetricNames.NUM_RECORDS_SEND);
assertThat(numRecordSend).isInstanceOf(Counter.class);
Expand Down