Skip to content

Commit

Permalink
apply meter filters earlier
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Hasgul <[email protected]>
  • Loading branch information
jordanhasgul committed Aug 7, 2024
1 parent f249f76 commit 37b4043
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=2.16.2
version=2.16.3
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
import com.transferwise.common.entrypoints.tableaccessstatistics.DefaultTasQueryParsingListener;
import com.transferwise.common.entrypoints.tableaccessstatistics.TableAccessStatisticsBeanPostProcessor;
import com.transferwise.common.entrypoints.tableaccessstatistics.TasFlywayConfigurationCustomizer;
import com.transferwise.common.entrypoints.tableaccessstatistics.TasMeterFilter;
import com.transferwise.common.entrypoints.tableaccessstatistics.TasParsedQueryRegistry;
import com.transferwise.common.entrypoints.tableaccessstatistics.TasQueryParsingInterceptor;
import com.transferwise.common.entrypoints.tableaccessstatistics.TasQueryParsingListener;
import com.transferwise.common.entrypoints.transactionstatistics.TransactionStatisticsBeanPostProcessor;
import com.transferwise.common.entrypoints.transactionstatistics.TsMeterFilter;
import io.micrometer.core.instrument.MeterRegistry;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand Down Expand Up @@ -63,7 +65,9 @@ public static DatabaseAccessStatisticsBeanPostProcessor twEntryPointsDatabaseAcc
@Bean
@ConditionalOnProperty(name = "tw-entrypoints.tas.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public static TableAccessStatisticsBeanPostProcessor twEntryPointsTableAccessStatisticsBeanPostProcessor(BeanFactory beanFactory) {
public static TableAccessStatisticsBeanPostProcessor twEntryPointsTableAccessStatisticsBeanPostProcessor(BeanFactory beanFactory,
MeterRegistry meterRegistry) {
meterRegistry.config().meterFilter(new TasMeterFilter());
return new TableAccessStatisticsBeanPostProcessor(beanFactory);
}

Expand Down Expand Up @@ -105,7 +109,9 @@ public TasFlywayConfigurationCustomizer tasFlywayConfigurationCustomizer() {
@Bean
@ConditionalOnProperty(name = "tw-entrypoints.ts.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public static TransactionStatisticsBeanPostProcessor twEntryPointsTransactionStatisticsBeanPostProcessor(BeanFactory beanFactory) {
public static TransactionStatisticsBeanPostProcessor twEntryPointsTransactionStatisticsBeanPostProcessor(BeanFactory beanFactory,
MeterRegistry meterRegistry) {
meterRegistry.config().meterFilter(new TsMeterFilter());
return new TransactionStatisticsBeanPostProcessor(beanFactory);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ public TableAccessStatisticsSpyqlListener(IMeterCache meterCache, ExecutorServic
this.tasQueryParsingListener = tasQueryParsingListener;

final MeterRegistry meterRegistry = meterCache.getMeterRegistry();
meterRegistry.config().meterFilter(new TasMeterFilter());

sqlParseResultsCache = Caffeine.newBuilder().maximumWeight(entryPointsProperties.getTas().getSqlParser().getCacheSizeMib() * MIB).recordStats()
.executor(executorService)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ public class TransactionsStatisticsSpyqlListener implements SpyqlDataSourceListe
public TransactionsStatisticsSpyqlListener(IMeterCache meterCache, String databaseName) {
this.dbTag = Tag.of(EntryPointsMetrics.TAG_DATABASE, databaseName);
this.meterCache = meterCache;
meterCache.getMeterRegistry().config().meterFilter(new TsMeterFilter());
}

@Override
Expand Down

0 comments on commit 37b4043

Please sign in to comment.