-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor the OTelSdkProvider
into an implementation of OpenTelemetry
#704
Conversation
Signed-off-by: Cyrille Le Clerc <[email protected]>
Signed-off-by: Cyrille Le Clerc <[email protected]>
# Conflicts: # src/main/java/io/jenkins/plugins/opentelemetry/OpenTelemetrySdkProvider.java # src/main/java/io/jenkins/plugins/opentelemetry/job/log/OtelLogStorage.java # src/main/java/io/jenkins/plugins/opentelemetry/job/log/OtelLogStorageFactory.java
Signed-off-by: Cyrille Le Clerc <[email protected]>
Signed-off-by: Cyrille Le Clerc <[email protected]>
Signed-off-by: Cyrille Le Clerc <[email protected]>
Signed-off-by: Cyrille Le Clerc <[email protected]>
Signed-off-by: Cyrille Le Clerc <[email protected]>
Signed-off-by: Cyrille Le Clerc <[email protected]>
OTelSdkProvider
into an implementation of openTelemetry
# Conflicts: # src/main/java/io/jenkins/plugins/opentelemetry/JenkinsOpenTelemetryPluginConfiguration.java # src/main/java/io/jenkins/plugins/opentelemetry/OpenTelemetrySdkProvider.java
OTelSdkProvider
into an implementation of openTelemetry
OTelSdkProvider
into an implementation of OpenTelemetry
…LoggerProvider Signed-off-by: Cyrille Le Clerc <[email protected]>
Sorry @kuisathaverat I made some changes to better support OTel instrumentation in other plugins. Could you please review again the PR 👼 |
public class InstrumentationScope { | ||
@Nonnull | ||
final String instrumentationScopeName; | ||
@Nullable | ||
final String schemaUrl; | ||
@Nullable | ||
final String instrumentationScopeVersion; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth adding a JavaDoc description of the fields and the class
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.ConcurrentMap; | ||
|
||
public class ReconfigurableEventLoggerProvider implements EventLoggerProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth adding a JavaDoc description to the class
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.ConcurrentMap; | ||
|
||
public class ReconfigurableLoggerProvider implements LoggerProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth adding a JavaDoc description to the class
/** | ||
* Reconfigurable {@link OpenTelemetry} | ||
*/ | ||
public class ReconfigurableOpenTelemetry implements OpenTelemetry, Closeable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth adding a JavaDoc description to the class
import java.util.concurrent.ConcurrentHashMap; | ||
import java.util.concurrent.ConcurrentMap; | ||
|
||
public class ReconfigurableTracerProvider implements TracerProvider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is worth adding a JavaDoc description to the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments LGTM
Thanks, I'll javadoc in a subsequent PR |
* as early as possible in Jenkins lifecycle so any plugin invoking those Global setters will have the | ||
* reconfigurable instance . | ||
*/ | ||
@Initializer(after = InitMilestone.EXTENSIONS_AUGMENTED, before = InitMilestone.SYSTEM_CONFIG_LOADED) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before system config loaded? how will the configuration be available for this plugin? and how will someone configure this plugin with JCasC if its so early?
jcasc is after system config loaded:
https://github.com/jenkinsci/configuration-as-code-plugin/blob/3b0e6de4ab83e8024e6cac635728c28b68ac663a/plugin/src/main/java/io/jenkins/plugins/casc/ConfigurationAsCode.java#L337
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct: There reasons is:
- we want to be sure that any plugin that is using OTel will use our implementation of
OpenTelemetry
, even when getting this OpenTelemetry instance throughGlobalOpenTelemetry.get()
- we don't know how to ensure the OpenTelemetry plugin gets configured & initialized before all other plugins (e.g. the initialization code
DatabaseSchemaLoader#migrateSchema()
of the JUnit SQL Storage Plugin is invoked by Jenkins before the Jenkins OTel Plugin initialization codeJenkinsOpenTelemetryPluginConfiguration#initializeOpenTelemetry()
despite the dependency.
The solution we identified is to:
- Register a Reconfigurable OpenTelemetry instance in
GlobalOpenTelemetry
as early as possible in Jenkin's lifecycle with a NoOp implementation (seeinitializeOpenTelemetryAfterExtensionsAugmented()
). - When the Jenkins Otel Plugin config is ready, we reconfigure the OpenTelmetry instance (see
initializeOpenTelemetry()
)
I think we can cleanup a bit this code but it works and it was quite time consuming to get there :-)
Dos it make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I see bit confusing but it'll work I think
Refactor the
OTelSdkProvider
to make it an implementation ofOpenTelemetry
that is intended to live on a Jenkins Controller.Testing done
Submitter checklist