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 Feb 22, 2024
1 parent 71f5aa4 commit d10383f
Show file tree
Hide file tree
Showing 37 changed files with 2,056 additions and 527 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 @@ -7,8 +7,8 @@

import io.micrometer.observation.ObservationRegistry;
import io.micrometer.observation.annotation.Observed;
import io.smallrye.opentelemetry.instrumentation.observation.cdi.convention.DefaultObservedInterceptorConvention;
import io.smallrye.opentelemetry.instrumentation.observation.cdi.convention.CdiInterceptorContext;
import io.smallrye.opentelemetry.instrumentation.observation.cdi.convention.DefaultObservedInterceptorConvention;
import io.smallrye.opentelemetry.instrumentation.observation.cdi.convention.ObservedInterceptorConvention;
import io.smallrye.opentelemetry.instrumentation.observation.cdi.convention.ObservedInterceptorDocumentation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,15 @@
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.InMemoryMetricExporter;
import io.smallrye.opentelemetry.test.InMemoryMetricExporterProvider;
import io.smallrye.opentelemetry.test.InMemorySpanExporter;
import io.smallrye.opentelemetry.test.InMemorySpanExporterProvider;

@EnableAutoWeld
@AddExtensions({ OpenTelemetryExtension.class, ConfigExtension.class, ObservationExtension.class, MicrometerExtension.class })
@AddBeanClasses({ OpenTelemetryConfigProducer.class, ObservationRegistryProducer.class, OpenTelemetryObservationHandler.class,
InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class,
@AddBeanClasses({ OpenTelemetryConfigProducer.class, InMemoryMetricExporter.class, InMemoryMetricExporterProvider.class,
InMemorySpanExporter.class, InMemorySpanExporterProvider.class, })
class ObservationOTelTest {
@Inject
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 d10383f

Please sign in to comment.