From 7ffd464dea0f834e81f3196982b71c955196e459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristo=20Kuusk=C3=BCll?= Date: Fri, 26 Jan 2024 15:49:09 +0200 Subject: [PATCH] Fix. --- .../TableAccessStatisticsSpyqlListener.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tw-entrypoints/src/main/java/com/transferwise/common/entrypoints/tableaccessstatistics/TableAccessStatisticsSpyqlListener.java b/tw-entrypoints/src/main/java/com/transferwise/common/entrypoints/tableaccessstatistics/TableAccessStatisticsSpyqlListener.java index f535429..42379d8 100644 --- a/tw-entrypoints/src/main/java/com/transferwise/common/entrypoints/tableaccessstatistics/TableAccessStatisticsSpyqlListener.java +++ b/tw-entrypoints/src/main/java/com/transferwise/common/entrypoints/tableaccessstatistics/TableAccessStatisticsSpyqlListener.java @@ -22,6 +22,7 @@ import com.transferwise.common.spyql.listener.SpyqlConnectionListener; import com.transferwise.common.spyql.listener.SpyqlDataSourceListener; import io.micrometer.core.instrument.Gauge; +import io.micrometer.core.instrument.MeterRegistry; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.binder.cache.CaffeineCacheMetrics; import java.time.Duration; @@ -93,7 +94,7 @@ public TableAccessStatisticsSpyqlListener(IMeterCache meterCache, ExecutorServic this.tasQueryParsingInterceptor = tasQueryParsingInterceptor; this.tasQueryParsingListener = tasQueryParsingListener; - final var meterRegistry = meterCache.getMeterRegistry(); + final MeterRegistry meterRegistry = meterCache.getMeterRegistry(); meterRegistry.config().meterFilter(new TasMeterFilter()); sqlParseResultsCache = Caffeine.newBuilder().maximumWeight(entryPointsProperties.getTas().getSqlParser().getCacheSizeMib() * MIB).recordStats() @@ -128,8 +129,8 @@ protected ParsedQuery parseSql(String sql, TwContext context) { return new ParsedQuery(); } - final var result = new ParsedQuery(); - final var startTimeMs = System.currentTimeMillis(); + final ParsedQuery result = new ParsedQuery(); + final long startTimeMs = System.currentTimeMillis(); try { final Statements stmts = sqlParser.parse(sql, entryPointsProperties.getTas().getSqlParser().getTimeout()); @@ -185,7 +186,7 @@ protected ParsedQuery parseSql(String sql, TwContext context) { )).increment(); tasQueryParsingListener.parsingFailed(sql, Duration.of(System.currentTimeMillis() - startTimeMs, ChronoUnit.MILLIS), t); } finally { - var durationMs = System.currentTimeMillis() - startTimeMs; + long durationMs = System.currentTimeMillis() - startTimeMs; if (durationMs > entryPointsProperties.getTas().getSqlParser().getParseDurationWarnThreshold().toMillis()) { meterCache.counter(COUNTER_SLOW_PARSES, TagsSet.of( EntryPointsMetrics.TAG_DATABASE, databaseName, @@ -245,7 +246,7 @@ public void onStatementExecuteFailure(StatementExecuteFailureEvent event) { } protected void registerSql(String sql, boolean isInTransaction, boolean succeeded, long executionTimeNs) { - final var context = TwContext.current(); + final TwContext context = TwContext.current(); final Tag inTransactionTag = isInTransaction ? TAG_IN_TRANSACTION_TRUE : TAG_IN_TRANSACTION_FALSE; final Tag successTag = succeeded ? TAG_SUCCESS_TRUE : TAG_SUCCESS_FALSE;