Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,23 @@ public class TraceManagerProducer
@PostConstruct
public void init()
{
logger.info( "Initializing Opentelemetry trace plugin" );
O11yphantTracePlugin plugin = new OtelTracePlugin( config, config );
logger.info( "Initializing OpenTelemetry trace plugin" );
O11yphantTracePlugin plugin;

try
{
plugin = new OtelTracePlugin( config, config );
}
catch ( Exception | Error e )
{
logger.warn( "Failed to initialize OpenTelemetry trace plugin. " +
"This is likely due to OpenTelemetry collector being unavailable or a library version mismatch. " +
"Tracing will be disabled. Error: {}", e.getMessage(), e );

// Disable tracing and recreate plugin in disabled mode
config.setEnabled( false );
plugin = new OtelTracePlugin( config, config );
}

traceManager = new TraceManager( plugin, new SpanFieldsDecorator( getRootSpanFields() ), config );
traceThreadContextualizer = traceManager.getTraceThreadContextualizer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public boolean isEnabled()
return enabled;
}

public void setEnabled( boolean enabled )
{
this.enabled = enabled;
}

@Override
public boolean isConsoleTransport()
{
Expand Down