-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
OpenTelemetry traces and metrics config fallback to base #42814
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 0 additions & 92 deletions
92
.../io/quarkus/opentelemetry/runtime/config/HierarchicalOTelConnectionConfigInterceptor.java
This file was deleted.
Oops, something went wrong.
65 changes: 65 additions & 0 deletions
65
...in/java/io/quarkus/opentelemetry/runtime/config/OpenTelemetryConfigBuilderCustomizer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package io.quarkus.opentelemetry.runtime.config; | ||
|
||
import static io.quarkus.opentelemetry.runtime.config.runtime.exporter.OtlpExporterConfig.DEFAULT_GRPC_BASE_URI; | ||
import static io.quarkus.opentelemetry.runtime.config.runtime.exporter.OtlpExporterConfig.Protocol.GRPC; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import io.smallrye.config.FallbackConfigSourceInterceptor; | ||
import io.smallrye.config.SmallRyeConfigBuilder; | ||
import io.smallrye.config.SmallRyeConfigBuilderCustomizer; | ||
|
||
public class OpenTelemetryConfigBuilderCustomizer implements SmallRyeConfigBuilderCustomizer { | ||
@Override | ||
public void configBuilder(final SmallRyeConfigBuilder builder) { | ||
// Main defaults | ||
builder.withDefaultValue("quarkus.otel.exporter.otlp.endpoint", DEFAULT_GRPC_BASE_URI); | ||
builder.withDefaultValue("quarkus.otel.exporter.otlp.protocol", GRPC); | ||
builder.withDefaultValue("quarkus.otel.exporter.otlp.timeout", "10s"); | ||
builder.withDefaultValue("quarkus.otel.exporter.otlp.proxy-options.enabled", "false"); | ||
|
||
Map<String, String> fallbacks = new HashMap<>(30); | ||
// Traces | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.endpoint", "quarkus.otel.exporter.otlp.endpoint"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.headers", "quarkus.otel.exporter.otlp.headers"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.compression", "quarkus.otel.exporter.otlp.compression"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.timeout", "quarkus.otel.exporter.otlp.timeout"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.protocol", "quarkus.otel.exporter.otlp.protocol"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.key-cert.keys", "quarkus.otel.exporter.otlp.key-cert.keys"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.key-cert.certs", "quarkus.otel.exporter.otlp.key-cert.certs"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.trust-cert.certs", "quarkus.otel.exporter.otlp.trust-cert.certs"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.tls-configuration-name", | ||
"quarkus.otel.exporter.otlp.tls-configuration-name"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.proxy-options.enabled", | ||
"quarkus.otel.exporter.otlp.proxy-options.enabled"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.proxy-options.username", | ||
"quarkus.otel.exporter.otlp.proxy-options.username"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.proxy-options.password", | ||
"quarkus.otel.exporter.otlp.proxy-options.password"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.proxy-options.host", "quarkus.otel.exporter.otlp.proxy-options.host"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.traces.proxy-options.port", "quarkus.otel.exporter.otlp.proxy-options.port"); | ||
|
||
// Metrics | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.endpoint", "quarkus.otel.exporter.otlp.endpoint"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.headers", "quarkus.otel.exporter.otlp.headers"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.compression", "quarkus.otel.exporter.otlp.compression"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.timeout", "quarkus.otel.exporter.otlp.timeout"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.protocol", "quarkus.otel.exporter.otlp.protocol"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.key-cert.keys", "quarkus.otel.exporter.otlp.key-cert.keys"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.key-cert.certs", "quarkus.otel.exporter.otlp.key-cert.certs"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.trust-cert.certs", "quarkus.otel.exporter.otlp.trust-cert.certs"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.tls-configuration-name", | ||
"quarkus.otel.exporter.otlp.tls-configuration-name"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.proxy-options.enabled", | ||
"quarkus.otel.exporter.otlp.proxy-options.enabled"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.proxy-options.username", | ||
"quarkus.otel.exporter.otlp.proxy-options.username"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.proxy-options.password", | ||
"quarkus.otel.exporter.otlp.proxy-options.password"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.proxy-options.host", "quarkus.otel.exporter.otlp.proxy-options.host"); | ||
fallbacks.put("quarkus.otel.exporter.otlp.metrics.proxy-options.port", "quarkus.otel.exporter.otlp.proxy-options.port"); | ||
|
||
builder.withInterceptors(new FallbackConfigSourceInterceptor(fallbacks)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...y/runtime/src/main/resources/META-INF/services/io.smallrye.config.ConfigSourceInterceptor
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...e/src/main/resources/META-INF/services/io.smallrye.config.SmallRyeConfigBuilderCustomizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.quarkus.opentelemetry.runtime.config.OpenTelemetryConfigBuilderCustomizer |
62 changes: 0 additions & 62 deletions
62
...quarkus/opentelemetry/runtime/config/HierarchicalOTelConnectionConfigInterceptorTest.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wonder whether this should be
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is OK.
We now provide relocations and fallbacks from specific path trees
quarkus.otel.exporter.otlp.traces
andquarkus.otel.exporter.otlp.metrics
toquarkus.otel.exporter.otlp
. The relocations and fallbacks have to include the mapping names to work correctly. Because we don't know if we will get the specific or the base configuration, the properties are marked asOptional
in the mapping interface.In this code, we copy the
quarkus
properties to theotel
properties. Because we now have extra names that may not have a value, usinggetValue
will give an error when looking up the configuration. Before, only the property names that contained values were available (the ones defined by the user or defaults). To avoid that error, we now have to usegetConfigValue,
which, on the other hand, does not give an error when you have an expression that cannot be expanded, so in such cases, we force thegetValue
to give that error.