Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public void metric() throws Exception {
.andExpect(status().isOk())
.andDo(document("metrics/metric", responseFields(
fieldWithPath("name").description("Name of the metric"),
fieldWithPath("description").description("Description of the metric"),
fieldWithPath("baseUnit").description("Base unit of the metric"),
fieldWithPath("measurements")
.description("Measurements of the metric"),
fieldWithPath("measurements[].statistic")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ public MetricResponse metric(@Selector String requiredMetricName,
Map<Statistic, Double> samples = getSamples(meters);
Map<String, Set<String>> availableTags = getAvailableTags(meters);
tags.forEach((t) -> availableTags.remove(t.getKey()));
return new MetricResponse(requiredMetricName, asList(samples, Sample::new),
Meter.Id meterId = meters.get(0).getId();
return new MetricResponse(requiredMetricName, meterId.getDescription(),
meterId.getBaseUnit(), asList(samples, Sample::new),
asList(availableTags, AvailableTag::new));
}

Expand Down Expand Up @@ -183,13 +185,19 @@ public static final class MetricResponse {

private final String name;

private final String description;

private final String baseUnit;

private final List<Sample> measurements;

private final List<AvailableTag> availableTags;

MetricResponse(String name, List<Sample> measurements,
List<AvailableTag> availableTags) {
MetricResponse(String name, String description, String baseUnit,
List<Sample> measurements, List<AvailableTag> availableTags) {
this.name = name;
this.description = description;
this.baseUnit = baseUnit;
this.measurements = measurements;
this.availableTags = availableTags;
}
Expand All @@ -198,6 +206,14 @@ public String getName() {
return this.name;
}

public String getDescription() {
return this.description;
}

public String getBaseUnit() {
return this.baseUnit;
}

public List<Sample> getMeasurements() {
return this.measurements;
}
Expand Down