Skip to content

CAMEL-23460: camel-telemetry - add span decorators for Google Cloud (AI/ML & misc batch)#25071

Open
oscerd wants to merge 1 commit into
apache:mainfrom
oscerd:feature/CAMEL-23460-google-span-decorators-aiml
Open

CAMEL-23460: camel-telemetry - add span decorators for Google Cloud (AI/ML & misc batch)#25071
oscerd wants to merge 1 commit into
apache:mainfrom
oscerd:feature/CAMEL-23460-google-span-decorators-aiml

Conversation

@oscerd

@oscerd oscerd commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Motivation

CAMEL-23460, continuing from batch 1 (#24974, merged). This is the issue's AI/ML & misc batch of Google Cloud span decorators.

Changes

Six new decorators (all AbstractSpanDecorator):

Decorator Tags emitted
GoogleFunctionsSpanDecorator operation, entryPoint, runtime
GoogleSecretManagerSpanDecorator operation, secretId, versionId
GoogleVertexAISpanDecorator operation, modelId, location
GoogleVisionSpanDecorator operation
GoogleSpeechToTextSpanDecorator operation
GoogleTextToSpeechSpanDecorator operation

Tag minimization per the rules established in the AWS work — sensitive or bulky values are deliberately dropped:

  • VertexAI: the prompt and chatMessages headers carry user content and are not emitted (the unit test asserts they are never tagged); the tuning parameters (temperature/topP/…) are omitted as low-value.
  • Secret Manager: only the secret identifier and version are tagged — never a secret value.
  • Vision / Speech-to-Text / Text-to-Speech: only operation — their RESPONSE_OBJECT header can carry large audio/image payloads and is not emitted.

Header constants are mirrored from each component's *Constants interface (with a Javadoc @link back to the source), so camel-telemetry gains no hard dependency on the Google component modules. Registered alphabetically in META-INF/services/org.apache.camel.telemetry.SpanDecorator, one unit test per decorator.

The remaining batch — workspace/productivity (Calendar, Drive, Mail, Sheets) — needs a different treatment (Mail's headers are To/From/Cc/Subject, i.e. PII; Drive exposes no data headers) and will be a separate PR.

Testing

  • mvn clean install in components/camel-telemetry: all tests pass (6 new + existing).
  • Full reactor mvn clean install -DskipTests from root: success, no stale generated files.

Metadata/observability addition — main/4.22.0 only, no backport.

Claude Code on behalf of Andrea Cosentino (@oscerd).

🤖 Generated with Claude Code

…AI/ML & misc batch)

Second batch of Google Cloud span decorators, following batch 1 (apache#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 <noreply@anthropic.com>
Signed-off-by: Andrea Cosentino <ancosen@gmail.com>
@oscerd
oscerd requested a review from davsclaus July 23, 2026 16:42
@oscerd oscerd added the enhancement New feature or request label Jul 23, 2026
@oscerd
oscerd requested a review from squakez July 23, 2026 16:42
@github-actions

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-telemetry

🔬 Scalpel shadow comparison — Scalpel: 13 tested, 29 compile-only — current: 13 all tested

Maveniverse Scalpel detected 42 affected modules (current approach: 13).

⚠️ Modules only in Scalpel (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

Skip-tests mode would test 13 modules (1 direct + 12 downstream), skip tests for 29 (generated code, meta-modules)

Modules Scalpel would test (13)
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-micrometer-observability
  • camel-observability-services
  • camel-opentelemetry2
  • camel-telemetry
  • camel-telemetry-dev
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin
Modules with tests skipped (29)
  • apache-camel
  • camel-allcomponents
  • camel-catalog
  • camel-catalog-console
  • camel-catalog-lucene
  • camel-catalog-maven
  • camel-catalog-suggest
  • camel-componentdsl
  • camel-csimple-maven-plugin
  • camel-endpointdsl
  • camel-endpointdsl-support
  • camel-itest
  • camel-jbang-core
  • camel-jbang-it
  • camel-jbang-main
  • camel-jbang-plugin-edit
  • camel-jbang-plugin-generate
  • camel-jbang-plugin-kubernetes
  • camel-jbang-plugin-test
  • camel-kamelet-main
  • camel-launcher
  • camel-report-maven-plugin
  • camel-route-parser
  • camel-yaml-dsl
  • camel-yaml-dsl-deserializers
  • camel-yaml-dsl-maven-plugin
  • coverage
  • docs
  • dummy-component

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

All tested modules (42 modules)
  • Camel :: All Components Sync point
  • Camel :: Assembly
  • Camel :: Catalog :: CSimple Maven Plugin (deprecated)
  • Camel :: Catalog :: Camel Catalog
  • Camel :: Catalog :: Camel Report Maven Plugin
  • Camel :: Catalog :: Camel Route Parser
  • Camel :: Catalog :: Console
  • Camel :: Catalog :: Dummy Component
  • Camel :: Catalog :: Lucene (deprecated)
  • Camel :: Catalog :: Maven
  • Camel :: Catalog :: Suggest
  • Camel :: Common Telemetry
  • Camel :: Component DSL
  • Camel :: Coverage
  • Camel :: Docs
  • Camel :: Endpoint DSL
  • Camel :: Endpoint DSL :: Support
  • Camel :: Integration Tests
  • Camel :: JBang :: Core
  • Camel :: JBang :: Integration tests
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Main
  • Camel :: JBang :: Plugin :: Edit
  • Camel :: JBang :: Plugin :: Generate
  • Camel :: JBang :: Plugin :: Kubernetes
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Testing
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: Kamelet Main
  • Camel :: Launcher
  • Camel :: Launcher :: Container
  • Camel :: Micrometer :: Observability 2
  • Camel :: Observability Services
  • Camel :: Opentelemetry 2
  • Camel :: Telemetry :: Dev
  • Camel :: YAML DSL
  • Camel :: YAML DSL :: Deserializers
  • Camel :: YAML DSL :: Maven Plugins
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@davsclaus davsclaus left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the second batch, @oscerd — nice, clean work continuing the pattern from batch 1.

Two minor convention notes (both low severity and consistent with the already-merged batch 1, so non-blocking):

  1. Test visibility: New test classes and methods should drop the public modifier per project conventions (JUnit 5 doesn't require it). Applies to all 6 test files.
  2. Assertion style: New tests should prefer AssertJ (assertThat(...)) over JUnit assertions (assertEquals/assertNull) per project conventions. Applies to all 6 test files.

Suggestion (non-blocking): The VertexAI decorator currently tags operation, modelId, and location. GoogleVertexAIConstants also exposes PROMPT_TOKEN_COUNT, CANDIDATES_TOKEN_COUNT, TOTAL_TOKEN_COUNT, FINISH_REASON, and PUBLISHER — all lightweight scalar values commonly used in LLM observability dashboards for cost tracking and debugging. Worth considering as an enhancement (here or follow-up).

Everything else looks good — all header constants and component class names verified against the actual source, service file registration is correctly alphabetized, and the security-sensitive omissions (prompts, chat messages, response objects, secret values) are well-reasoned and documented.

This review does not replace specialized tools such as CodeRabbit, Sourcery, or SonarCloud.

Claude Code on behalf of Claus Ibsen (@davsclaus). This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.


import static org.junit.jupiter.api.Assertions.assertEquals;

public class GoogleFunctionsSpanDecoratorTest {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: per project conventions, new test classes should be package-private (drop public). Same applies to the testPre() method below. This is consistent with batch 1 so non-blocking, but worth aligning for new code.

Suggested change
public class GoogleFunctionsSpanDecoratorTest {
class GoogleFunctionsSpanDecoratorTest {

import org.mockito.Mockito;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: per project conventions, new test code should use AssertJ assertions. For example:

import static org.assertj.core.api.Assertions.assertThat;

assertThat(span.tags().get(GoogleVertexAISpanDecorator.VERTEXAI_OPERATION)).isEqualTo(operation);
assertThat(span.tags()).doesNotContainKey("prompt");

Applies to all 6 test files. Non-blocking since batch 1 uses the same pattern.

@apupier apupier Jul 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://joel-costigliola.github.io/assertj/core/api/org/assertj/core/api/MapAssert.html#contains(java.util.Map.Entry...)

assertThat(span.tags())
    .containsEntry(entry(GoogleVertexAISpanDecorator.VERTEXAI_OPERATION, operation))
    .doesNotContainKey("prompt");

@oscerd
oscerd requested a review from Croway July 24, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

components enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants