Skip to content

Commit

Permalink
Adjust toggle names in OTel InstrumentBuildTimeConfig
Browse files Browse the repository at this point in the history
This is to be consistent with the new extension names.
  • Loading branch information
gsmet committed Mar 15, 2024
1 parent 0ff6395 commit c9f3a38
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void registerRestClientClassicProvider(
BuildProducer<AdditionalBeanBuildItem> additionalBeans,
OTelBuildConfig config) {
if (capabilities.isPresent(Capability.REST_CLIENT) && capabilities.isMissing(Capability.REST_CLIENT_REACTIVE)
&& config.instrument().restClientClassic()) {
&& config.instrument().resteasyClient()) {
additionalIndexed.produce(new AdditionalIndexedClassesBuildItem(OpenTelemetryClientFilter.class.getName()));
additionalBeans.produce(new AdditionalBeanBuildItem(OpenTelemetryClientFilter.class));
}
Expand All @@ -96,7 +96,7 @@ void registerReactiveMessagingMessageDecorator(
Capabilities capabilities,
BuildProducer<AdditionalBeanBuildItem> additionalBeans,
OTelBuildConfig config) {
if (capabilities.isPresent(Capability.SMALLRYE_REACTIVE_MESSAGING) && config.instrument().reactiveMessaging()) {
if (capabilities.isPresent(Capability.MESSAGING) && config.instrument().messaging()) {
additionalBeans.produce(new AdditionalBeanBuildItem(ReactiveMessagingTracingOutgoingDecorator.class));
additionalBeans.produce(new AdditionalBeanBuildItem(ReactiveMessagingTracingIncomingDecorator.class));
}
Expand All @@ -122,7 +122,7 @@ VertxOptionsConsumerBuildItem vertxTracingOptions(
void registerResteasyClassicAndOrResteasyReactiveProvider(OTelBuildConfig config,
Capabilities capabilities,
BuildProducer<ResteasyJaxrsProviderBuildItem> resteasyJaxrsProviderBuildItemBuildProducer) {
if (capabilities.isPresent(Capability.RESTEASY) && config.instrument().resteasyClassic()) {
if (capabilities.isPresent(Capability.RESTEASY) && config.instrument().resteasy()) {
resteasyJaxrsProviderBuildItemBuildProducer
.produce(new ResteasyJaxrsProviderBuildItem(OpenTelemetryClassicServerFilter.class.getName()));
}
Expand All @@ -134,7 +134,7 @@ void resteasyReactiveIntegration(
BuildProducer<CustomContainerRequestFilterBuildItem> containerRequestFilterBuildItemBuildProducer,
BuildProducer<PreExceptionMapperHandlerBuildItem> preExceptionMapperHandlerBuildItemBuildProducer,
OTelBuildConfig config) {
if (capabilities.isPresent(Capability.RESTEASY_REACTIVE) && config.instrument().resteasyReactive()) {
if (capabilities.isPresent(Capability.RESTEASY_REACTIVE) && config.instrument().rest()) {
containerRequestFilterBuildItemBuildProducer
.produce(new CustomContainerRequestFilterBuildItem(OpenTelemetryReactiveServerFilter.class.getName()));
preExceptionMapperHandlerBuildItemBuildProducer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,28 @@ public interface InstrumentBuildTimeConfig {
boolean grpc();

/**
* Enables instrumentation for SmallRye Reactive Messaging.
* Enables instrumentation for Messaging.
*/
@WithDefault("true")
boolean reactiveMessaging();
boolean messaging();

/**
* Enables instrumentation for JAX-RS Rest Client backed by RESTEasy Classic.
* Enables instrumentation for REST Client backed by RESTEasy Classic.
*/
@WithDefault("true")
boolean restClientClassic();
boolean resteasyClient();

/**
* Enables instrumentation for RESTEasy Reactive.
* Enables instrumentation for Quarkus REST.
*/
@WithDefault("true")
boolean resteasyReactive();
boolean rest();

/**
* Enables instrumentation for RESTEasy Classic.
*/
@WithDefault("true")
boolean resteasyClassic();
boolean resteasy();

// NOTE: agroal, graphql and scheduler have their own config properties

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.quarkus.opentelemetry.runtime.config.build;

import java.util.function.Function;

import io.smallrye.config.FallbackConfigSourceInterceptor;

/**
* @deprecated maps the old config to the new config, should be removed at some point
*/
@Deprecated(forRemoval = true, since = "3.9")
public class InstrumentBuildTimeConfigFallbackConfigSourceInterceptor extends FallbackConfigSourceInterceptor {

private static final Function<String, String> RENAME_FUNCTION = new Function<String, String>() {
@Override
public String apply(String s) {
if (!s.startsWith("quarkus.otel.instrument.")) {
return s;
}

if ("quarkus.otel.instrument.messaging".equals(s)) {
return "quarkus.otel.instrument.reactive-messaging";
}
if ("quarkus.otel.instrument.resteasy-client".equals(s)) {
return "quarkus.otel.instrument.rest-client-classic";
}
if ("quarkus.otel.instrument.rest".equals(s)) {
return "quarkus.otel.instrument.resteasy-reactive";
}
if ("quarkus.otel.instrument.resteasy".equals(s)) {
return "quarkus.otel.instrument.resteasy-classic";
}

return s;
}
};

public InstrumentBuildTimeConfigFallbackConfigSourceInterceptor() {
super(RENAME_FUNCTION);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package io.quarkus.opentelemetry.runtime.config.build;

import java.util.function.Function;

import io.smallrye.config.RelocateConfigSourceInterceptor;

/**
* @deprecated maps the old config to the new config, should be removed at some point
*/
@Deprecated(forRemoval = true, since = "3.9")
public class InstrumentBuildTimeConfigRelocateConfigSourceInterceptor extends RelocateConfigSourceInterceptor {

private static final Function<String, String> RENAME_FUNCTION = new Function<String, String>() {
@Override
public String apply(String s) {
if (!s.startsWith("quarkus.otel.instrument.")) {
return s;
}

if ("quarkus.otel.instrument.reactive-messaging".equals(s)) {
return "quarkus.otel.instrument.messaging";
}
if ("quarkus.otel.instrument.rest-client-classic".equals(s)) {
return "quarkus.otel.instrument.resteasy-client";
}
if ("quarkus.otel.instrument.resteasy-reactive".equals(s)) {
return "quarkus.otel.instrument.rest";
}
if ("quarkus.otel.instrument.resteasy-classic".equals(s)) {
return "quarkus.otel.instrument.resteasy";
}

return s;
}
};

public InstrumentBuildTimeConfigRelocateConfigSourceInterceptor() {
super(RENAME_FUNCTION);
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
io.quarkus.opentelemetry.runtime.config.OTelFallbackConfigSourceInterceptor
io.quarkus.opentelemetry.runtime.config.build.InstrumentBuildTimeConfigFallbackConfigSourceInterceptor
io.quarkus.opentelemetry.runtime.config.build.InstrumentBuildTimeConfigRelocateConfigSourceInterceptor

0 comments on commit c9f3a38

Please sign in to comment.