Skip to content

Commit

Permalink
change steps
Browse files Browse the repository at this point in the history
  • Loading branch information
FLYBYME committed Oct 30, 2023
1 parent b4492c2 commit 4b05fd7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions services/metrics.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ module.exports = {
const pod = pods[i];
const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query avrage memory usage
const query = `avg(container_memory_working_set_bytes{pod="${pod.metadata.name}",namespace="${pod.metadata.namespace}"}) by (pod,namespace)`;
const result = await this.prom.rangeQuery(query, start, end, step)
Expand Down Expand Up @@ -209,7 +209,7 @@ module.exports = {
const pod = pods[i];
const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query avrage memory usage
const query = `avg(rate(container_cpu_usage_seconds_total{pod="${pod.metadata.name}",namespace="${pod.metadata.namespace}"}[1m])) by (pod,namespace)`;
const result = await this.prom.rangeQuery(query, start, end, step)
Expand Down Expand Up @@ -262,7 +262,7 @@ module.exports = {
const pod = pods[i];
const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query avrage memory usage
const txQuery = `avg(rate(container_network_transmit_bytes_total{pod="${pod.metadata.name}",namespace="${pod.metadata.namespace}"}[1m])) by (pod,namespace)`;
const rxQuery = `avg(rate(container_network_receive_bytes_total{pod="${pod.metadata.name}",namespace="${pod.metadata.namespace}"}[1m])) by (pod,namespace)`;
Expand Down Expand Up @@ -314,7 +314,7 @@ module.exports = {

const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query avrage memory usage
const query = `avg(container_memory_working_set_bytes{namespace="${namespace.name}"}) by (namespace)`;
const result = await this.prom.rangeQuery(query, start, end, step)
Expand Down Expand Up @@ -361,7 +361,7 @@ module.exports = {

const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query avrage memory usage
const query = `avg(rate(container_cpu_usage_seconds_total{namespace="${namespace.name}"}[1m])) by (namespace)`;
const result = await this.prom.rangeQuery(query, start, end, step)
Expand Down Expand Up @@ -404,7 +404,7 @@ module.exports = {

const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query network usage tx rx
const txQuery = `avg(rate(container_network_transmit_bytes_total{namespace="${namespace.name}"}[1m])) by (namespace)`;
const rxQuery = `avg(rate(container_network_receive_bytes_total{namespace="${namespace.name}"}[1m])) by (namespace)`;
Expand Down Expand Up @@ -444,7 +444,7 @@ module.exports = {
async handler(ctx) {
const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query avrage memory usage
const query = `sum(container_memory_working_set_bytes)`;
const result = await this.prom.rangeQuery(query, start, end, step)
Expand Down Expand Up @@ -481,7 +481,7 @@ module.exports = {
async handler(ctx) {
const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query avrage memory usage
const query = `sum(rate(container_cpu_usage_seconds_total[1m]))`;
const result = await this.prom.rangeQuery(query, start, end, step)
Expand Down Expand Up @@ -513,7 +513,7 @@ module.exports = {
async handler(ctx) {
const start = new Date().getTime() - 24 * 60 * 60 * 1000;
const end = new Date();
const step = 1 * 60 * 60; // 1 point every 6 hours
const step = 15 * 60; // 1 point every 15 minutes
// query network usage tx rx
const txQuery = `sum(rate(container_network_transmit_bytes_total[1m]))`;
const rxQuery = `sum(rate(container_network_receive_bytes_total[1m]))`;
Expand Down

0 comments on commit 4b05fd7

Please sign in to comment.