Commit 7021f33f authored by Dmytro Bogatov's avatar Dmytro Bogatov

Merge branch 'hotfix' into 'master'

Hotfix

See merge request !19
parents bd9e6e41 d342bebe
Pipeline #606 passed with stages
in 6 minutes and 40 seconds
......@@ -27,7 +27,7 @@ export abstract class MetricPage<T extends Metric<DataPoint>> {
protected metric: T;
protected dataTablesRendered: boolean = false;
protected dataTable : DataTables.DataTable;
protected dataTable: DataTables.DataTable;
/**
* Minimal theoretical value for data series.
......@@ -190,6 +190,20 @@ export abstract class MetricPage<T extends Metric<DataPoint>> {
this.minData)
;
// fix low time range
// if the difference in time is less than 10 minutes, we should extend the range
const tenMinutes = 10 * 60 * 1000
if (to - from < tenMinutes) {
if (this.maxData - to >= tenMinutes) {
to += tenMinutes;
} else if (from - this.minData >= tenMinutes) {
from -= tenMinutes;
} else {
from = this.minData;
to = this.maxData;
}
}
plot.setSelection({ xaxis: { from: from, to: to }, yaxis: { from: 0, to: 0 } });
} else {
// if latest data point is more than 2 hours ago
......
......@@ -146,7 +146,7 @@ export class CpuLoadMetricPage extends MetricPage<Metric<CpuLoadDataPoint>> {
<td>${dp.timestamp}</td>
<td>${dp.value}%</td>
<td>
<a href="/home/metric/${MetricType[this.metric.metricType]}/${this.metric.source}/${new Date(dp.timestamp.getTime() - 2 * 60 * 1000).getTime()}/${new Date(dp.timestamp.getTime() + 2 * 60 * 1000).getTime()}">
<a href="/home/metric/${MetricType[this.metric.metricType]}/${this.metric.source}/${new Date(dp.timestamp.getTime() - 10 * 60 * 1000).getTime()}/${new Date(dp.timestamp.getTime() + 10 * 60 * 1000).getTime()}">
Zoom plot
</a>
</td>
......
......@@ -208,7 +208,7 @@ export class HealthMetricPage extends MetricPage<Metric<HealthDataPoint>> {
Health report details | Health ${e.detail.health}% | ${timestamp}
<small>
Inspect metric labels at the moment report was generated.
<a href="/home/metric/${MetricType[this.metric.metricType]}/${this.metric.source}/${new Date(timestamp.getTime() - 2 * 60 * 1000).getTime()}/${new Date(timestamp.getTime() + 2 * 60 * 1000).getTime()}">
<a href="/home/metric/${MetricType[this.metric.metricType]}/${this.metric.source}/${new Date(timestamp.getTime() - 10 * 60 * 1000).getTime()}/${new Date(timestamp.getTime() + 10 * 60 * 1000).getTime()}">
View data at that moment.
</a>
</small>
......@@ -238,7 +238,7 @@ export class HealthMetricPage extends MetricPage<Metric<HealthDataPoint>> {
<td>${el.Source}</td>
<td>${el.Label}</td>
<td>
<a href="/home/metric/${el.Type}/${el.Source}/${new Date(timestamp.getTime() - 2 * 60 * 1000).getTime()}/${new Date(timestamp.getTime() + 2 * 60 * 1000).getTime()}">
<a href="/home/metric/${el.Type}/${el.Source}/${new Date(timestamp.getTime() - 10 * 60 * 1000).getTime()}/${new Date(timestamp.getTime() + 10 * 60 * 1000).getTime()}">
View data
</a>
</td>
......
......@@ -191,7 +191,7 @@ export class PingMetricPage extends MetricPage<Metric<PingDataPoint>> {
<td>${dp.responseTime} ms</td>
<td>${dp.success ? "Success" : dp.message}</td>
<td>
<a href="/home/metric/${MetricType[this.metric.metricType]}/${this.metric.source}/${new Date(dp.timestamp.getTime() - 2 * 60 * 1000).getTime()}/${new Date(dp.timestamp.getTime() + 2 * 60 * 1000).getTime()}">
<a href="/home/metric/${MetricType[this.metric.metricType]}/${this.metric.source}/${new Date(dp.timestamp.getTime() - 10 * 60 * 1000).getTime()}/${new Date(dp.timestamp.getTime() + 10 * 60 * 1000).getTime()}">
Zoom plot
</a>
</td>
......
......@@ -196,7 +196,7 @@ export class UserActionMetricPage extends MetricPage<Metric<UserActionDataPoint>
<td>${dp.action}</td>
<td># ${dp.count}</td>
<td>
<a href="/home/metric/${MetricType[this.metric.metricType]}/${this.metric.source}/${new Date(dp.timestamp.getTime() - 2 * 60 * 1000).getTime()}/${new Date(dp.timestamp.getTime() + 2 * 60 * 1000).getTime()}">
<a href="/home/metric/${MetricType[this.metric.metricType]}/${this.metric.source}/${new Date(dp.timestamp.getTime() - 10 * 60 * 1000).getTime()}/${new Date(dp.timestamp.getTime() + 10 * 60 * 1000).getTime()}">
Zoom plot
</a>
</td>
......
#!/bin/bash
set -e
# EXIT CODES
SUCCESS=0
GENERIC_ERROR=1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment