use of io.quarkus.arc.processor.InterceptorBindingRegistrar in project quarkus by quarkusio.
the class MicrometerProcessor method registerAdditionalBeans.
@BuildStep(onlyIf = MicrometerEnabled.class)
UnremovableBeanBuildItem registerAdditionalBeans(CombinedIndexBuildItem indexBuildItem, BuildProducer<MicrometerRegistryProviderBuildItem> providerClasses, BuildProducer<ReflectiveClassBuildItem> reflectiveClasses, BuildProducer<AdditionalBeanBuildItem> additionalBeans, BuildProducer<InterceptorBindingRegistrarBuildItem> interceptorBindings) {
// Create and keep some basic Providers
additionalBeans.produce(AdditionalBeanBuildItem.builder().setUnremovable().addBeanClass(ClockProvider.class).addBeanClass(CompositeRegistryCreator.class).build());
// Add annotations and associated interceptors
additionalBeans.produce(AdditionalBeanBuildItem.builder().addBeanClass(MeterFilterConstraint.class).addBeanClass(MeterFilterConstraints.class).addBeanClass(TIMED_ANNOTATION.toString()).addBeanClass(TIMED_INTERCEPTOR.toString()).addBeanClass(COUNTED_ANNOTATION.toString()).addBeanClass(COUNTED_BINDING.toString()).addBeanClass(COUNTED_INTERCEPTOR.toString()).build());
// @Timed is registered as an additional interceptor binding
interceptorBindings.produce(new InterceptorBindingRegistrarBuildItem(new InterceptorBindingRegistrar() {
@Override
public List<InterceptorBinding> getAdditionalBindings() {
return List.of(InterceptorBinding.of(Timed.class, m -> true));
}
}));
IndexView index = indexBuildItem.getIndex();
reflectiveClasses.produce(createReflectiveBuildItem(COUNTED_ANNOTATION, index));
reflectiveClasses.produce(createReflectiveBuildItem(TIMED_ANNOTATION, index));
reflectiveClasses.produce(ReflectiveClassBuildItem.builder("org.HdrHistogram.Histogram", "org.HdrHistogram.DoubleHistogram", "org.HdrHistogram.ConcurrentHistogram").constructors(true).build());
return UnremovableBeanBuildItem.beanTypes(METER_REGISTRY, METER_BINDER, METER_FILTER, NAMING_CONVENTION);
}
use of io.quarkus.arc.processor.InterceptorBindingRegistrar in project quarkus by quarkusio.
the class OpenTelemetryProcessor method registerWithSpan.
@BuildStep(onlyIf = OpenTelemetryEnabled.class)
void registerWithSpan(BuildProducer<InterceptorBindingRegistrarBuildItem> interceptorBindingRegistrar, BuildProducer<AdditionalBeanBuildItem> additionalBeans) {
interceptorBindingRegistrar.produce(new InterceptorBindingRegistrarBuildItem(new InterceptorBindingRegistrar() {
@Override
public List<InterceptorBinding> getAdditionalBindings() {
return List.of(InterceptorBinding.of(WithSpan.class, Set.of("value", "kind")));
}
}));
additionalBeans.produce(new AdditionalBeanBuildItem(WithSpanInterceptor.class));
}
Aggregations