Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use idiomatic RESTEasy Reactive filter declaration for OpenTelemetry #31331

Merged
merged 1 commit into from
Feb 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import io.quarkus.opentelemetry.runtime.tracing.intrumentation.resteasy.OpenTelemetryClassicServerFilter;
import io.quarkus.opentelemetry.runtime.tracing.intrumentation.resteasy.OpenTelemetryReactiveServerFilter;
import io.quarkus.resteasy.common.spi.ResteasyJaxrsProviderBuildItem;
import io.quarkus.resteasy.reactive.spi.ContainerRequestFilterBuildItem;
import io.quarkus.resteasy.reactive.spi.CustomContainerRequestFilterBuildItem;
import io.quarkus.runtime.LaunchMode;
import io.quarkus.vertx.core.deployment.VertxOptionsConsumerBuildItem;
import io.vertx.core.VertxOptions;
Expand Down Expand Up @@ -136,7 +136,7 @@ void registerResteasyClassicAndOrResteasyReactiveProvider(
@BuildStep
void registerResteasyReactiveProvider(
Capabilities capabilities,
BuildProducer<ContainerRequestFilterBuildItem> containerRequestFilterBuildItemBuildProducer) {
BuildProducer<CustomContainerRequestFilterBuildItem> containerRequestFilterBuildItemBuildProducer) {

boolean isResteasyReactiveAvailable = capabilities.isPresent(Capability.RESTEASY_REACTIVE);

Expand All @@ -146,8 +146,7 @@ void registerResteasyReactiveProvider(
}

containerRequestFilterBuildItemBuildProducer
.produce(new ContainerRequestFilterBuildItem.Builder(OpenTelemetryReactiveServerFilter.class.getName())
.build());
.produce(new CustomContainerRequestFilterBuildItem(OpenTelemetryReactiveServerFilter.class.getName()));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

import java.io.IOException;

import jakarta.ws.rs.container.ContainerRequestContext;
import jakarta.ws.rs.container.ContainerRequestFilter;
import jakarta.ws.rs.core.Context;
import jakarta.ws.rs.ext.Provider;

import org.jboss.resteasy.reactive.server.ServerRequestFilter;
import org.jboss.resteasy.reactive.server.SimpleResourceInfo;

import io.opentelemetry.api.trace.Span;
Expand All @@ -16,14 +12,10 @@
/**
* Handles RESTEasy Reactive (via Vert.x)
*/
@Provider
public class OpenTelemetryReactiveServerFilter implements ContainerRequestFilter {

@Context
SimpleResourceInfo resourceInfo;
public class OpenTelemetryReactiveServerFilter {

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
@ServerRequestFilter
public void filter(SimpleResourceInfo resourceInfo) throws IOException {
Span localRootSpan = LocalRootSpan.current();

localRootSpan.setAttribute(SemanticAttributes.CODE_NAMESPACE, resourceInfo.getResourceClass().getName());
Expand Down