Skip to content

Commit a19eefa

Browse files
marcingrzejszczakfmbenhassine
authored andcommitted
Upgraded to Micrometer 1.10.0-SNAPSHOT
1 parent 0b49e08 commit a19eefa

File tree

9 files changed

+48
-48
lines changed

9 files changed

+48
-48
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<spring-framework.version>6.0.0-SNAPSHOT</spring-framework.version>
5555
<spring-retry.version>1.3.2</spring-retry.version>
5656
<spring-integration.version>6.0.0-SNAPSHOT</spring-integration.version>
57-
<micrometer.version>2.0.0-SNAPSHOT</micrometer.version>
57+
<micrometer.version>1.10.0-SNAPSHOT</micrometer.version>
5858
<jackson.version>2.13.2.2</jackson.version>
5959

6060
<!-- optional production dependencies -->

spring-batch-core/src/main/java/org/springframework/batch/core/job/AbstractJob.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@
4444
import org.springframework.batch.core.listener.CompositeJobExecutionListener;
4545
import org.springframework.batch.core.observability.BatchJobContext;
4646
import org.springframework.batch.core.observability.BatchJobObservation;
47-
import org.springframework.batch.core.observability.BatchJobTagsProvider;
47+
import org.springframework.batch.core.observability.BatchJobKeyValuesProvider;
4848
import org.springframework.batch.core.observability.BatchMetrics;
49-
import org.springframework.batch.core.observability.DefaultBatchJobTagsProvider;
49+
import org.springframework.batch.core.observability.DefaultBatchJobKeyValuesProvider;
5050
import org.springframework.batch.core.repository.JobRepository;
5151
import org.springframework.batch.core.repository.JobRestartException;
5252
import org.springframework.batch.core.scope.context.JobSynchronizationManager;
@@ -69,7 +69,7 @@
6969
* @author Mahmoud Ben Hassine
7070
*/
7171
public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
72-
InitializingBean, Observation.TagsProviderAware<BatchJobTagsProvider> {
72+
InitializingBean, Observation.KeyValuesProviderAware<BatchJobKeyValuesProvider> {
7373

7474
protected static final Log logger = LogFactory.getLog(AbstractJob.class);
7575

@@ -87,7 +87,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
8787

8888
private StepHandler stepHandler;
8989

90-
private BatchJobTagsProvider tagsProvider = new DefaultBatchJobTagsProvider();
90+
private BatchJobKeyValuesProvider keyValuesProvider = new DefaultBatchJobKeyValuesProvider();
9191

9292
/**
9393
* Default constructor.
@@ -315,7 +315,7 @@ public final void execute(JobExecution execution) {
315315
LongTaskTimer.Sample longTaskTimerSample = longTaskTimer.start();
316316
Observation observation = BatchMetrics.createObservation(BatchJobObservation.BATCH_JOB_OBSERVATION.getName(), new BatchJobContext(execution))
317317
.contextualName(execution.getJobInstance().getJobName())
318-
.tagsProvider(this.tagsProvider)
318+
.keyValuesProvider(this.keyValuesProvider)
319319
.start();
320320
try (Observation.Scope scope = observation.openScope()) {
321321

@@ -465,8 +465,8 @@ private void updateStatus(JobExecution jobExecution, BatchStatus status) {
465465
}
466466

467467
@Override
468-
public void setTagsProvider(BatchJobTagsProvider tagsProvider) {
469-
this.tagsProvider = tagsProvider;
468+
public void setKeyValuesProvider(BatchJobKeyValuesProvider keyValuesProvider) {
469+
this.keyValuesProvider = keyValuesProvider;
470470
}
471471

472472
@Override

spring-batch-core/src/main/java/org/springframework/batch/core/observability/BatchJobTagsProvider.java renamed to spring-batch-core/src/main/java/org/springframework/batch/core/observability/BatchJobKeyValuesProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
import io.micrometer.observation.Observation;
2020

2121
/**
22-
* {@link Observation.TagsProvider} for {@link BatchJobContext}.
22+
* {@link Observation.KeyValuesProvider} for {@link BatchJobContext}.
2323
*
2424
* @author Marcin Grzejszczak
2525
* @since 5.0
2626
*/
27-
public interface BatchJobTagsProvider extends Observation.TagsProvider<BatchJobContext> {
27+
public interface BatchJobKeyValuesProvider extends Observation.KeyValuesProvider<BatchJobContext> {
2828

2929
@Override
3030
default boolean supportsContext(Observation.Context context) {

spring-batch-core/src/main/java/org/springframework/batch/core/observability/BatchJobObservation.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package org.springframework.batch.core.observability;
1818

19+
import io.micrometer.common.docs.KeyName;
1920
import io.micrometer.observation.docs.DocumentedObservation;
20-
import io.micrometer.common.docs.TagKey;
2121

2222
/**
2323
* Observation created around a Job execution.
@@ -40,12 +40,12 @@ public String getContextualName() {
4040
}
4141

4242
@Override
43-
public TagKey[] getLowCardinalityTagKeys() {
43+
public KeyName[] getLowCardinalityKeyNames() {
4444
return JobLowCardinalityTags.values();
4545
}
4646

4747
@Override
48-
public TagKey[] getHighCardinalityTagKeys() {
48+
public KeyName[] getHighCardinalityKeyNames() {
4949
return JobHighCardinalityTags.values();
5050
}
5151

@@ -55,14 +55,14 @@ public String getPrefix() {
5555
}
5656
};
5757

58-
enum JobLowCardinalityTags implements TagKey {
58+
enum JobLowCardinalityTags implements KeyName {
5959

6060
/**
6161
* Name of the Spring Batch job.
6262
*/
6363
JOB_NAME {
6464
@Override
65-
public String getKey() {
65+
public String getKeyName() {
6666
return "spring.batch.job.name";
6767
}
6868
},
@@ -72,21 +72,21 @@ public String getKey() {
7272
*/
7373
JOB_STATUS {
7474
@Override
75-
public String getKey() {
75+
public String getKeyName() {
7676
return "spring.batch.job.status";
7777
}
7878
}
7979

8080
}
8181

82-
enum JobHighCardinalityTags implements TagKey {
82+
enum JobHighCardinalityTags implements KeyName {
8383

8484
/**
8585
* ID of the Spring Batch job instance.
8686
*/
8787
JOB_INSTANCE_ID {
8888
@Override
89-
public String getKey() {
89+
public String getKeyName() {
9090
return "spring.batch.job.instanceId";
9191
}
9292
},
@@ -96,7 +96,7 @@ public String getKey() {
9696
*/
9797
JOB_EXECUTION_ID {
9898
@Override
99-
public String getKey() {
99+
public String getKeyName() {
100100
return "spring.batch.job.executionId";
101101
}
102102
}

spring-batch-core/src/main/java/org/springframework/batch/core/observability/BatchStepObservation.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package org.springframework.batch.core.observability;
1818

19+
import io.micrometer.common.docs.KeyName;
1920
import io.micrometer.observation.docs.DocumentedObservation;
20-
import io.micrometer.common.docs.TagKey;
2121

2222
/**
2323
* Observation created around a step execution.
@@ -40,12 +40,12 @@ public String getContextualName() {
4040
}
4141

4242
@Override
43-
public TagKey[] getLowCardinalityTagKeys() {
43+
public KeyName[] getLowCardinalityKeyNames() {
4444
return StepLowCardinalityTags.values();
4545
}
4646

4747
@Override
48-
public TagKey[] getHighCardinalityTagKeys() {
48+
public KeyName[] getHighCardinalityKeyNames() {
4949
return StepHighCardinalityTags.values();
5050
}
5151

@@ -55,14 +55,14 @@ public String getPrefix() {
5555
}
5656
};
5757

58-
enum StepLowCardinalityTags implements TagKey {
58+
enum StepLowCardinalityTags implements KeyName {
5959

6060
/**
6161
* Name of the Spring Batch step.
6262
*/
6363
STEP_NAME {
6464
@Override
65-
public String getKey() {
65+
public String getKeyName() {
6666
return "spring.batch.step.name";
6767
}
6868
},
@@ -72,7 +72,7 @@ public String getKey() {
7272
*/
7373
STEP_TYPE {
7474
@Override
75-
public String getKey() {
75+
public String getKeyName() {
7676
return "spring.batch.step.type";
7777
}
7878
},
@@ -82,7 +82,7 @@ public String getKey() {
8282
*/
8383
JOB_NAME {
8484
@Override
85-
public String getKey() {
85+
public String getKeyName() {
8686
return "spring.batch.step.job.name";
8787
}
8888
},
@@ -92,21 +92,21 @@ public String getKey() {
9292
*/
9393
STEP_STATUS {
9494
@Override
95-
public String getKey() {
95+
public String getKeyName() {
9696
return "spring.batch.step.status";
9797
}
9898
}
9999

100100
}
101101

102-
enum StepHighCardinalityTags implements TagKey {
102+
enum StepHighCardinalityTags implements KeyName {
103103

104104
/**
105105
* ID of the Spring Batch step execution.
106106
*/
107107
STEP_EXECUTION_ID {
108108
@Override
109-
public String getKey() {
109+
public String getKeyName() {
110110
return "spring.batch.step.executionId";
111111
}
112112
}

spring-batch-core/src/main/java/org/springframework/batch/core/observability/BatchStepTagsProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919
import io.micrometer.observation.Observation;
2020

2121
/**
22-
* {@link Observation.TagsProvider} for {@link BatchStepContext}.
22+
* {@link Observation.KeyValuesProvider} for {@link BatchStepContext}.
2323
*
2424
* @author Marcin Grzejszczak
2525
* @since 5.0
2626
*/
27-
public interface BatchStepTagsProvider extends Observation.TagsProvider<BatchStepContext> {
27+
public interface BatchStepTagsProvider extends Observation.KeyValuesProvider<BatchStepContext> {
2828

2929
@Override
3030
default boolean supportsContext(Observation.Context context) {
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,30 @@
1515
*/
1616
package org.springframework.batch.core.observability;
1717

18-
import io.micrometer.common.Tags;
18+
import io.micrometer.common.KeyValues;
1919

2020
import org.springframework.batch.core.JobExecution;
2121

2222
/**
23-
* Default {@link BatchJobTagsProvider} implementation.
23+
* Default {@link BatchJobKeyValuesProvider} implementation.
2424
*
2525
* @author Marcin Grzejszczak
2626
* @author Mahmoud Ben Hassine
2727
* @since 5.0
2828
*/
29-
public class DefaultBatchJobTagsProvider implements BatchJobTagsProvider {
29+
public class DefaultBatchJobKeyValuesProvider implements BatchJobKeyValuesProvider {
3030

3131
@Override
32-
public Tags getLowCardinalityTags(BatchJobContext context) {
32+
public KeyValues getLowCardinalityKeyValues(BatchJobContext context) {
3333
JobExecution execution = context.getJobExecution();
34-
return Tags.of(BatchJobObservation.JobLowCardinalityTags.JOB_NAME.of(execution.getJobInstance().getJobName()),
34+
return KeyValues.of(BatchJobObservation.JobLowCardinalityTags.JOB_NAME.of(execution.getJobInstance().getJobName()),
3535
BatchJobObservation.JobLowCardinalityTags.JOB_STATUS.of(execution.getExitStatus().getExitCode()));
3636
}
3737

3838
@Override
39-
public Tags getHighCardinalityTags(BatchJobContext context) {
39+
public KeyValues getHighCardinalityKeyValues(BatchJobContext context) {
4040
JobExecution execution = context.getJobExecution();
41-
return Tags.of(BatchJobObservation.JobHighCardinalityTags.JOB_INSTANCE_ID.of(String.valueOf(execution.getJobInstance().getInstanceId())),
41+
return KeyValues.of(BatchJobObservation.JobHighCardinalityTags.JOB_INSTANCE_ID.of(String.valueOf(execution.getJobInstance().getInstanceId())),
4242
BatchJobObservation.JobHighCardinalityTags.JOB_EXECUTION_ID.of(String.valueOf(execution.getId())));
4343
}
4444

spring-batch-core/src/main/java/org/springframework/batch/core/observability/DefaultBatchStepTagsProvider.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616
package org.springframework.batch.core.observability;
1717

18-
import io.micrometer.common.Tags;
18+
import io.micrometer.common.KeyValues;
1919

2020
import org.springframework.batch.core.StepExecution;
2121

@@ -29,17 +29,17 @@
2929
public class DefaultBatchStepTagsProvider implements BatchStepTagsProvider {
3030

3131
@Override
32-
public Tags getLowCardinalityTags(BatchStepContext context) {
32+
public KeyValues getLowCardinalityKeyValues(BatchStepContext context) {
3333
StepExecution execution = context.getStepExecution();
34-
return Tags.of(BatchStepObservation.StepLowCardinalityTags.STEP_NAME.of(execution.getStepName()),
34+
return KeyValues.of(BatchStepObservation.StepLowCardinalityTags.STEP_NAME.of(execution.getStepName()),
3535
BatchStepObservation.StepLowCardinalityTags.JOB_NAME.of(execution.getJobExecution().getJobInstance().getJobName()),
3636
BatchStepObservation.StepLowCardinalityTags.STEP_STATUS.of(execution.getExitStatus().getExitCode()));
3737
}
3838

3939
@Override
40-
public Tags getHighCardinalityTags(BatchStepContext context) {
40+
public KeyValues getHighCardinalityKeyValues(BatchStepContext context) {
4141
StepExecution execution = context.getStepExecution();
42-
return Tags.of(BatchStepObservation.StepHighCardinalityTags.STEP_EXECUTION_ID.of(String.valueOf(execution.getId())));
42+
return KeyValues.of(BatchStepObservation.StepHighCardinalityTags.STEP_EXECUTION_ID.of(String.valueOf(execution.getId())));
4343
}
4444

4545
}

spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
* @author Chris Schaefer
6161
* @author Mahmoud Ben Hassine
6262
*/
63-
public abstract class AbstractStep implements Step, InitializingBean, BeanNameAware, Observation.TagsProviderAware<BatchStepTagsProvider> {
63+
public abstract class AbstractStep implements Step, InitializingBean, BeanNameAware, Observation.KeyValuesProviderAware<BatchStepTagsProvider> {
6464

6565
private static final Log logger = LogFactory.getLog(AbstractStep.class);
6666

@@ -74,7 +74,7 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw
7474

7575
private JobRepository jobRepository;
7676

77-
private BatchStepTagsProvider tagsProvider = new DefaultBatchStepTagsProvider();
77+
private BatchStepTagsProvider keyValuesProvider = new DefaultBatchStepTagsProvider();
7878

7979
/**
8080
* Default constructor.
@@ -202,7 +202,7 @@ public final void execute(StepExecution stepExecution) throws JobInterruptedExce
202202
stepExecution.setStatus(BatchStatus.STARTED);
203203
Observation observation = BatchMetrics.createObservation(BatchStepObservation.BATCH_STEP_OBSERVATION.getName(), new BatchStepContext(stepExecution))
204204
.contextualName(stepExecution.getStepName())
205-
.tagsProvider(this.tagsProvider)
205+
.keyValuesProvider(this.keyValuesProvider)
206206
.start();
207207
getJobRepository().update(stepExecution);
208208

@@ -414,7 +414,7 @@ else if (ex instanceof NoSuchJobException || ex.getCause() instanceof NoSuchJobE
414414
}
415415

416416
@Override
417-
public void setTagsProvider(BatchStepTagsProvider tagsProvider) {
418-
this.tagsProvider = tagsProvider;
417+
public void setKeyValuesProvider(BatchStepTagsProvider keyValuesProvider) {
418+
this.keyValuesProvider = keyValuesProvider;
419419
}
420420
}

0 commit comments

Comments
 (0)