Class OtelJulHandler
java.lang.Object
java.util.logging.Handler
io.jenkins.plugins.opentelemetry.init.OtelJulHandler
- All Implemented Interfaces:
ExtensionPoint
,io.jenkins.plugins.opentelemetry.api.OpenTelemetryLifecycleListener
,Comparable<io.jenkins.plugins.opentelemetry.api.OpenTelemetryLifecycleListener>
@Extension(dynamicLoadable=YES,
optional=true,
ordinal=2.147483637E9)
public class OtelJulHandler
extends Handler
implements io.jenkins.plugins.opentelemetry.api.OpenTelemetryLifecycleListener
Inspired by https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/v1.14.0/instrumentation/java-util-logging/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jul/JavaUtilLoggingHelper.java
-
Nested Class Summary
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected io.jenkins.plugins.opentelemetry.api.ReconfigurableOpenTelemetry
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.jenkins.plugins.opentelemetry.api.OpenTelemetryLifecycleListener
afterConfiguration, compareTo
-
Field Details
-
openTelemetry
@Inject protected io.jenkins.plugins.opentelemetry.api.ReconfigurableOpenTelemetry openTelemetry
-
-
Constructor Details
-
OtelJulHandler
public OtelJulHandler()
-
-
Method Details
-
publish
Map theLogRecord
data model onto theLogRecordBuilder
. Unmapped fields include:- Fully qualified class name -
LogRecord.getSourceClassName()
- Fully qualified method name -
LogRecord.getSourceMethodName()
- Fully qualified class name -
-
flush
public void flush() -
close
- Specified by:
close
in classHandler
- Throws:
SecurityException
-
postConstruct
@PostConstruct public void postConstruct() -
preDestroy
Unregister the java.util.logging handler. As@PreDestroy
doesn't seem to be honored by Jenkins, we use@Terminator
in addition. -
ordinal
public int ordinal()Hooking Otel logs is the first thing to initialize- Specified by:
ordinal
in interfaceio.jenkins.plugins.opentelemetry.api.OpenTelemetryLifecycleListener
-