Skip to content

Handle OpenTelemetry initialization failures gracefully#2516

Merged
ruhan1 merged 1 commit intoCommonjava:masterfrom
ruhan1:fix-otel-initialization-failure
Feb 12, 2026
Merged

Handle OpenTelemetry initialization failures gracefully#2516
ruhan1 merged 1 commit intoCommonjava:masterfrom
ruhan1:fix-otel-initialization-failure

Conversation

@ruhan1
Copy link
Contributor

@ruhan1 ruhan1 commented Feb 12, 2026

This is for MMENG-4526 Indy start failed due to trace collector is not working

Summary

Fixes an issue where Indy fails to start when the OpenTelemetry collector is unavailable or there are library version mismatches (e.g., IllegalAccessError during OtelTracePlugin initialization).

Changes

  • Added setEnabled() method to IndyTraceConfiguration to allow runtime disabling of trace functionality
  • Wrapped OtelTracePlugin initialization in try-catch block in TraceManagerProducer
  • On initialization failure, the config is set to enabled = false and the plugin is recreated in disabled mode
  • OtelTracePlugin handles the disabled state internally
  • Added clear warning log message when tracing is disabled due to errors

🤖 Generated with Claude Code

When the OpenTelemetry collector is unavailable or there are library
version mismatches, Indy will now continue to start with tracing
disabled instead of failing during CDI initialization.

Changes:
- Add setEnabled() method to IndyTraceConfiguration to allow runtime
  disabling of trace functionality
- Wrap OtelTracePlugin initialization in try-catch block
- On initialization failure, set config.enabled = false and recreate
  the plugin in disabled mode
- OtelTracePlugin handles disabled state internally, no custom no-op
  implementations needed
- Log clear warning message when tracing is disabled due to errors

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@ruhan1 ruhan1 requested a review from sswguo February 12, 2026 09:09
@sswguo
Copy link
Member

sswguo commented Feb 12, 2026

Looks great.

@ruhan1 ruhan1 merged commit 63c31bf into Commonjava:master Feb 12, 2026
1 check passed
@ruhan1 ruhan1 deleted the fix-otel-initialization-failure branch February 12, 2026 09:36
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.

2 participants