Skip to content

Commit

Permalink
Merge pull request #39477 from gsmet/otel-config
Browse files Browse the repository at this point in the history
Adjust toggle names in OTel InstrumentBuildTimeConfig
geoand authored Mar 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents c3589a3 + c9f3a38 commit 1605834
Showing 5 changed files with 93 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -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));
}
@@ -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));
}
@@ -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()));
}
@@ -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
Original file line number Diff line number Diff line change
@@ -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

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 1605834

Please sign in to comment.