Skip to content

Commit

Permalink
record atlas query and url used to retrieve data as UI assist (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Graff committed Jan 2, 2018
1 parent 5abf159 commit 132efc2
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ public List<MetricSet> queryMetrics(String accountName,
metricSetBuilder.tags(filteredTags);
}

metricSetBuilder.attribute("query", decoratedQuery);
metricSetBuilder.attribute("baseURL", uri);

metricSetList.add(metricSetBuilder.build());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public class MetricSet {
@Getter
private List<Double> values;

@Singular
@Getter
private Map<String, String> attributes;

@JsonIgnore
private String metricSetKey;

Expand All @@ -67,13 +71,15 @@ public MetricSet(String name,
String startTimeIso,
long stepMillis,
List<Double> values,
Map<String, String> attributes,
String metricSetKey) {
this.name = name;
this.tags = tags;
this.startTimeMillis = startTimeMillis;
this.startTimeIso = startTimeIso;
this.stepMillis = stepMillis;
this.values = values;
this.attributes = attributes;
this.metricSetKey = metricSetKey;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public MetricSetPair mixOne(MetricSet controlMetricSet, MetricSet experimentMetr
.scope("control", controlScope)
.scope("experiment", experimentScope);

if (controlMetricSet.getAttributes() != null) {
metricSetPairBuilder.attribute("control", controlMetricSet.getAttributes());
}
if (experimentMetricSet.getAttributes() != null) {
metricSetPairBuilder.attribute("experiment", experimentMetricSet.getAttributes());
}

return metricSetPairBuilder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,22 @@ public class MetricSetPair {
@Getter
private Map<String, MetricSetScope> scopes;

@Getter
@Singular
private Map<String, Map<String, String>> attributes;

public MetricSetPair(String name,
String id,
Map<String, String> tags,
Map<String, List<Double>> values,
Map<String, MetricSetScope> scopes) {
Map<String, MetricSetScope> scopes,
Map<String, Map<String, String>> attributes) {
this.name = name;
this.id = id;
this.tags = tags;
this.values = values;
this.scopes = scopes;
this.attributes = attributes;
}

@Builder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class MetricSetMixerServiceSpec extends Specification {
.name('cpu')
.values([1, 3, 5, 7])
.tag("tagName", "tagValue")
.attribute("attributeName", "attributeValue")
.build()

@Shared
Expand All @@ -36,6 +37,7 @@ class MetricSetMixerServiceSpec extends Specification {
.name('cpu')
.values([2, 4, 6, 8])
.tag("tagName", "tagValue")
.attribute("attributeName", "attributeValue")
.build()

@Shared
Expand Down Expand Up @@ -128,6 +130,7 @@ class MetricSetMixerServiceSpec extends Specification {
experiment: [2, 4, 6, 8]
]
metricSetPair.tags == [tagName: "tagValue"]
metricSetPair.attributes == [ control: [ attributeName: "attributeValue" ], experiment: [ attributeName: "attributeValue" ]]
}

void "Mixing sets should produce an id field"() {
Expand Down

0 comments on commit 132efc2

Please sign in to comment.