Skip to content

Commit

Permalink
refact: Replaced hta with timeline
Browse files Browse the repository at this point in the history
we don't want to expose the HTA name at the other end of MetricQ
  • Loading branch information
bmario committed Jul 12, 2022
1 parent 03f3ac3 commit c55b68c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions history/metricq-history.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class AnalyzeQuery {
}
}

class HtaQuery {
class Timeline {
constructor(mq, from, to, points, postFunction) {
this.mq = mq;
this.from = from;
Expand All @@ -128,7 +128,7 @@ class HtaQuery {
let data = result["data"];
for (const metric_data of Object.values(data)) {
for (const value of metric_data[metric_data.mode]) {
value.time = moment(value.time);
value.timestamp = moment(value.timestamp / 1e6);
}
}

Expand All @@ -145,7 +145,7 @@ class HtaQuery {
maxDataPoints: this.points,
metrics: this.metrics,
};
this.postFunction(`${this.mq.url}/query_hta`, parameters, this.mq.config)
this.postFunction(`${this.mq.url}/timeline`, parameters, this.mq.config)
.then((result) => resolve(this._parse_result(result)))
.catch((error) => reject(error));
});
Expand Down Expand Up @@ -209,8 +209,8 @@ class MetricQHistoric {
return new AnalyzeQuery(this, moment(from), moment(to), this.postFunction);
}

hta_query(from, to, num_points) {
return new HtaQuery(
timeline(from, to, num_points) {
return new Timeline(
this,
moment(from),
moment(to),
Expand Down
2 changes: 1 addition & 1 deletion history_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ a.run()
.then((data) => console.log(data["elab.ariel.power"]))
.catch((error) => console.log("Something went wrong: " + error));

let h = mq.htaquery(moment().startOf("day"), moment(), 4);
let h = mq.timeline(moment().startOf("day"), moment(), 4);

for (let metric of ["elab.ariel.power"]) {
h.metric(metric);
Expand Down

0 comments on commit c55b68c

Please sign in to comment.