Skip to content

Commit

Permalink
add remaining filters as beans
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Hasgul <[email protected]>
  • Loading branch information
jordanhasgul committed Aug 8, 2024
1 parent 47d0160 commit a6467e2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import com.transferwise.common.baseutils.meters.cache.IMeterCache;
import com.transferwise.common.baseutils.meters.cache.MeterCache;
import com.transferwise.common.context.TwContext;
import com.transferwise.common.entrypoints.databaseaccessstatistics.DasMeterFilter;
import com.transferwise.common.entrypoints.databaseaccessstatistics.DasUnknownCallsCollector;
import com.transferwise.common.entrypoints.databaseaccessstatistics.DatabaseAccessStatisticsBeanPostProcessor;
import com.transferwise.common.entrypoints.databaseaccessstatistics.DatabaseAccessStatisticsEntryPointInterceptor;
import com.transferwise.common.entrypoints.executionstatistics.EsMeterFilter;
import com.transferwise.common.entrypoints.executionstatistics.ExecutionStatisticsEntryPointInterceptor;
import com.transferwise.common.entrypoints.tableaccessstatistics.DefaultTasParsedQueryRegistry;
import com.transferwise.common.entrypoints.tableaccessstatistics.DefaultTasQueryParsingInterceptor;
Expand Down Expand Up @@ -59,20 +61,27 @@ public DatabaseAccessStatisticsEntryPointInterceptor twEntryPointsDatabaseAccess
@Bean
@ConditionalOnProperty(name = "tw-entrypoints.das.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public static DatabaseAccessStatisticsBeanPostProcessor twEntryPointsDatabaseAccessStatisticsBeanPostProcessor() {
public DatabaseAccessStatisticsBeanPostProcessor twEntryPointsDatabaseAccessStatisticsBeanPostProcessor() {
return new DatabaseAccessStatisticsBeanPostProcessor();
}


@Bean
@ConditionalOnProperty(name = "tw-entrypoints.das.enabled", havingValue = "true", matchIfMissing = true)
public MeterFilter twEntryPointsDatabaseAccessStatisticsMeterFilter() {
return new DasMeterFilter();
}

@Bean
@ConditionalOnProperty(name = "tw-entrypoints.tas.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public static TableAccessStatisticsBeanPostProcessor twEntryPointsTableAccessStatisticsBeanPostProcessor(BeanFactory beanFactory) {
public TableAccessStatisticsBeanPostProcessor twEntryPointsTableAccessStatisticsBeanPostProcessor(BeanFactory beanFactory) {
return new TableAccessStatisticsBeanPostProcessor(beanFactory);
}

@Bean
@ConditionalOnProperty(name = "tw-entrypoints.tas.enabled", havingValue = "true", matchIfMissing = true)
public static MeterFilter twEntryPointsTableAccessStatisticsMeterFilter() {
public MeterFilter twEntryPointsTableAccessStatisticsMeterFilter() {
return new TasMeterFilter();
}

Expand Down Expand Up @@ -115,13 +124,13 @@ public TasFlywayConfigurationCustomizer tasFlywayConfigurationCustomizer() {
@Bean
@ConditionalOnProperty(name = "tw-entrypoints.ts.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public static TransactionStatisticsBeanPostProcessor twEntryPointsTransactionStatisticsBeanPostProcessor(BeanFactory beanFactory) {
public TransactionStatisticsBeanPostProcessor twEntryPointsTransactionStatisticsBeanPostProcessor(BeanFactory beanFactory) {
return new TransactionStatisticsBeanPostProcessor(beanFactory);
}

@Bean
@ConditionalOnProperty(name = "tw-entrypoints.ts.enabled", havingValue = "true", matchIfMissing = true)
public static MeterFilter twEntryPointsTransactionStatisticsMetricsFilter() {
public MeterFilter twEntryPointsTransactionStatisticsMetricsFilter() {
return new TsMeterFilter();
}

Expand All @@ -134,6 +143,13 @@ public ExecutionStatisticsEntryPointInterceptor twEntryPointsExecutionStatistics
return interceptor;
}

@Bean
@ConditionalOnProperty(name = "tw-entrypoints.es.enabled", havingValue = "true", matchIfMissing = true)
public MeterFilter twEntryPointsExecutionStatisticsMetricsFilter() {
return new EsMeterFilter();
}


@Bean
@ConditionalOnMissingBean(IExecutorServicesProvider.class)
public DefaultExecutorServicesProvider twDefaultExecutorServicesProvider() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public class DatabaseAccessStatisticsEntryPointInterceptor implements TwContextE

public DatabaseAccessStatisticsEntryPointInterceptor(IMeterCache meterCache) {
this.meterCache = meterCache;
meterCache.getMeterRegistry().config().meterFilter(new DasMeterFilter());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class ExecutionStatisticsEntryPointInterceptor implements TwContextExecut

public ExecutionStatisticsEntryPointInterceptor(IMeterCache meterCache) {
this.meterCache = meterCache;
meterCache.getMeterRegistry().config().meterFilter(new EsMeterFilter());
}

@Override
Expand Down

0 comments on commit a6467e2

Please sign in to comment.