Skip to content

Commit 92c537e

Browse files
authored
Sync checkstyle configuration with OpenTelemetry Java Instrumentation (#4365)
1 parent 7aec747 commit 92c537e

File tree

21 files changed

+162
-156
lines changed

21 files changed

+162
-156
lines changed

agent/agent-gc-monitor/gc-monitor-core/src/main/java/com/microsoft/gcmonitor/collectors/GcCollectionSample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
/** Implementation of a single GCCollectionEvent formed from data from an MxBean. */
2323
class GcCollectionSample implements GcCollectionEvent {
24-
private static final Logger LOGGER = LoggerFactory.getLogger(GcCollectionSample.class);
24+
private static final Logger logger = LoggerFactory.getLogger(GcCollectionSample.class);
2525

2626
private static final String ID = "id";
2727

@@ -77,7 +77,7 @@ private static Map<MemoryPool, MemoryUsage> groupMemoryUsageByPoolName(
7777
}
7878
}
7979
} catch (RuntimeException e) {
80-
LOGGER.error("Failed to group pool data", e);
80+
logger.error("Failed to group pool data", e);
8181
}
8282
return Collections.unmodifiableMap(byIdentifier);
8383
}

agent/agent-gc-monitor/gc-monitor-core/src/main/java/com/microsoft/gcmonitor/notifications/NotificationObserver.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* thread.
1919
*/
2020
public class NotificationObserver implements NotificationListener {
21-
private static final Logger LOGGER = LoggerFactory.getLogger(NotificationObserver.class);
21+
private static final Logger logger = LoggerFactory.getLogger(NotificationObserver.class);
2222
private static final int MAX_QUEUE_SIZE = 1000;
2323
private final LinkedBlockingQueue<NotificationJob> workQueue =
2424
new LinkedBlockingQueue<>(MAX_QUEUE_SIZE);
@@ -46,7 +46,7 @@ public void handleNotification(@Nullable Notification notification, Object handb
4646
workQueue.offer(new NotificationJob((JmxGarbageCollectorStats) handback, notification));
4747
}
4848
} catch (RuntimeException e) {
49-
LOGGER.error("Failed to process gc notification", e);
49+
logger.error("Failed to process gc notification", e);
5050
}
5151
}
5252

