File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
spring-batch-core/src/main/java/org/springframework/batch/core/job
spring-batch-samples/src/test/java/org/springframework/batch/sample/metrics Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2006-2019 the original author or authors.
2
+ * Copyright 2006-2020 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -301,7 +301,8 @@ public final void execute(JobExecution execution) {
301
301
}
302
302
303
303
JobSynchronizationManager .register (execution );
304
- LongTaskTimer longTaskTimer = BatchMetrics .createLongTaskTimer ("job.active" , "Active jobs" );
304
+ LongTaskTimer longTaskTimer = BatchMetrics .createLongTaskTimer ("job.active" , "Active jobs" ,
305
+ Tag .of ("name" , execution .getJobInstance ().getJobName ()));
305
306
LongTaskTimer .Sample longTaskTimerSample = longTaskTimer .start ();
306
307
Timer .Sample timerSample = BatchMetrics .createTimerSample ();
307
308
try {
Original file line number Diff line number Diff line change @@ -162,6 +162,7 @@ public void testBatchMetrics() throws Exception {
162
162
163
163
try {
164
164
Metrics .globalRegistry .get ("spring.batch.job.active" )
165
+ .tag ("name" , "job" )
165
166
.longTaskTimer ();
166
167
} catch (Exception e ) {
167
168
fail ("There should be a meter of type LONG_TASK_TIMER named spring.batch.job.active" +
You can’t perform that action at this time.
0 commit comments