This library helps you to track your application's performance based on Spring Framework, and Junit Test Framework. It's especially useful when you don't have any monitoring system, or even so, before you publish on your development environment.
Add dependency on your build.gradle
repositories {
maven { url 'https://jitpack.io' }
}
...
dependencies {
testImplementation 'com.github.morak-morak:performance-tracker:master-SNAPSHOT'
}
And just annotate @PerformanceTracker
on your test class. Below is an example.
@PerformanceTracker
@JdbcTest
class MyTest {
private final JdbcTemplate jdbcTemplate;
@Autowired
public MyTest(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public void test1() {
jdbcTemplate.execute("...");
}
}
And check your result on ~/logs/performance.log
.
If you wanna know further examples, see this
PerformanceTracker currently supports several features with beans spring registered.
In case of bug or inappropriate measurement, please report it on issues.
- Database Access(JPA, JdbcTemplate) (using
DataSource
) - Application (using
Spring interceptor
) - API Request (using
RestTemplateBuilder
)
You can see the result of PerformanceTracker(which is called description) with format you specified.
- logging
- json
Context
represents the way of aggregation measured through your tests.
- Method : per test method.
- Endpoint : per request endpoint (e.g. URI, SQL)
You can adjust properties of PerformanceTracker with spring property configurations.
com.morak.performance-tracker:
path: {DIRECTORY_TO_WRITE_RESULT} # default is '{yourProject}/logs/'
file: {FILE_NAME_TO_WRITE_RESULT} # default is 'performance'
format: {DESCRIPTION_TYPE} # 'log' or 'json', default is 'log'