Skip to content

Commit ebf78d9

Browse files
fix: bigtable-proxy verify command metric checks (#9741)
1 parent 772ba0c commit ebf78d9

File tree

1 file changed

+5
-3
lines changed
  • bigtable/bigtable-proxy/src/main/java/com/google/cloud/bigtable/examples/proxy/commands

1 file changed

+5
-3
lines changed

bigtable/bigtable-proxy/src/main/java/com/google/cloud/bigtable/examples/proxy/commands/Verify.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
import io.opentelemetry.sdk.metrics.internal.data.ImmutableMetricData;
6060
import io.opentelemetry.sdk.resources.Resource;
6161
import java.io.IOException;
62+
import java.time.Duration;
6263
import java.time.Instant;
6364
import java.time.temporal.ChronoUnit;
6465
import java.util.Iterator;
@@ -185,9 +186,10 @@ private void checkBigtable(CallCredentials callCredentials, String tableName) {
185186
}
186187
}
187188

188-
void checkMetrics(Credentials creds) throws IOException {
189-
Instant now = Instant.now().truncatedTo(ChronoUnit.MINUTES);
189+
void checkMetrics(Credentials creds) {
190190
Instant end = Instant.now().truncatedTo(ChronoUnit.MINUTES);
191+
Instant start = end.minus(Duration.ofMinutes(1));
192+
191193

192194
GCPResourceProvider resourceProvider = new GCPResourceProvider();
193195
Resource resource = Resource.create(resourceProvider.getAttributes());
@@ -211,7 +213,7 @@ void checkMetrics(Credentials creds) throws IOException {
211213
ImmutableGaugeData.create(
212214
ImmutableList.of(
213215
ImmutableLongPointData.create(
214-
TimeUnit.MILLISECONDS.toNanos(now.toEpochMilli()),
216+
TimeUnit.MILLISECONDS.toNanos(start.toEpochMilli()),
215217
TimeUnit.MILLISECONDS.toNanos(end.toEpochMilli()),
216218
Attributes.empty(),
217219
1L)))));

0 commit comments

Comments
 (0)