@@ -63,7 +63,7 @@ public void watchGcNotificationEvents() {
6363
sample.collector.update(sample.notification);
6464
}
6565
} catch (RuntimeException e) {
66-
LOGGER.error("Error while reading GC notification data", e);
66+
logger.error("Error while reading GC notification data", e);
6767
}
6868
}
6969
} catch (InterruptedException e) {

agent/agent-profiler/agent-alerting/src/main/java/com/microsoft/applicationinsights/alerting/AlertingSubsystem.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
public class AlertingSubsystem {
3434

35-
private static final Logger LOGGER = LoggerFactory.getLogger(AlertingSubsystem.class);
35+
private static final Logger logger = LoggerFactory.getLogger(AlertingSubsystem.class);
3636

3737
// Downstream observer of alerts produced by the alerting system
3838
private final Consumer<AlertBreach> alertHandler;
@@ -100,7 +100,7 @@ public void trackTelemetryDataPoint(@Nullable TelemetryDataPoint telemetryDataPo
100100
if (telemetryDataPoint == null) {
101101
return;
102102
}
103-
LOGGER.trace(
103+
logger.trace(
104104
"Tracking " + telemetryDataPoint.getType().name() + " " + telemetryDataPoint.getValue());
105105
alertPipelines.process(telemetryDataPoint);
106106
}

agent/agent-profiler/agent-alerting/src/main/java/com/microsoft/applicationinsights/alerting/analysis/pipelines/AlertPipelines.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/** Contains analysis pipelines for all metric types. */
2525
public class AlertPipelines {
26-
private static final Logger LOGGER = LoggerFactory.getLogger(AlertPipelines.class);
26+
private static final Logger logger = LoggerFactory.getLogger(AlertPipelines.class);
2727

2828
// List of alert analysis pipelines for each metric type, entrypoint
2929
// for the pipeline is a rolling average
@@ -59,7 +59,7 @@ public void updateAlertConfig(AlertConfiguration newAlertConfig, TimeSource time
5959
pipeline.updateConfig(newAlertConfig);
6060
}
6161

62-
LOGGER.debug(
62+
logger.debug(
6363
"Set alert configuration for {}: {}", newAlertConfig.getType(), newAlertConfig.toString());
6464
}
6565

@@ -86,7 +86,7 @@ public void updateRequestAlertConfig(
8686

8787
alertPipelines.put(AlertMetricType.REQUEST, new AlertPipelineMultiplexer(requestPipelines));
8888

89-
LOGGER.debug(
89+
logger.debug(
9090
"Set alert configuration for {}: {} pipelines updated",
9191
AlertMetricType.REQUEST,
9292
newAlertConfig.size());

agent/agent-profiler/agent-alerting/src/main/java/com/microsoft/applicationinsights/alerting/analysis/pipelines/SingleAlertPipeline.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
/** Contains a pipeline that receives telemetry, feeds it into the analysis pipeline. */
2222
public class SingleAlertPipeline implements AlertPipeline, AlertPipelineMXBean {
2323

24-
private static final Logger LOGGER = LoggerFactory.getLogger(SingleAlertPipeline.class);
24+
private static final Logger logger = LoggerFactory.getLogger(SingleAlertPipeline.class);
2525
private static final String JMX_KEY = "com.microsoft:type=AI-alert,name=";
2626

2727
private final Aggregation aggregation;
@@ -71,7 +71,7 @@ private void registerMbean() {
7171
ManagementFactory.getPlatformMBeanServer().registerMBean(this, objectName);
7272

7373
} catch (Exception e) {
74-
LOGGER.error("Failed to register MBEAN", e);
74+
logger.error("Failed to register MBEAN", e);
7575
}
7676
}
7777

agent/agent-profiler/agent-diagnostics/src/main/java/com/microsoft/applicationinsights/diagnostics/appinsights/CodeOptimizerDiagnosticEngineJfr.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* coordinate emitting diagnostics on a breach.
2828
*/
2929
public class CodeOptimizerDiagnosticEngineJfr implements DiagnosticEngine {
30-
private static final Logger LOGGER =
30+
private static final Logger logger =
3131
LoggerFactory.getLogger(CodeOptimizerDiagnosticEngineJfr.class);
3232
public static final int SEMAPHORE_TIMEOUT_IN_SEC = 10;
3333
public static final long TIME_BEFORE_END_OF_PROFILE_TO_EMIT_EVENT = 10L;
@@ -42,25 +42,25 @@ public CodeOptimizerDiagnosticEngineJfr(ScheduledExecutorService executorService
4242
@Override
4343
public void init(int thisPid) {
4444
if (!CodeOptimizerDiagnosticsJfrInit.isOsSupported()) {
45-
LOGGER.warn("Code Optimizer diagnostics is not supported on this operating system");
45+
logger.warn("Code Optimizer diagnostics is not supported on this operating system");
4646
return;
4747
}
4848

4949
this.thisPid = thisPid;
5050

51-
LOGGER.debug("Initialising Code Optimizer Diagnostic Engine");
51+
logger.debug("Initialising Code Optimizer Diagnostic Engine");
5252
CodeOptimizerDiagnosticsJfrInit.initFeature(thisPid);
53-
LOGGER.debug("Code Optimizer Diagnostic Engine Initialised");
53+
logger.debug("Code Optimizer Diagnostic Engine Initialised");
5454
}
5555

5656
private static void startDiagnosticCycle(int thisPid) {
57-
LOGGER.debug("Starting Code Optimizer Diagnostic Cycle");
57+
logger.debug("Starting Code Optimizer Diagnostic Cycle");
5858
CodeOptimizerDiagnosticsJfrInit.initFeature(thisPid);
5959
CodeOptimizerDiagnosticsJfrInit.start(thisPid);
6060
}
6161

6262
private static void endDiagnosticCycle() {
63-
LOGGER.debug("Ending Code Optimizer Diagnostic Cycle");
63+
logger.debug("Ending Code Optimizer Diagnostic Cycle");
6464
CodeOptimizerDiagnosticsJfrInit.stop();
6565
}
6666

@@ -106,10 +106,10 @@ private void scheduleShutdown(
106106
// We do not return a result atm
107107
diagnosisResultCompletableFuture.complete(null);
108108

109-
LOGGER.debug("Shutting down diagnostic cycle");
109+
logger.debug("Shutting down diagnostic cycle");
110110
endDiagnosticCycle();
111111
} catch (RuntimeException e) {
112-
LOGGER.error("Failed to shutdown cleanly", e);
112+
logger.error("Failed to shutdown cleanly", e);
113113
} finally {
114114
semaphore.release();
115115
}
@@ -125,15 +125,15 @@ private void scheduleEmittingAlertBreachEvent(AlertBreach alert, long end) {
125125
try {
126126
emitInfo(alert);
127127
} catch (RuntimeException e) {
128-
LOGGER.error("Failed to emit breach", e);
128+
logger.error("Failed to emit breach", e);
129129
}
130130
},
131131
end / 2,
132132
TimeUnit.SECONDS);
133133
}
134134

135135
private static void emitInfo(AlertBreach alert) {
136-
LOGGER.debug("Emitting Code Optimizer Diagnostic Event");
136+
logger.debug("Emitting Code Optimizer Diagnostic Event");
137137
emitAlertBreachJfrEvent(alert);
138138
CodeOptimizerDiagnosticsJfrInit.emitCGroupData();
139139
emitMachineStats();
@@ -150,9 +150,9 @@ private static void emitAlertBreachJfrEvent(AlertBreach alert) {
150150
alert.toJson(writer).flush();
151151
AlertBreachJfrEvent event = new AlertBreachJfrEvent().setAlertBreach(stringWriter.toString());
152152
event.commit();
153-
LOGGER.debug("Emitted Code Optimizer Diagnostic Event");
153+
logger.debug("Emitted Code Optimizer Diagnostic Event");
154154
} catch (IOException e) {
155-
LOGGER.error("Failed to create breach JFR event", e);
155+
logger.error("Failed to create breach JFR event", e);
156156
}
157157
}
158158
}

agent/agent-profiler/agent-diagnostics/src/main/java/com/microsoft/applicationinsights/diagnostics/collection/calibration/CalibratorDefault.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
public class CalibratorDefault implements Calibrator {
1717

18-
private static final Logger LOGGER = LoggerFactory.getLogger(ContextSwitchingRunner.class);
18+
private static final Logger logger = LoggerFactory.getLogger(ContextSwitchingRunner.class);
1919

2020
private final ContextSwitchingRunner contextSwitching;
2121
private final KernelMonitorDeviceDriver kernel;
@@ -69,7 +69,7 @@ public Calibration calibrate() {
6969
double contextSwitchingRate = safeDiv(maxContextSwitches, timeDiagnosticsHadAvailable);
7070
return new Calibration(contextSwitchingRate);
7171
} catch (Throwable e) {
72-
LOGGER.debug("Completing exceptionally", e);
72+
logger.debug("Completing exceptionally", e);
7373
}
7474
return new Calibration(Calibration.UNKNOWN);
7575
}

agent/agent-profiler/agent-diagnostics/src/main/java/com/microsoft/applicationinsights/diagnostics/collection/libos/os/OperatingSystemDetector.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
/** Util to identify the host operating system */
1212
public class OperatingSystemDetector {
1313

14-
private static final Logger LOGGER = LoggerFactory.getLogger(OperatingSystemDetector.class);
14+
private static final Logger logger = LoggerFactory.getLogger(OperatingSystemDetector.class);
1515

1616
private static final String OS_NAME_PROPERTY = "os.name";
1717
private static final String MAC = "mac";
@@ -25,7 +25,7 @@ public class OperatingSystemDetector {
2525
OperatingSystem detectedOs = OperatingSystem.UNKNOWN;
2626
try {
2727
String operatingSystemString = System.getProperty(OS_NAME_PROPERTY).toLowerCase(Locale.ROOT);
28-
LOGGER.debug("Detected OS " + operatingSystemString);
28+
logger.debug("Detected OS " + operatingSystemString);
2929
if (operatingSystemString.contains(MAC)) {
3030
detectedOs = OperatingSystem.MAC_OS;
3131
} else if (operatingSystemString.contains(LINUX)) {
@@ -38,7 +38,7 @@ public class OperatingSystemDetector {
3838
detectedOs = OperatingSystem.UNKNOWN;
3939
}
4040
} catch (RuntimeException e) {
41-
LOGGER.warn("Failed to detect operating system", e);
41+
logger.warn("Failed to detect operating system", e);
4242
}
4343
operatingSystem = detectedOs;
4444
}

agent/agent-profiler/agent-diagnostics/src/main/java/com/microsoft/applicationinsights/diagnostics/collection/libos/os/linux/LinuxProcessCpuStats.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class LinuxProcessCpuStats extends TwoStepProcReader implements ProcessCp
2020
private static final int VM_SIZE_OFFSET_FROM_NAME = 21;
2121
private static final int RSS_OFFSET_FROM_NAME = 22;
2222
private static final int N_SWAPPED_OFFSET_FROM_NAME = 34;
23-
private static final Logger LOGGER = LoggerFactory.getLogger(LinuxProcessCpuStats.class);
23+
private static final Logger logger = LoggerFactory.getLogger(LinuxProcessCpuStats.class);
2424

2525
private final BigIncrementalCounter userTime;
2626
private final BigIncrementalCounter systemTime;
@@ -72,7 +72,7 @@ private static void setValue(BigIncrementalCounter userTime, String userTime1) {
7272
try {
7373
userTime.newValue(new BigInteger(userTime1));
7474
} catch (NumberFormatException e) {
75-
LOGGER.trace("Failed to parse {}", userTime1);
75+
logger.trace("Failed to parse {}", userTime1);
7676
}
7777
}
7878

agent/agent-profiler/agent-diagnostics/src/main/java/com/microsoft/applicationinsights/diagnostics/collection/libos/os/linux/LinuxProcessDumper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
/** Detects running processes on the host. */
2121
public class LinuxProcessDumper implements ProcessDumper, Closeable {
22-
private static final Logger LOGGER = LoggerFactory.getLogger(LinuxProcessDumper.class);
22+
private static final Logger logger = LoggerFactory.getLogger(LinuxProcessDumper.class);
2323

2424
private final boolean isDaemon;
2525
private Map<Integer, LinuxProcess> usage = new HashMap<>();
@@ -76,7 +76,7 @@ public void closeProcesses(List<Integer> exclusions) {
7676
try {
7777
removed.close();
7878
} catch (IOException e) {
79-
LOGGER.error("Failed to close process", e);
79+
logger.error("Failed to close process", e);
8080
}
8181
});
8282
}

0 commit comments

Comments
 (0)