Skip to content

fix(spring-boot-starter): configure FITracer without Spring AI and reuse Boot's OpenTelemetry - #444

Open
nik13 wants to merge 5 commits into
devfrom
fix/spring-boot-starter-provider-reuse
Open

nik13 wants to merge 5 commits into
devfrom
fix/spring-boot-starter-provider-reuse

Conversation

@nik13

@nik13 nik13 commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Keep traceai-spring-boot-starter as Spring Boot configuration for FITracer, not framework instrumentation.

  • Remove the unused traceai-spring-ai / Spring AI milestone coupling.
  • Without an explicit traceAI exporter configuration, reuse the application's OpenTelemetry or TracerProvider bean. Do not add another provider/exporter or close the application's SDK.
  • Preserve configured traceAI export, existing TraceAI.init(...) singletons and custom FITracer beans. Starter-owned providers no longer register globally and are flushed on context shutdown.
  • Remove core's obsolete ResourceAttributes dependency, which fails under Boot's newer semantic-convention dependencies.
  • Exercise installed JARs with Boot's actual native tracing configuration under Boot 3.2.1, 3.5.16 and 4.1.2.

Recall-review repair

The Boot 4 transport repair is now included in this PR, not just a local worktree:

  • README Maven/Gradle OpenAI setups align the full HTTP transport family with okhttp-bom:5.3.2. Without this, Boot 4.1.2 selects OkHttp 5 alongside the older OpenAI SDK's Okio 3.6 and real requests fail with NoSuchMethodError: okio.Socket okio.Okio.socket(java.net.Socket).
  • OpenAITransportTest performs real OpenAI SDK requests and decodes plain/gzip OTLP protobuf over loopback. It checks authentication headers, project resource, token counts, input/output hiding, native parentage, shutdown flush and exactly-once export.
  • CI installs the OpenAI integration alongside the starter and runs these contracts. The starter itself does not acquire an OpenAI/OkHttp dependency.
  • The compatibility consumer now selects the current locally built Java version (1.0.1), with release-please tracking so future releases cannot silently test an old installed artifact.
  • Merged dev at 7cb1d3e4 normally, preserving both the core/starter and native Anthropic CI jobs. No force push.

Fresh validation

Runtime tests ran offline under a macOS sandbox denying outbound traffic except loopback, with an isolated home/cache, cleared environment and synthetic credentials. No model-provider or Future AGI Cloud requests were made.

  • Failing-first reproduction on current-base rebuilt JARs without the transport alignment: all 3 Boot 4 transport cases error with the reported NoSuchMethodError.
  • Fixed installed-JAR compatibility matrix: 20/20 passed on each of Boot 3.2.1, 3.5.16 and 4.1.2. Maven Central metadata still identifies 4.1.2 as the latest stable Boot release; 4.2 entries are prereleases.
  • Extracted README and held-docs Maven consumers: 18/18 passed across those versions. The documented Java snippets compile; the docs client bean is invoked by the transport tests.
  • Extracted README and held-docs Gradle consumers: 18/18 passed across those versions.
  • Core 47/47 and starter 14/14 passed at OTel 1.35.0 and 1.67.0.
  • Full current-base Java reactor clean verify: 345 discovered, 240 passed, 105 credential-gated skips, zero failures/errors.
  • Unsigned release-profile packaging and Central artifact validation: 27/27 effective POMs and release JAR sets passed. No signing or deployment.
  • Release-plan validation: 129 packages consistent. git diff --check passed.

The consumer checks use locally rebuilt 1.0.1 JARs, not the existing Central artifacts. Remote CI for this updated head is separate from the old head's green checks.

Merge dependencies

Documentation / release follow-up

No docs PR yet. Maven Central now has traceai-spring-boot-starter:1.0.1, but its published POM still contains the old Spring AI dependency; these starter changes are not released. The held page must replace RELEASED_VERSION and validate the newly published artifacts before a docs PR. No registry publication, tag, merge or workflow dispatch is part of this change.

E2E: no product e2e/ harness applies. Spring contexts, installed-JAR consumers, real SDK transport and decoded loopback OTLP cover this integration.

🤖 Generated with Claude Code

nik13 and others added 3 commits October 31, 2026 10:23
Keep standalone tracing local, support caller-owned OpenTelemetry, and make shutdown/reinitialization safe without resetting globals. Cover lifecycle and decoded OTLP behavior at the OpenTelemetry floor and current versions.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Write the service.name resource key directly instead of importing ResourceAttributes from opentelemetry-semconv 1.23.1-alpha. Spring Boot applications with Micrometer's OpenTelemetry bridge resolve semconv 1.32.0, where that class no longer exists, so TraceAI.init failed with NoClassDefFoundError on Boot 3.5 and 4.1.

Co-Authored-By: Claude Code <noreply@anthropic.com>
…AI or global registration

The starter only configures FITracer, so it no longer depends on the retired traceai-spring-ai wrapper or the Spring AI 1.0.0-M4 milestone.

When traceai.base-url and traceai.api-key (or FI_BASE_URL/FI_API_KEY) are set, or the console exporter is enabled, the starter keeps owning a TraceAI provider as before, without registering it globally. Otherwise it reuses the application's OpenTelemetry or TracerProvider bean, such as Spring Boot's native tracing, adding no provider, exporter or processor, and warns about ignored export settings. Closing the context flushes only a starter-owned provider; existing TraceAI singletons and custom FITracer beans stay application-owned.

Add context, lifecycle and localhost OTLP tests, plus a CI matrix that runs the installed starter with the Spring Boot 3.2.1, 3.5.16 and 4.1.2 BOMs and their native tracing.

Co-Authored-By: Claude Code <noreply@anthropic.com>
nik13 and others added 2 commits November 2, 2026 02:14
Co-Authored-By: Claude Code <noreply@anthropic.com>
Exercise actual OpenAI calls and plain/gzip OTLP export under Boot 3.2.1, 3.5.16 and 4.1.2. Import the OkHttp BOM in documented OpenAI consumers and keep installed-JAR compatibility tests on the current release version.

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant