Skip to content

Commit

Permalink
build(deps): bump com.redhat.insights:runtimes-agent from 0.9.0 to 0.…
Browse files Browse the repository at this point in the history
…9.1 (backport #281) (#298)

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

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

Bumps [com.redhat.insights:runtimes-agent](https://github.com/RedHatInsights/insights-java-agent) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/RedHatInsights/insights-java-agent/releases)
- [Commits](RedHatInsights/insights-java-agent@0.9.0...0.9.1)

---
updated-dependencies:
- dependency-name: com.redhat.insights:runtimes-agent
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix conflicts

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Elliott Baron <ebaron@redhat.com>
(cherry picked from commit e6d0884)

# Conflicts:
#	pom.xml

* Fix conflicts in pom.xml

Signed-off-by: Elliott Baron <ebaron@redhat.com>

---------

Signed-off-by: Elliott Baron <ebaron@redhat.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Elliott Baron <ebaron@redhat.com>
  • Loading branch information
3 people authored Dec 8, 2023
1 parent 2c09820 commit f6f1094
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 57 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<io.smallrye.config.version>2.12.3</io.smallrye.config.version>
<org.slf4j.version>2.0.7</org.slf4j.version>
<org.projectnessie.cel.bom.version>0.3.21</org.projectnessie.cel.bom.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.7.3</com.github.spotbugs.version>
<com.github.spotbugs.plugin.version>4.7.3.6</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

0 comments on commit f6f1094

Please sign in to comment.