Skip to content

[KIEKER-1978] Document / Fix Spring Monitoring #1868

@rju

Description

@rju

JIRA Issue: KIEKER-1978 Document / Fix Spring Monitoring
Original Reporter: David Georg Reichelt


Currently, I’m trying to get Micro-company (https://github.com/idugalic/micro-company ) running with Kieker. This is a microservice example application that has been used in some case studies.

Unfortunately, monitoring does not work and Kiekers slf4j-versions block logging, so I also do not get any error messages. After building my fork (https://github.com/DaGeRe/micro-company ) on the master branch (mvn clean install -DskipTests), the application can be started regularly in monolithic/target/docker using java -cp monolithic-0.0.1-SNAPSHOT.jar org.springframework.boot.loader.JarLauncher.

Adding the javaagent with default configurations ends with no logs:

java -javaagent:kieker-1.15.4-aspectj.jar -cp monolithic-0.0.1-SNAPSHOT.jar org.springframework.boot.loader.JarLauncher

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

and with a lot of logging data, that are only spring of logback data:

reicheltreichelt-desktop:~/nvme/workspaces/kiekerworkspace/micro-company/monolithic/target/docker$ cat /tmp/kieker-20240315-144756-21219659539625-UTC--KIEKER-SINGLETON/kieker*dat | wc -l
7928688

These records are mostly spring-internal things, e.g., org.springframework.boot.loader.jar.JarFileEntries.swap

After these ~7 million records, nothing happens (no more kieker entries, no response from the application via http, no logs). The application is not started in this configuration, so for some reason, adding the javaagent to a spring application in this context stops the spring application from being executed.

To overcome this, I tried to only instrument the idugalic package thing, with the following kieker.aop.xml:

<!DOCTYPE aspectj PUBLIC "-//AspectJ//DTD//EN" "http://www.aspectj.org/dtd/aspectj_1_5_0.dtd">
<aspectj>
{{ <weaver options="-verbose">}}
{{ <include within="com.idugalic..*" />}}
{{ </weaver>}}
{{ <aspects>}}
{{ <aspect}}
{{ name="kieker.monitoring.probe.aspectj.operationExecution.OperationExecutionAspectFull" />}}
{{ </aspects>}}
</aspectj>

Using this, the application is functional from the outside, but still does not get logs (not even /tmp/kieker-XYZ is created - logfile is attached).

For debugging the AspectJ behavior, I think its necessary to get the logging right. Unfortunately, spring (or the 1.5.3 version, which is used here) does not work together with Kieker, even when just adding Kieker to the classpath (java -cp monolithic-0.0.1-SNAPSHOT.jar:kieker-1.15.4-aspectj.jar org.springframework.boot.loader.JarLauncher), the logging stops to work. Also adding the slf4j and logback libraries in the version that are normally used (java -cp monolithic-0.0.1-SNAPSHOT.jar:BOOT-INF/lib/slf4j-api-1.7.25.jar:BOOT-INF/lib/logback-core-1.1.11.jar:BOOT-INF/lib/logback-classic-1.1.11.jar org.springframework.boot.loader.JarLauncher) does not fix this problem.

According to new relic, adding a javaagent directly to spring should just work (https://docs.newrelic.com/docs/apm/agents/java-agent/additional-installation/include-java-agent-jvm-argument/ ), the documentation about spring instrumentation with Kieker is unfortunately empty (https://kieker-monitoring.readthedocs.io/en/latest/instrumenting-software/java/Instrumentation-of-Spring.html ).

Is there any way to get Kieker runnable with an older slf4j / spring version, and if yes, how?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions