Skip to content
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

build(deps): bump com.redhat.insights:runtimes-agent from 0.9.0 to 0.9.1 #281

Merged
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
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
<org.slf4j.version>2.0.7</org.slf4j.version>
<org.projectnessie.cel.bom.version>0.4.3</org.projectnessie.cel.bom.version>
<com.google.protobuf-java.version>3.22.3</com.google.protobuf-java.version>
<com.redhat.insights.agent.version>0.9.0</com.redhat.insights.agent.version>
<com.redhat.insights.agent.version>0.9.1</com.redhat.insights.agent.version>

<com.github.spotbugs.version>4.8.2</com.github.spotbugs.version>
<com.github.spotbugs.plugin.version>4.8.1.0</com.github.spotbugs.plugin.version>
Expand Down
56 changes: 5 additions & 51 deletions src/main/java/io/cryostat/agent/insights/InsightsAgentHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import com.redhat.insights.agent.AgentConfiguration;
import com.redhat.insights.agent.ClassNoticer;
import com.redhat.insights.agent.InsightsAgentHttpClient;
import com.redhat.insights.agent.SLF4JLogger;
import com.redhat.insights.agent.shaded.InsightsReportController;
import com.redhat.insights.agent.shaded.http.InsightsHttpClient;
import com.redhat.insights.agent.shaded.jars.JarInfo;
Expand All @@ -39,17 +40,14 @@
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class InsightsAgentHelper {

private static final String INSIGHTS_SVC = "INSIGHTS_SVC";
static final String RHT_INSIGHTS_JAVA_OPT_OUT = "rht.insights.java.opt-out";

private static final InsightsLogger log =
new SLF4JWrapper(LoggerFactory.getLogger(InsightsAgentHelper.class));
private static final BlockingQueue<JarInfo> jarsToSend = new LinkedBlockingQueue<>();
private static final InsightsLogger log = new SLF4JLogger(InsightsAgentHelper.class);

@SuppressFBWarnings("EI_EXPOSE_REP2")
private final Instrumentation instrumentation;
Expand Down Expand Up @@ -89,63 +87,19 @@ public void runInsightsAgent(PluginInfo pluginInfo) {
out.put("token", "dummy");
AgentConfiguration config = new AgentConfiguration(out);

final InsightsReport simpleReport = AgentBasicReport.of(log, config);
final InsightsReport simpleReport = AgentBasicReport.of(config);
final PEMSupport pem = new PEMSupport(log, config);

final Supplier<InsightsHttpClient> httpClientSupplier =
() -> new InsightsAgentHttpClient(log, config, () -> pem.createTLSContext());
() -> new InsightsAgentHttpClient(config, () -> pem.createTLSContext());
final InsightsReportController controller =
InsightsReportController.of(
log, config, simpleReport, httpClientSupplier, jarsToSend);
controller.generate();
}

private static void instrument(Instrumentation instrumentation) {
ClassNoticer noticer = new ClassNoticer(log, jarsToSend);
ClassNoticer noticer = new ClassNoticer(jarsToSend);
instrumentation.addTransformer(noticer);
}

static class SLF4JWrapper implements InsightsLogger {

private final Logger delegate;

SLF4JWrapper(Logger delegate) {
this.delegate = delegate;
}

@Override
public void debug(String message) {
delegate.debug(message);
}

@Override
public void debug(String message, Throwable err) {
delegate.debug(message, err);
}

@Override
public void error(String message) {
delegate.error(message);
}

@Override
public void error(String message, Throwable err) {
delegate.error(message, err);
}

@Override
public void info(String message) {
delegate.info(message);
}

@Override
public void warning(String message) {
delegate.warn(message);
}

@Override
public void warning(String message, Throwable err) {
delegate.warn(message, err);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
import java.util.function.Supplier;

import io.cryostat.agent.ConfigModule;
import io.cryostat.agent.insights.InsightsAgentHelper.SLF4JWrapper;
import io.cryostat.agent.model.PluginInfo;

import com.redhat.insights.agent.AgentBasicReport;
import com.redhat.insights.agent.AgentConfiguration;
import com.redhat.insights.agent.ClassNoticer;
import com.redhat.insights.agent.InsightsAgentHttpClient;
import com.redhat.insights.agent.SLF4JLogger;
import com.redhat.insights.agent.shaded.InsightsReportController;
import com.redhat.insights.agent.shaded.http.InsightsHttpClient;
import org.eclipse.microprofile.config.Config;
Expand Down Expand Up @@ -72,7 +72,7 @@ void setupEach() {
providerStatic.when(() -> ConfigProvider.getConfig()).thenReturn(config);

reportStatic = Mockito.mockStatic(AgentBasicReport.class);
reportStatic.when(() -> AgentBasicReport.of(any(), any())).thenReturn(report);
reportStatic.when(() -> AgentBasicReport.of(any())).thenReturn(report);

controllerStatic = Mockito.mockStatic(InsightsReportController.class);
controllerStatic
Expand Down Expand Up @@ -127,8 +127,7 @@ void testRunInsightsAgent() {

verify(instrumentation).addTransformer(any(ClassNoticer.class));

reportStatic.verify(
() -> AgentBasicReport.of(any(SLF4JWrapper.class), configCaptor.capture()));
reportStatic.verify(() -> AgentBasicReport.of(configCaptor.capture()));

AgentConfiguration agentConfig = configCaptor.getValue();
Assertions.assertEquals("test", agentConfig.getIdentificationName());
Expand All @@ -141,7 +140,7 @@ void testRunInsightsAgent() {
controllerStatic.verify(
() ->
InsightsReportController.of(
any(SLF4JWrapper.class),
any(SLF4JLogger.class),
eq(agentConfig),
eq(report),
clientSupplierCaptor.capture(),
Expand Down
Loading