This is an automated email from the ASF dual-hosted git repository.

oscerd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 263a6d734a4b CAMEL-23460: camel-telemetry - add span decorators for 
Google Cloud (AI/ML & misc batch) (#25071)
263a6d734a4b is described below

commit 263a6d734a4b58a2be595cf3ca21e690581ea68b
Author: Andrea Cosentino <[email protected]>
AuthorDate: Tue Jul 28 09:17:53 2026 +0200

    CAMEL-23460: camel-telemetry - add span decorators for Google Cloud (AI/ML 
& misc batch) (#25071)
    
    * CAMEL-23460: camel-telemetry - add span decorators for Google Cloud 
(AI/ML & misc batch)
    
    Second batch of Google Cloud span decorators, following batch 1 (#24974) 
and the
    AWS pattern (CAMEL-23387):
    
    - GoogleFunctionsSpanDecorator: operation, entryPoint, runtime
    - GoogleSecretManagerSpanDecorator: operation, secretId, versionId (the 
secret
      identifier/version only, never the secret value)
    - GoogleVertexAISpanDecorator: operation, modelId, location (the prompt and 
chat
      messages carry user content and are deliberately not emitted)
    - GoogleVisionSpanDecorator / GoogleSpeechToTextSpanDecorator /
      GoogleTextToSpeechSpanDecorator: operation only (the response object may 
carry
      large audio/image payloads and is not emitted)
    
    Header constants are mirrored from each component's Constants interface to 
avoid
    a hard dependency from camel-telemetry to the Google component modules.
    Decorators are registered alphabetically in the SpanDecorator service file 
and
    each has a unit test.
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    Signed-off-by: Andrea Cosentino <[email protected]>
    
    * CAMEL-23460: address review - AssertJ and package-private test conventions
    
    Per project conventions for new test code, the six new Google span-decorator
    tests (Functions, SecretManager, SpeechToText, TextToSpeech, VertexAI, 
Vision)
    now use package-private class/method visibility and AssertJ assertions:
    assertThat(span.tags()).containsEntry(KEY, value) and 
.doesNotContainKey(...)
    for the redaction checks (per apupier's suggestion). Adds the test-scoped
    assertj-core dependency to camel-telemetry.
    
    Batch 1 (already merged) keeps its JUnit style; this aligns only the new 
files.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    Signed-off-by: Andrea Cosentino <[email protected]>
    
    ---------
    
    Signed-off-by: Andrea Cosentino <[email protected]>
    Co-authored-by: Claude Fable 5 <[email protected]>
---
 components/camel-telemetry/pom.xml                 |  5 ++
 .../decorators/GoogleFunctionsSpanDecorator.java   | 65 +++++++++++++++++++++
 .../GoogleSecretManagerSpanDecorator.java          | 66 ++++++++++++++++++++++
 .../GoogleSpeechToTextSpanDecorator.java           | 52 +++++++++++++++++
 .../GoogleTextToSpeechSpanDecorator.java           | 52 +++++++++++++++++
 .../decorators/GoogleVertexAISpanDecorator.java    | 66 ++++++++++++++++++++++
 .../decorators/GoogleVisionSpanDecorator.java      | 52 +++++++++++++++++
 .../org.apache.camel.telemetry.SpanDecorator       |  6 ++
 .../GoogleFunctionsSpanDecoratorTest.java          | 57 +++++++++++++++++++
 .../GoogleSecretManagerSpanDecoratorTest.java      | 57 +++++++++++++++++++
 .../GoogleSpeechToTextSpanDecoratorTest.java       | 51 +++++++++++++++++
 .../GoogleTextToSpeechSpanDecoratorTest.java       | 51 +++++++++++++++++
 .../GoogleVertexAISpanDecoratorTest.java           | 60 ++++++++++++++++++++
 .../decorators/GoogleVisionSpanDecoratorTest.java  | 51 +++++++++++++++++
 14 files changed, 691 insertions(+)

diff --git a/components/camel-telemetry/pom.xml 
b/components/camel-telemetry/pom.xml
index 92eeaf573d9e..69196382fc32 100644
--- a/components/camel-telemetry/pom.xml
+++ b/components/camel-telemetry/pom.xml
@@ -55,6 +55,11 @@
       <version>${mockito-version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.assertj</groupId>
+      <artifactId>assertj-core</artifactId>
+      <scope>test</scope>
+    </dependency>
 
     <!-- Required to test CXF async -->
     <dependency>
diff --git 
a/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleFunctionsSpanDecorator.java
 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleFunctionsSpanDecorator.java
new file mode 100644
index 000000000000..d591e48ca2ce
--- /dev/null
+++ 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleFunctionsSpanDecorator.java
@@ -0,0 +1,65 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.telemetry.Span;
+
+public class GoogleFunctionsSpanDecorator extends AbstractSpanDecorator {
+
+    static final String FUNCTIONS_OPERATION = "operation";
+    static final String FUNCTIONS_ENTRY_POINT = "entryPoint";
+    static final String FUNCTIONS_RUNTIME = "runtime";
+
+    /**
+     * Constants copied from {@link 
org.apache.camel.component.google.functions.GoogleCloudFunctionsConstants}
+     */
+    static final String OPERATION = "CamelGoogleCloudFunctionsOperation";
+    static final String ENTRY_POINT = "CamelGoogleCloudFunctionsEntryPoint";
+    static final String RUNTIME = "CamelGoogleCloudFunctionsRuntime";
+
+    @Override
+    public String getComponent() {
+        return "google-functions";
+    }
+
+    @Override
+    public String getComponentClassName() {
+        return 
"org.apache.camel.component.google.functions.GoogleCloudFunctionsComponent";
+    }
+
+    @Override
+    public void beforeTracingEvent(Span span, Exchange exchange, Endpoint 
endpoint) {
+        super.beforeTracingEvent(span, exchange, endpoint);
+
+        Object operation = exchange.getIn().getHeader(OPERATION);
+        if (operation != null) {
+            span.setTag(FUNCTIONS_OPERATION, operation.toString());
+        }
+
+        String entryPoint = exchange.getIn().getHeader(ENTRY_POINT, 
String.class);
+        if (entryPoint != null) {
+            span.setTag(FUNCTIONS_ENTRY_POINT, entryPoint);
+        }
+
+        String runtime = exchange.getIn().getHeader(RUNTIME, String.class);
+        if (runtime != null) {
+            span.setTag(FUNCTIONS_RUNTIME, runtime);
+        }
+    }
+}
diff --git 
a/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleSecretManagerSpanDecorator.java
 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleSecretManagerSpanDecorator.java
new file mode 100644
index 000000000000..aed67412fe48
--- /dev/null
+++ 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleSecretManagerSpanDecorator.java
@@ -0,0 +1,66 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.telemetry.Span;
+
+public class GoogleSecretManagerSpanDecorator extends AbstractSpanDecorator {
+
+    static final String SECRET_MANAGER_OPERATION = "operation";
+    static final String SECRET_MANAGER_SECRET_ID = "secretId";
+    static final String SECRET_MANAGER_VERSION_ID = "versionId";
+
+    /**
+     * Constants copied from {@link 
org.apache.camel.component.google.secret.manager.GoogleSecretManagerConstants}. 
Only
+     * the secret identifier (name) and version are tagged, never the secret 
value.
+     */
+    static final String OPERATION = "CamelGoogleSecretManagerOperation";
+    static final String SECRET_ID = "CamelGoogleSecretManagerSecretId";
+    static final String VERSION_ID = "CamelGoogleSecretManagerVersionId";
+
+    @Override
+    public String getComponent() {
+        return "google-secret-manager";
+    }
+
+    @Override
+    public String getComponentClassName() {
+        return 
"org.apache.camel.component.google.secret.manager.GoogleSecretManagerComponent";
+    }
+
+    @Override
+    public void beforeTracingEvent(Span span, Exchange exchange, Endpoint 
endpoint) {
+        super.beforeTracingEvent(span, exchange, endpoint);
+
+        Object operation = exchange.getIn().getHeader(OPERATION);
+        if (operation != null) {
+            span.setTag(SECRET_MANAGER_OPERATION, operation.toString());
+        }
+
+        String secretId = exchange.getIn().getHeader(SECRET_ID, String.class);
+        if (secretId != null) {
+            span.setTag(SECRET_MANAGER_SECRET_ID, secretId);
+        }
+
+        String versionId = exchange.getIn().getHeader(VERSION_ID, 
String.class);
+        if (versionId != null) {
+            span.setTag(SECRET_MANAGER_VERSION_ID, versionId);
+        }
+    }
+}
diff --git 
a/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleSpeechToTextSpanDecorator.java
 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleSpeechToTextSpanDecorator.java
new file mode 100644
index 000000000000..e3083593d5e2
--- /dev/null
+++ 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleSpeechToTextSpanDecorator.java
@@ -0,0 +1,52 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.telemetry.Span;
+
+public class GoogleSpeechToTextSpanDecorator extends AbstractSpanDecorator {
+
+    static final String SPEECH_TO_TEXT_OPERATION = "operation";
+
+    /**
+     * Constants copied from {@link 
org.apache.camel.component.google.speechtotext.GoogleCloudSpeechToTextConstants}.
+     * Only the operation is tagged; the response object may carry large 
audio/image payloads and is not emitted.
+     */
+    static final String OPERATION = "CamelGoogleCloudSpeechToTextOperation";
+
+    @Override
+    public String getComponent() {
+        return "google-speech-to-text";
+    }
+
+    @Override
+    public String getComponentClassName() {
+        return 
"org.apache.camel.component.google.speechtotext.GoogleCloudSpeechToTextComponent";
+    }
+
+    @Override
+    public void beforeTracingEvent(Span span, Exchange exchange, Endpoint 
endpoint) {
+        super.beforeTracingEvent(span, exchange, endpoint);
+
+        Object operation = exchange.getIn().getHeader(OPERATION);
+        if (operation != null) {
+            span.setTag(SPEECH_TO_TEXT_OPERATION, operation.toString());
+        }
+    }
+}
diff --git 
a/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleTextToSpeechSpanDecorator.java
 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleTextToSpeechSpanDecorator.java
new file mode 100644
index 000000000000..8556e47aec5d
--- /dev/null
+++ 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleTextToSpeechSpanDecorator.java
@@ -0,0 +1,52 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.telemetry.Span;
+
+public class GoogleTextToSpeechSpanDecorator extends AbstractSpanDecorator {
+
+    static final String TEXT_TO_SPEECH_OPERATION = "operation";
+
+    /**
+     * Constants copied from {@link 
org.apache.camel.component.google.texttospeech.GoogleCloudTextToSpeechConstants}.
+     * Only the operation is tagged; the response object may carry large 
audio/image payloads and is not emitted.
+     */
+    static final String OPERATION = "CamelGoogleCloudTextToSpeechOperation";
+
+    @Override
+    public String getComponent() {
+        return "google-text-to-speech";
+    }
+
+    @Override
+    public String getComponentClassName() {
+        return 
"org.apache.camel.component.google.texttospeech.GoogleCloudTextToSpeechComponent";
+    }
+
+    @Override
+    public void beforeTracingEvent(Span span, Exchange exchange, Endpoint 
endpoint) {
+        super.beforeTracingEvent(span, exchange, endpoint);
+
+        Object operation = exchange.getIn().getHeader(OPERATION);
+        if (operation != null) {
+            span.setTag(TEXT_TO_SPEECH_OPERATION, operation.toString());
+        }
+    }
+}
diff --git 
a/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleVertexAISpanDecorator.java
 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleVertexAISpanDecorator.java
new file mode 100644
index 000000000000..b5681d3bad61
--- /dev/null
+++ 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleVertexAISpanDecorator.java
@@ -0,0 +1,66 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.telemetry.Span;
+
+public class GoogleVertexAISpanDecorator extends AbstractSpanDecorator {
+
+    static final String VERTEXAI_OPERATION = "operation";
+    static final String VERTEXAI_MODEL_ID = "modelId";
+    static final String VERTEXAI_LOCATION = "location";
+
+    /**
+     * Constants copied from {@link 
org.apache.camel.component.google.vertexai.GoogleVertexAIConstants}. The prompt 
and
+     * chat messages carry user content and the tuning parameters are not 
useful as tags, so they are not emitted.
+     */
+    static final String OPERATION = "CamelGoogleVertexAIOperation";
+    static final String MODEL_ID = "CamelGoogleVertexAIModelId";
+    static final String LOCATION = "CamelGoogleVertexAILocation";
+
+    @Override
+    public String getComponent() {
+        return "google-vertexai";
+    }
+
+    @Override
+    public String getComponentClassName() {
+        return 
"org.apache.camel.component.google.vertexai.GoogleVertexAIComponent";
+    }
+
+    @Override
+    public void beforeTracingEvent(Span span, Exchange exchange, Endpoint 
endpoint) {
+        super.beforeTracingEvent(span, exchange, endpoint);
+
+        Object operation = exchange.getIn().getHeader(OPERATION);
+        if (operation != null) {
+            span.setTag(VERTEXAI_OPERATION, operation.toString());
+        }
+
+        String modelId = exchange.getIn().getHeader(MODEL_ID, String.class);
+        if (modelId != null) {
+            span.setTag(VERTEXAI_MODEL_ID, modelId);
+        }
+
+        String location = exchange.getIn().getHeader(LOCATION, String.class);
+        if (location != null) {
+            span.setTag(VERTEXAI_LOCATION, location);
+        }
+    }
+}
diff --git 
a/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleVisionSpanDecorator.java
 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleVisionSpanDecorator.java
new file mode 100644
index 000000000000..2c676e96f630
--- /dev/null
+++ 
b/components/camel-telemetry/src/main/java/org/apache/camel/telemetry/decorators/GoogleVisionSpanDecorator.java
@@ -0,0 +1,52 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.telemetry.Span;
+
+public class GoogleVisionSpanDecorator extends AbstractSpanDecorator {
+
+    static final String VISION_OPERATION = "operation";
+
+    /**
+     * Constants copied from {@link 
org.apache.camel.component.google.vision.GoogleCloudVisionConstants}. Only the
+     * operation is tagged; the response object may carry large audio/image 
payloads and is not emitted.
+     */
+    static final String OPERATION = "CamelGoogleCloudVisionOperation";
+
+    @Override
+    public String getComponent() {
+        return "google-vision";
+    }
+
+    @Override
+    public String getComponentClassName() {
+        return 
"org.apache.camel.component.google.vision.GoogleCloudVisionComponent";
+    }
+
+    @Override
+    public void beforeTracingEvent(Span span, Exchange exchange, Endpoint 
endpoint) {
+        super.beforeTracingEvent(span, exchange, endpoint);
+
+        Object operation = exchange.getIn().getHeader(OPERATION);
+        if (operation != null) {
+            span.setTag(VISION_OPERATION, operation.toString());
+        }
+    }
+}
diff --git 
a/components/camel-telemetry/src/main/resources/META-INF/services/org.apache.camel.telemetry.SpanDecorator
 
b/components/camel-telemetry/src/main/resources/META-INF/services/org.apache.camel.telemetry.SpanDecorator
index 9bf29da81cd0..a0debf65aec4 100644
--- 
a/components/camel-telemetry/src/main/resources/META-INF/services/org.apache.camel.telemetry.SpanDecorator
+++ 
b/components/camel-telemetry/src/main/resources/META-INF/services/org.apache.camel.telemetry.SpanDecorator
@@ -68,8 +68,14 @@ org.apache.camel.telemetry.decorators.FtpSpanDecorator
 org.apache.camel.telemetry.decorators.FtpsSpanDecorator
 org.apache.camel.telemetry.decorators.GoogleBigQuerySpanDecorator
 org.apache.camel.telemetry.decorators.GoogleFirestoreSpanDecorator
+org.apache.camel.telemetry.decorators.GoogleFunctionsSpanDecorator
 org.apache.camel.telemetry.decorators.GooglePubsubSpanDecorator
+org.apache.camel.telemetry.decorators.GoogleSecretManagerSpanDecorator
+org.apache.camel.telemetry.decorators.GoogleSpeechToTextSpanDecorator
 org.apache.camel.telemetry.decorators.GoogleStorageSpanDecorator
+org.apache.camel.telemetry.decorators.GoogleTextToSpeechSpanDecorator
+org.apache.camel.telemetry.decorators.GoogleVertexAISpanDecorator
+org.apache.camel.telemetry.decorators.GoogleVisionSpanDecorator
 org.apache.camel.telemetry.decorators.HttpSpanDecorator
 org.apache.camel.telemetry.decorators.HttpsSpanDecorator
 org.apache.camel.telemetry.decorators.IronmqSpanDecorator
diff --git 
a/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleFunctionsSpanDecoratorTest.java
 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleFunctionsSpanDecoratorTest.java
new file mode 100644
index 000000000000..ab9480ce3ab9
--- /dev/null
+++ 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleFunctionsSpanDecoratorTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.telemetry.mock.MockSpanAdapter;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class GoogleFunctionsSpanDecoratorTest {
+
+    @Test
+    void testPre() {
+        String operation = "callFunction";
+        String entryPoint = "myEntryPoint";
+        String runtime = "java17";
+
+        Endpoint endpoint = Mockito.mock(Endpoint.class);
+        Exchange exchange = Mockito.mock(Exchange.class);
+        Message message = Mockito.mock(Message.class);
+
+        
Mockito.when(endpoint.getEndpointUri()).thenReturn("google-functions:myFunction");
+        Mockito.when(exchange.getIn()).thenReturn(message);
+        Mockito.when(exchange.getExchangeId()).thenReturn("exchange-1");
+        
Mockito.when(message.getHeader(GoogleFunctionsSpanDecorator.OPERATION)).thenReturn(operation);
+        
Mockito.when(message.getHeader(GoogleFunctionsSpanDecorator.ENTRY_POINT, 
String.class)).thenReturn(entryPoint);
+        Mockito.when(message.getHeader(GoogleFunctionsSpanDecorator.RUNTIME, 
String.class)).thenReturn(runtime);
+
+        AbstractSpanDecorator decorator = new GoogleFunctionsSpanDecorator();
+
+        MockSpanAdapter span = new MockSpanAdapter();
+
+        decorator.beforeTracingEvent(span, exchange, endpoint);
+
+        
assertThat(span.tags()).containsEntry(GoogleFunctionsSpanDecorator.FUNCTIONS_OPERATION,
 operation);
+        
assertThat(span.tags()).containsEntry(GoogleFunctionsSpanDecorator.FUNCTIONS_ENTRY_POINT,
 entryPoint);
+        
assertThat(span.tags()).containsEntry(GoogleFunctionsSpanDecorator.FUNCTIONS_RUNTIME,
 runtime);
+    }
+}
diff --git 
a/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleSecretManagerSpanDecoratorTest.java
 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleSecretManagerSpanDecoratorTest.java
new file mode 100644
index 000000000000..db84bc2619cc
--- /dev/null
+++ 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleSecretManagerSpanDecoratorTest.java
@@ -0,0 +1,57 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.telemetry.mock.MockSpanAdapter;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class GoogleSecretManagerSpanDecoratorTest {
+
+    @Test
+    void testPre() {
+        String operation = "getSecretVersion";
+        String secretId = "my-secret";
+        String versionId = "3";
+
+        Endpoint endpoint = Mockito.mock(Endpoint.class);
+        Exchange exchange = Mockito.mock(Exchange.class);
+        Message message = Mockito.mock(Message.class);
+
+        
Mockito.when(endpoint.getEndpointUri()).thenReturn("google-secret-manager:myProject");
+        Mockito.when(exchange.getIn()).thenReturn(message);
+        Mockito.when(exchange.getExchangeId()).thenReturn("exchange-1");
+        
Mockito.when(message.getHeader(GoogleSecretManagerSpanDecorator.OPERATION)).thenReturn(operation);
+        
Mockito.when(message.getHeader(GoogleSecretManagerSpanDecorator.SECRET_ID, 
String.class)).thenReturn(secretId);
+        
Mockito.when(message.getHeader(GoogleSecretManagerSpanDecorator.VERSION_ID, 
String.class)).thenReturn(versionId);
+
+        AbstractSpanDecorator decorator = new 
GoogleSecretManagerSpanDecorator();
+
+        MockSpanAdapter span = new MockSpanAdapter();
+
+        decorator.beforeTracingEvent(span, exchange, endpoint);
+
+        
assertThat(span.tags()).containsEntry(GoogleSecretManagerSpanDecorator.SECRET_MANAGER_OPERATION,
 operation);
+        
assertThat(span.tags()).containsEntry(GoogleSecretManagerSpanDecorator.SECRET_MANAGER_SECRET_ID,
 secretId);
+        
assertThat(span.tags()).containsEntry(GoogleSecretManagerSpanDecorator.SECRET_MANAGER_VERSION_ID,
 versionId);
+    }
+}
diff --git 
a/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleSpeechToTextSpanDecoratorTest.java
 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleSpeechToTextSpanDecoratorTest.java
new file mode 100644
index 000000000000..6fe618aa0306
--- /dev/null
+++ 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleSpeechToTextSpanDecoratorTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.telemetry.mock.MockSpanAdapter;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class GoogleSpeechToTextSpanDecoratorTest {
+
+    @Test
+    void testPre() {
+        String operation = "someOperation";
+
+        Endpoint endpoint = Mockito.mock(Endpoint.class);
+        Exchange exchange = Mockito.mock(Exchange.class);
+        Message message = Mockito.mock(Message.class);
+
+        
Mockito.when(endpoint.getEndpointUri()).thenReturn("google-speech-to-text:name");
+        Mockito.when(exchange.getIn()).thenReturn(message);
+        Mockito.when(exchange.getExchangeId()).thenReturn("exchange-1");
+        
Mockito.when(message.getHeader(GoogleSpeechToTextSpanDecorator.OPERATION)).thenReturn(operation);
+
+        AbstractSpanDecorator decorator = new 
GoogleSpeechToTextSpanDecorator();
+
+        MockSpanAdapter span = new MockSpanAdapter();
+
+        decorator.beforeTracingEvent(span, exchange, endpoint);
+
+        
assertThat(span.tags()).containsEntry(GoogleSpeechToTextSpanDecorator.SPEECH_TO_TEXT_OPERATION,
 operation);
+    }
+}
diff --git 
a/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleTextToSpeechSpanDecoratorTest.java
 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleTextToSpeechSpanDecoratorTest.java
new file mode 100644
index 000000000000..59c5303b7e50
--- /dev/null
+++ 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleTextToSpeechSpanDecoratorTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.telemetry.mock.MockSpanAdapter;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class GoogleTextToSpeechSpanDecoratorTest {
+
+    @Test
+    void testPre() {
+        String operation = "someOperation";
+
+        Endpoint endpoint = Mockito.mock(Endpoint.class);
+        Exchange exchange = Mockito.mock(Exchange.class);
+        Message message = Mockito.mock(Message.class);
+
+        
Mockito.when(endpoint.getEndpointUri()).thenReturn("google-text-to-speech:name");
+        Mockito.when(exchange.getIn()).thenReturn(message);
+        Mockito.when(exchange.getExchangeId()).thenReturn("exchange-1");
+        
Mockito.when(message.getHeader(GoogleTextToSpeechSpanDecorator.OPERATION)).thenReturn(operation);
+
+        AbstractSpanDecorator decorator = new 
GoogleTextToSpeechSpanDecorator();
+
+        MockSpanAdapter span = new MockSpanAdapter();
+
+        decorator.beforeTracingEvent(span, exchange, endpoint);
+
+        
assertThat(span.tags()).containsEntry(GoogleTextToSpeechSpanDecorator.TEXT_TO_SPEECH_OPERATION,
 operation);
+    }
+}
diff --git 
a/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleVertexAISpanDecoratorTest.java
 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleVertexAISpanDecoratorTest.java
new file mode 100644
index 000000000000..9c9911274bd3
--- /dev/null
+++ 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleVertexAISpanDecoratorTest.java
@@ -0,0 +1,60 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.telemetry.mock.MockSpanAdapter;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class GoogleVertexAISpanDecoratorTest {
+
+    @Test
+    void testPre() {
+        String operation = "chatCompletion";
+        String modelId = "gemini-1.5-pro";
+        String location = "us-central1";
+
+        Endpoint endpoint = Mockito.mock(Endpoint.class);
+        Exchange exchange = Mockito.mock(Exchange.class);
+        Message message = Mockito.mock(Message.class);
+
+        
Mockito.when(endpoint.getEndpointUri()).thenReturn("google-vertexai:myProject");
+        Mockito.when(exchange.getIn()).thenReturn(message);
+        Mockito.when(exchange.getExchangeId()).thenReturn("exchange-1");
+        
Mockito.when(message.getHeader(GoogleVertexAISpanDecorator.OPERATION)).thenReturn(operation);
+        Mockito.when(message.getHeader(GoogleVertexAISpanDecorator.MODEL_ID, 
String.class)).thenReturn(modelId);
+        Mockito.when(message.getHeader(GoogleVertexAISpanDecorator.LOCATION, 
String.class)).thenReturn(location);
+
+        AbstractSpanDecorator decorator = new GoogleVertexAISpanDecorator();
+
+        MockSpanAdapter span = new MockSpanAdapter();
+
+        decorator.beforeTracingEvent(span, exchange, endpoint);
+
+        
assertThat(span.tags()).containsEntry(GoogleVertexAISpanDecorator.VERTEXAI_OPERATION,
 operation);
+        
assertThat(span.tags()).containsEntry(GoogleVertexAISpanDecorator.VERTEXAI_MODEL_ID,
 modelId);
+        
assertThat(span.tags()).containsEntry(GoogleVertexAISpanDecorator.VERTEXAI_LOCATION,
 location);
+        // the prompt and chat messages carry user content and must never be 
emitted as tags
+        assertThat(span.tags()).doesNotContainKey("prompt");
+        assertThat(span.tags()).doesNotContainKey("chatMessages");
+    }
+}
diff --git 
a/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleVisionSpanDecoratorTest.java
 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleVisionSpanDecoratorTest.java
new file mode 100644
index 000000000000..510645d8deca
--- /dev/null
+++ 
b/components/camel-telemetry/src/test/java/org/apache/camel/telemetry/decorators/GoogleVisionSpanDecoratorTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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.telemetry.decorators;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.Exchange;
+import org.apache.camel.Message;
+import org.apache.camel.telemetry.mock.MockSpanAdapter;
+import org.junit.jupiter.api.Test;
+import org.mockito.Mockito;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class GoogleVisionSpanDecoratorTest {
+
+    @Test
+    void testPre() {
+        String operation = "someOperation";
+
+        Endpoint endpoint = Mockito.mock(Endpoint.class);
+        Exchange exchange = Mockito.mock(Exchange.class);
+        Message message = Mockito.mock(Message.class);
+
+        
Mockito.when(endpoint.getEndpointUri()).thenReturn("google-vision:name");
+        Mockito.when(exchange.getIn()).thenReturn(message);
+        Mockito.when(exchange.getExchangeId()).thenReturn("exchange-1");
+        
Mockito.when(message.getHeader(GoogleVisionSpanDecorator.OPERATION)).thenReturn(operation);
+
+        AbstractSpanDecorator decorator = new GoogleVisionSpanDecorator();
+
+        MockSpanAdapter span = new MockSpanAdapter();
+
+        decorator.beforeTracingEvent(span, exchange, endpoint);
+
+        
assertThat(span.tags()).containsEntry(GoogleVisionSpanDecorator.VISION_OPERATION,
 operation);
+    }
+}

Reply via email to