File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 34
34
import io .micrometer .core .instrument .Tag ;
35
35
import io .micrometer .core .instrument .composite .CompositeMeterRegistry ;
36
36
37
+ import org .springframework .boot .actuate .endpoint .InvalidEndpointRequestException ;
37
38
import org .springframework .boot .actuate .endpoint .annotation .Endpoint ;
38
39
import org .springframework .boot .actuate .endpoint .annotation .ReadOperation ;
39
40
import org .springframework .boot .actuate .endpoint .annotation .Selector ;
40
41
import org .springframework .lang .Nullable ;
41
- import org .springframework .util .Assert ;
42
42
43
43
/**
44
44
* An {@link Endpoint} for exposing the metrics held by a {@link MeterRegistry}.
@@ -80,8 +80,12 @@ private String getName(Meter meter) {
80
80
@ ReadOperation
81
81
public MetricResponse metric (@ Selector String requiredMetricName ,
82
82
@ Nullable List <String > tag ) {
83
- Assert .isTrue (tag == null || tag .stream ().allMatch ((t ) -> t .contains (":" )),
84
- "Each tag parameter must be in the form key:value" );
83
+ if (tag != null && tag .stream ().anyMatch ((t ) -> !t .contains (":" ))) {
84
+ throw new InvalidEndpointRequestException (
85
+ "Each tag parameter must be in the form 'key:value' but tags are: "
86
+ + tag ,
87
+ "Each tag parameter must be in the form 'key:value'" );
88
+ }
85
89
List <Tag > tags = parseTags (tag );
86
90
List <Meter > meters = new ArrayList <>();
87
91
collectMeters (meters , this .registry , requiredMetricName , tags );
You can’t perform that action at this time.
0 commit comments