Introducing the Frequency Logging feature, which enables frequency based stack call logging in Java programs at pre-defined intervals. This flexibility is achieved by setting the logging frequency at compile time, with options available at the program, class, and method level.
Annotation Options
The logging frequency can be easily specified using annotations. The new annotation options are:
@Unlogged(loggingFrequency = some_string): Sets the logging frequency for the entire programme.
@UnloggedClass(loggingFrequency = some_string): Defines the logging frequency at the class level.
@UnloggedMethod(loggingFrequency = some_string): Specifies the logging frequency at the method level.
Method Compilation States:
A compiled method falls into one of three states:
Always probed: only methodVisitorProbed is called
Never probed: no method visitor is invoked
Conditionally probed: both methodVisitorProbed and methodVisitorWithoutProbe are called
Implementation Details
The feature is implemented as follows:
Annotation Processing: Two annotation visitor traverses each annotated class and method. They store values in classCounterMap and methodCounterMap respectively.
Probe Counter and Frequency Logging: Adds probeCounter and the frequencyLogging method at runtime to determine whether a method should be logged.
Static Field Initialisation: A static field () is required for initialising the mapStore. For class with starting method, a initialising method is already made. So, initialisation occurs within the same method. For other classes, a new static method is created.
DualMethodVisitor: It is a POJO that encapsulates both methodVisitorProbed and methodVisitorWithoutProbe.
By following these implementation details, the Frequency Logging enhancement ensures precise control over stack call logging in Java programs.
Sanity Testing
The PR was tested using three tests. The github workflow for compile and replay target of SDK was run. They are passing correctly. Also, this was tested using auto executor. The configuration for the same is:
version 0.2.0
Project: branch main of unlogged-spring-maven-demo
Total number of cases run : 368
Number of Passing cases : 112
Number of Failing cases : 256
version freq_logging
Project: branch test_freq_logging of unlogged-spring-maven-demo
Total number of cases run : 368
Number of Passing cases : 112
Number of Failing cases : 256
The tests that were failing/passing were identical for both the sdks.
The replay_target pipeline is failing because the tests defined in the python file are not present in the project test resources. Once, updated this test needs to run again.
Frequency Logging Enhancement
Overview
Introducing the Frequency Logging feature, which enables frequency based stack call logging in Java programs at pre-defined intervals. This flexibility is achieved by setting the logging frequency at compile time, with options available at the program, class, and method level.
Annotation Options
The logging frequency can be easily specified using annotations. The new annotation options are:
@Unlogged(loggingFrequency = some_string)
: Sets the logging frequency for the entire programme.@UnloggedClass(loggingFrequency = some_string)
: Defines the logging frequency at the class level.@UnloggedMethod(loggingFrequency = some_string)
: Specifies the logging frequency at the method level.Method Compilation States:
A compiled method falls into one of three states:
methodVisitorProbed
is calledmethodVisitorProbed
andmethodVisitorWithoutProbe
are calledImplementation Details
The feature is implemented as follows:
Annotation Processing
: Two annotation visitor traverses each annotated class and method. They store values in classCounterMap and methodCounterMap respectively.Probe Counter and Frequency Logging
: Adds probeCounter and the frequencyLogging method at runtime to determine whether a method should be logged.Static Field Initialisation
: A static field (DualMethodVisitor
: It is a POJO that encapsulates both methodVisitorProbed and methodVisitorWithoutProbe.By following these implementation details, the Frequency Logging enhancement ensures precise control over stack call logging in Java programs.
Sanity Testing
compile
andreplay target
of SDK was run. They are passing correctly. Also, this was tested using auto executor. The configuration for the same is:version 0.2.0
main
ofunlogged-spring-maven-demo
version freq_logging
test_freq_logging
ofunlogged-spring-maven-demo