You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2026/06/10 06:26:56 UTC
(camel-quarkus) 49/49: Fix opentelemetry2 native mode tests with GraalVM substitutions
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch camel-main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
commit 7ffdeed0826ce7cad767153d16f4339f31844fb5
Author: James Netherton <ja...@gmail.com>
AuthorDate: Wed Jun 10 07:25:13 2026 +0100
Fix opentelemetry2 native mode tests with GraalVM substitutions
Add substitutions to disable native-unfriendly code meant for Camel JBang
dev mode. The initDevSpanExporter and initOtlpReceiver methods initialize
development/debugging features that rely on dynamic features unsuitable for
native compilation.
Co-Authored-By: Claude Sonnet 4.5 <no...@anthropic.com>
---
extensions/opentelemetry2/runtime/pom.xml | 5 +++
.../graal/OpenTelemetryTracerSubstitutions.java | 41 ++++++++++++++++++++++
2 files changed, 46 insertions(+)
diff --git a/extensions/opentelemetry2/runtime/pom.xml b/extensions/opentelemetry2/runtime/pom.xml
index 379ffdd560..26709cb152 100644
--- a/extensions/opentelemetry2/runtime/pom.xml
+++ b/extensions/opentelemetry2/runtime/pom.xml
@@ -58,6 +58,11 @@
<groupId>org.apache.camel</groupId>
<artifactId>camel-opentelemetry2</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.graalvm.sdk</groupId>
+ <artifactId>nativeimage</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/extensions/opentelemetry2/runtime/src/main/java/org/apache/camel/opentelemetry2/graal/OpenTelemetryTracerSubstitutions.java b/extensions/opentelemetry2/runtime/src/main/java/org/apache/camel/opentelemetry2/graal/OpenTelemetryTracerSubstitutions.java
new file mode 100644
index 0000000000..0a61229d57
--- /dev/null
+++ b/extensions/opentelemetry2/runtime/src/main/java/org/apache/camel/opentelemetry2/graal/OpenTelemetryTracerSubstitutions.java
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.opentelemetry2.graal;
+
+import com.oracle.svm.core.annotate.Substitute;
+import com.oracle.svm.core.annotate.TargetClass;
+import org.apache.camel.opentelemetry2.OpenTelemetryTracer;
+
+/**
+ * Disables native-unfriendly code meant for Camel JBang dev mode.
+ * The initDevSpanExporter and initOtlpReceiver methods initialize development/debugging
+ * features that are not needed in native mode and rely on dynamic features unsuitable
+ * for native compilation.
+ */
+@TargetClass(OpenTelemetryTracer.class)
+final class OpenTelemetryTracerSubstitutions {
+
+ @Substitute
+ private void initDevSpanExporter() {
+ // No-op in native mode
+ }
+
+ @Substitute
+ private void initOtlpReceiver() {
+ // No-op in native mode
+ }
+}