Skip to content

Commit

Permalink
REST filter with Observation API
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobat committed Nov 28, 2024
1 parent 7d3262e commit acfcf9e
Show file tree
Hide file tree
Showing 36 changed files with 2,092 additions and 492 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
import jakarta.enterprise.inject.spi.Extension;
import jakarta.enterprise.util.Nonbinding;

import io.micrometer.observation.ObservationRegistry;
import io.micrometer.observation.annotation.Observed;
import io.smallrye.opentelemetry.instrumentation.observation.ObservationRegistryProducer;
import io.smallrye.opentelemetry.instrumentation.observation.handler.OpenTelemetryObservationHandler;

public class ObservationExtension implements Extension {
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery beforeBeanDiscovery, BeanManager beanManager) {
beforeBeanDiscovery.addInterceptorBinding(
new ObservedAnnotatedType(beanManager.createAnnotatedType(Observed.class)));

beforeBeanDiscovery.addAnnotatedType(ObservationRegistry.class, ObservationRegistry.class.getName());
beforeBeanDiscovery.addAnnotatedType(OpenTelemetryObservationHandler.class,
OpenTelemetryObservationHandler.class.getName());
beforeBeanDiscovery.addAnnotatedType(ObservationRegistryProducer.class, ObservationRegistryProducer.class.getName());
}

public void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import io.smallrye.opentelemetry.implementation.cdi.OpenTelemetryExtension;
import io.smallrye.opentelemetry.implementation.config.OpenTelemetryConfigProducer;
import io.smallrye.opentelemetry.implementation.micrometer.cdi.MicrometerExtension;
import io.smallrye.opentelemetry.instrumentation.observation.ObservationRegistryProducer;
import io.smallrye.opentelemetry.instrumentation.observation.cdi.ObservationExtension;
import io.smallrye.opentelemetry.instrumentation.observation.handler.OpenTelemetryObservationHandler;
import io.smallrye.opentelemetry.test.InMemoryExporter;
Expand Down
5 changes: 4 additions & 1 deletion implementation/rest-observation/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-api</artifactId>
</dependency>

<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-micrometer-otel-bridge</artifactId>
</dependency>
<dependency>
<groupId>io.smallrye.opentelemetry</groupId>
<artifactId>smallrye-opentelemetry-observation-otel-bridge</artifactId>
Expand Down

This file was deleted.

Loading

0 comments on commit acfcf9e

Please sign in to comment.