Skip to content

Commit

Permalink
just supply beans of meterfilter
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 37b4043 commit a4aec2d
Showing 1 changed file with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
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 io.micrometer.core.instrument.config.MeterFilter;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
Expand Down Expand Up @@ -65,19 +65,24 @@ public static DatabaseAccessStatisticsBeanPostProcessor twEntryPointsDatabaseAcc
@Bean
@ConditionalOnProperty(name = "tw-entrypoints.tas.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
public static TableAccessStatisticsBeanPostProcessor twEntryPointsTableAccessStatisticsBeanPostProcessor(BeanFactory beanFactory,
MeterRegistry meterRegistry) {
meterRegistry.config().meterFilter(new TasMeterFilter());
public static TableAccessStatisticsBeanPostProcessor twEntryPointsTableAccessStatisticsBeanPostProcessor(BeanFactory beanFactory) {
return new TableAccessStatisticsBeanPostProcessor(beanFactory);
}

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

@Bean
@ConditionalOnProperty(name = "tw-entrypoints.tas.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean(TasParsedQueryRegistry.class)
public DefaultTasParsedQueryRegistry twEntryPointsTableAccessStatisticsParsedQueryRegistry() {
return new DefaultTasParsedQueryRegistry();
}


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

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

@Bean
@ConditionalOnProperty(name = "tw-entrypoints.es.enabled", havingValue = "true", matchIfMissing = true)
@ConditionalOnMissingBean
Expand Down

0 comments on commit a4aec2d

Please sign in to comment.