Skip to content

Commit

Permalink
Mark metrics listener @Extensions as dynamically loadable
Browse files Browse the repository at this point in the history
  • Loading branch information
cyrille-leclerc committed May 27, 2022
1 parent acf612d commit 6579101
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,19 @@
import hudson.model.Node;
import hudson.slaves.CloudProvisioningListener;
import hudson.slaves.NodeProvisioner;
import io.jenkins.plugins.opentelemetry.OpenTelemetrySdkProvider;
import io.jenkins.plugins.opentelemetry.OtelComponent;
import io.jenkins.plugins.opentelemetry.semconv.JenkinsSemanticMetrics;
import io.opentelemetry.api.metrics.LongCounter;
import io.opentelemetry.api.metrics.Meter;
import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.logs.LogEmitter;
import jenkins.YesNoMaybe;

import javax.annotation.Nonnull;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import java.util.logging.Level;
import java.util.logging.Logger;

@Extension
@Extension(dynamicLoadable = YesNoMaybe.YES, optional = true)
public class MonitoringCloudListener extends CloudProvisioningListener implements OtelComponent {
private final static Logger LOGGER = Logger.getLogger(MonitoringCloudListener.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.logs.LogEmitter;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import jenkins.YesNoMaybe;
import jenkins.model.Jenkins;
import jenkins.security.MasterToSlaveCallable;

Expand All @@ -33,7 +34,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

@Extension
@Extension(dynamicLoadable = YesNoMaybe.YES, optional = true)
public class MonitoringComputerListener extends ComputerListener implements OtelComponent {
private final static Logger LOGGER = Logger.getLogger(MonitoringComputerListener.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.opentelemetry.context.Scope;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.logs.LogEmitter;
import jenkins.YesNoMaybe;
import jenkins.model.Jenkins;

import javax.annotation.CheckForNull;
Expand All @@ -38,7 +39,7 @@
import static com.google.common.base.Verify.verifyNotNull;
import static io.jenkins.plugins.opentelemetry.OtelUtils.JENKINS_CORE;

@Extension
@Extension(dynamicLoadable = YesNoMaybe.YES)
public class MonitoringBuildStepListener extends BuildStepListener implements OtelComponent {

protected static final Logger LOGGER = Logger.getLogger(MonitoringRunListener.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.logs.LogEmitter;
import io.opentelemetry.semconv.resource.attributes.ResourceAttributes;
import jenkins.YesNoMaybe;
import jenkins.model.CauseOfInterruption;
import org.apache.commons.compress.utils.Sets;
import org.jenkinsci.plugins.structs.SymbolLookup;
Expand Down Expand Up @@ -73,7 +74,7 @@
import static com.google.common.base.Verify.verifyNotNull;


@Extension
@Extension(dynamicLoadable = YesNoMaybe.YES, optional = true)
public class MonitoringPipelineListener extends AbstractPipelineListener implements PipelineListener, StepListener, OtelComponent {
private final static Logger LOGGER = Logger.getLogger(MonitoringPipelineListener.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
import io.opentelemetry.sdk.logs.LogEmitter;
import io.opentelemetry.sdk.trace.ReadWriteSpan;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import jenkins.YesNoMaybe;
import jenkins.model.Jenkins;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.jenkinsci.plugins.workflow.support.steps.build.BuildUpstreamCause;
Expand All @@ -66,7 +67,7 @@

import static com.google.common.base.Verify.verifyNotNull;

@Extension
@Extension(dynamicLoadable = YesNoMaybe.YES, optional = true)
public class MonitoringRunListener extends OtelContextAwareAbstractRunListener {

protected static final Logger LOGGER = Logger.getLogger(MonitoringRunListener.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;
import io.opentelemetry.sdk.logs.LogEmitter;
import jenkins.YesNoMaybe;
import jenkins.model.Jenkins;

import javax.annotation.Nonnull;
Expand All @@ -29,7 +30,7 @@
/**
* Monitor the Jenkins Build queue
*/
@Extension
@Extension(dynamicLoadable = YesNoMaybe.YES, optional = true)
public class MonitoringQueueListener extends QueueListener implements OtelComponent {

private final static Logger LOGGER = Logger.getLogger(MonitoringQueueListener.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.opentelemetry.sdk.logs.LogEmitter;
import io.opentelemetry.sdk.logs.data.Severity;
import io.opentelemetry.semconv.trace.attributes.SemanticAttributes;
import jenkins.YesNoMaybe;
import jenkins.security.SecurityListener;
import org.acegisecurity.userdetails.UserDetails;
import org.springframework.security.core.Authentication;
Expand All @@ -38,7 +39,7 @@
* {@link AuditingSecurityListener} events ({@link #loggedIn(String)}, {@link #failedToLogIn(String)}...) are invoked
* within a trace.
*/
@Extension
@Extension(dynamicLoadable = YesNoMaybe.YES, optional = true)
public class AuditingSecurityListener extends SecurityListener implements OtelComponent {

private final static Logger LOGGER = Logger.getLogger(AuditingSecurityListener.class.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
import hudson.Extension;
import hudson.init.InitMilestone;
import hudson.init.Initializer;
import jenkins.YesNoMaybe;

import java.util.logging.Level;
import java.util.logging.Logger;

@Extension
@Extension(dynamicLoadable = YesNoMaybe.YES, optional = true)
public class LifecycleDebugger {
private final static Logger logger = Logger.getLogger(LifecycleDebugger.class.getName());
@Initializer(after = InitMilestone.SYSTEM_CONFIG_LOADED, before = InitMilestone.SYSTEM_CONFIG_ADAPTED)
Expand Down

0 comments on commit 6579101

Please sign in to comment.