File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
bigtable/bigtable-proxy/src/main/java/com/google/cloud/bigtable/examples/proxy/commands Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 5959import io .opentelemetry .sdk .metrics .internal .data .ImmutableMetricData ;
6060import io .opentelemetry .sdk .resources .Resource ;
6161import java .io .IOException ;
62+ import java .time .Duration ;
6263import java .time .Instant ;
6364import java .time .temporal .ChronoUnit ;
6465import 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 )))));
You can’t perform that action at this time.
0 commit comments