2020-04-08 14:13:33 +05:30
import { mapToDashboardViewModel } from '~/monitoring/stores/utils' ;
2020-01-01 13:55:28 +05:30
// This import path needs to be relative for now because this mock data is used in
// Karma specs too, where the helpers/test_constants alias can not be resolved
import { TEST _HOST } from '../helpers/test_constants' ;
2019-12-26 22:10:19 +05:30
export const mockHost = 'http://test.host' ;
export const mockProjectDir = '/frontend-fixtures/environments-project' ;
2020-01-01 13:55:28 +05:30
export const mockApiEndpoint = ` ${ TEST _HOST } /monitoring/mock ` ;
2019-12-26 22:10:19 +05:30
export const anomalyDeploymentData = [
{
id : 111 ,
iid : 3 ,
sha : 'f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187' ,
ref : {
name : 'master' ,
} ,
created _at : '2019-08-19T22:00:00.000Z' ,
deployed _at : '2019-08-19T22:01:00.000Z' ,
tag : false ,
'last?' : true ,
} ,
{
id : 110 ,
iid : 2 ,
sha : 'f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187' ,
ref : {
name : 'master' ,
} ,
created _at : '2019-08-19T23:00:00.000Z' ,
deployed _at : '2019-08-19T23:00:00.000Z' ,
tag : false ,
'last?' : false ,
} ,
] ;
export const anomalyMockResultValues = {
noAnomaly : [
[
[ '2019-08-19T19:00:00.000Z' , 1.25 ] ,
[ '2019-08-19T20:00:00.000Z' , 1.45 ] ,
[ '2019-08-19T21:00:00.000Z' , 1.55 ] ,
[ '2019-08-19T22:00:00.000Z' , 1.48 ] ,
] ,
[
// upper boundary
[ '2019-08-19T19:00:00.000Z' , 2 ] ,
[ '2019-08-19T20:00:00.000Z' , 2.55 ] ,
[ '2019-08-19T21:00:00.000Z' , 2.65 ] ,
[ '2019-08-19T22:00:00.000Z' , 3.0 ] ,
] ,
[
// lower boundary
[ '2019-08-19T19:00:00.000Z' , 0.45 ] ,
[ '2019-08-19T20:00:00.000Z' , 0.65 ] ,
[ '2019-08-19T21:00:00.000Z' , 0.7 ] ,
[ '2019-08-19T22:00:00.000Z' , 0.8 ] ,
] ,
] ,
noBoundary : [
[
[ '2019-08-19T19:00:00.000Z' , 1.25 ] ,
[ '2019-08-19T20:00:00.000Z' , 1.45 ] ,
[ '2019-08-19T21:00:00.000Z' , 1.55 ] ,
[ '2019-08-19T22:00:00.000Z' , 1.48 ] ,
] ,
[
// empty upper boundary
] ,
[
// empty lower boundary
] ,
] ,
oneAnomaly : [
[
[ '2019-08-19T19:00:00.000Z' , 1.25 ] ,
[ '2019-08-19T20:00:00.000Z' , 3.45 ] , // anomaly
[ '2019-08-19T21:00:00.000Z' , 1.55 ] ,
] ,
[
// upper boundary
[ '2019-08-19T19:00:00.000Z' , 2 ] ,
[ '2019-08-19T20:00:00.000Z' , 2.55 ] ,
[ '2019-08-19T21:00:00.000Z' , 2.65 ] ,
] ,
[
// lower boundary
[ '2019-08-19T19:00:00.000Z' , 0.45 ] ,
[ '2019-08-19T20:00:00.000Z' , 0.65 ] ,
[ '2019-08-19T21:00:00.000Z' , 0.7 ] ,
] ,
] ,
negativeBoundary : [
[
[ '2019-08-19T19:00:00.000Z' , 1.25 ] ,
[ '2019-08-19T20:00:00.000Z' , 3.45 ] , // anomaly
[ '2019-08-19T21:00:00.000Z' , 1.55 ] ,
] ,
[
// upper boundary
[ '2019-08-19T19:00:00.000Z' , 2 ] ,
[ '2019-08-19T20:00:00.000Z' , 2.55 ] ,
[ '2019-08-19T21:00:00.000Z' , 2.65 ] ,
] ,
[
// lower boundary
[ '2019-08-19T19:00:00.000Z' , - 1.25 ] ,
[ '2019-08-19T20:00:00.000Z' , - 2.65 ] ,
[ '2019-08-19T21:00:00.000Z' , - 3.7 ] , // lowest point
] ,
] ,
} ;
export const anomalyMockGraphData = {
title : 'Requests Per Second Mock Data' ,
type : 'anomaly-chart' ,
weight : 3 ,
metrics : [
{
metricId : '90' ,
id : 'metric' ,
query _range : 'MOCK_PROMETHEUS_METRIC_QUERY_RANGE' ,
unit : 'RPS' ,
label : 'Metrics RPS' ,
metric _id : 90 ,
prometheus _endpoint _path : 'MOCK_METRIC_PEP' ,
result : [
{
metric : { } ,
values : [ [ '2019-08-19T19:00:00.000Z' , 0 ] ] ,
} ,
] ,
} ,
{
metricId : '91' ,
id : 'upper' ,
query _range : '...' ,
unit : 'RPS' ,
label : 'Upper Limit Metrics RPS' ,
metric _id : 91 ,
prometheus _endpoint _path : 'MOCK_UPPER_PEP' ,
result : [
{
metric : { } ,
values : [ [ '2019-08-19T19:00:00.000Z' , 0 ] ] ,
} ,
] ,
} ,
{
metricId : '92' ,
id : 'lower' ,
query _range : '...' ,
unit : 'RPS' ,
label : 'Lower Limit Metrics RPS' ,
metric _id : 92 ,
prometheus _endpoint _path : 'MOCK_LOWER_PEP' ,
result : [
{
metric : { } ,
values : [ [ '2019-08-19T19:00:00.000Z' , 0 ] ] ,
} ,
] ,
} ,
] ,
} ;
export const deploymentData = [
{
id : 111 ,
iid : 3 ,
sha : 'f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187' ,
commitUrl :
2020-03-09 13:42:32 +05:30
'http://test.host/frontend-fixtures/environments-project/-/commit/f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187' ,
2019-12-26 22:10:19 +05:30
ref : {
name : 'master' ,
} ,
created _at : '2019-07-16T10:14:25.589Z' ,
tag : false ,
tagUrl : 'http://test.host/frontend-fixtures/environments-project/tags/false' ,
'last?' : true ,
} ,
{
id : 110 ,
iid : 2 ,
sha : 'f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187' ,
commitUrl :
2020-03-09 13:42:32 +05:30
'http://test.host/frontend-fixtures/environments-project/-/commit/f5bcd1d9dac6fa4137e2510b9ccd134ef2e84187' ,
2019-12-26 22:10:19 +05:30
ref : {
name : 'master' ,
} ,
created _at : '2019-07-16T11:14:25.589Z' ,
tag : false ,
tagUrl : 'http://test.host/frontend-fixtures/environments-project/tags/false' ,
'last?' : false ,
} ,
{
id : 109 ,
iid : 1 ,
sha : '6511e58faafaa7ad2228990ec57f19d66f7db7c2' ,
commitUrl :
2020-03-09 13:42:32 +05:30
'http://test.host/frontend-fixtures/environments-project/-/commit/6511e58faafaa7ad2228990ec57f19d66f7db7c2' ,
2019-12-26 22:10:19 +05:30
ref : {
name : 'update2-readme' ,
} ,
created _at : '2019-07-16T12:14:25.589Z' ,
tag : false ,
tagUrl : 'http://test.host/frontend-fixtures/environments-project/tags/false' ,
'last?' : false ,
} ,
] ;
export const metricsNewGroupsAPIResponse = [
{
group : 'System metrics (Kubernetes)' ,
priority : 5 ,
panels : [
{
title : 'Memory Usage (Pod average)' ,
type : 'area-chart' ,
y _label : 'Memory Used per Pod' ,
weight : 2 ,
metrics : [
{
id : 'system_metrics_kubernetes_container_memory_average' ,
query _range :
'avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}) by (job)) without (job) / count(avg(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}) without (job)) /1024/1024' ,
label : 'Pod average' ,
unit : 'MB' ,
metric _id : 17 ,
prometheus _endpoint _path :
'/root/autodevops-deploy/environments/32/prometheus/api/v1/query_range?query=avg%28sum%28container_memory_usage_bytes%7Bcontainer_name%21%3D%22POD%22%2Cpod_name%3D~%22%5E%25%7Bci_environment_slug%7D-%28%5B%5Ec%5D.%2A%7Cc%28%5B%5Ea%5D%7Ca%28%5B%5En%5D%7Cn%28%5B%5Ea%5D%7Ca%28%5B%5Er%5D%7Cr%5B%5Ey%5D%29%29%29%29.%2A%7C%29-%28.%2A%29%22%2Cnamespace%3D%22%25%7Bkube_namespace%7D%22%7D%29+by+%28job%29%29+without+%28job%29+%2F+count%28avg%28container_memory_usage_bytes%7Bcontainer_name%21%3D%22POD%22%2Cpod_name%3D~%22%5E%25%7Bci_environment_slug%7D-%28%5B%5Ec%5D.%2A%7Cc%28%5B%5Ea%5D%7Ca%28%5B%5En%5D%7Cn%28%5B%5Ea%5D%7Ca%28%5B%5Er%5D%7Cr%5B%5Ey%5D%29%29%29%29.%2A%7C%29-%28.%2A%29%22%2Cnamespace%3D%22%25%7Bkube_namespace%7D%22%7D%29+without+%28job%29%29+%2F1024%2F1024' ,
appearance : {
line : {
width : 2 ,
} ,
} ,
} ,
] ,
} ,
] ,
} ,
] ;
2020-04-08 14:13:33 +05:30
const metricsResult = [
{
metric : { } ,
values : [
[ 1563272065.589 , '10.396484375' ] ,
[ 1563272125.589 , '10.333984375' ] ,
[ 1563272185.589 , '10.333984375' ] ,
[ 1563272245.589 , '10.333984375' ] ,
[ 1563272305.589 , '10.333984375' ] ,
[ 1563272365.589 , '10.333984375' ] ,
[ 1563272425.589 , '10.38671875' ] ,
[ 1563272485.589 , '10.333984375' ] ,
[ 1563272545.589 , '10.333984375' ] ,
[ 1563272605.589 , '10.333984375' ] ,
[ 1563272665.589 , '10.333984375' ] ,
[ 1563272725.589 , '10.333984375' ] ,
[ 1563272785.589 , '10.396484375' ] ,
[ 1563272845.589 , '10.333984375' ] ,
[ 1563272905.589 , '10.333984375' ] ,
[ 1563272965.589 , '10.3984375' ] ,
[ 1563273025.589 , '10.337890625' ] ,
[ 1563273085.589 , '10.34765625' ] ,
[ 1563273145.589 , '10.337890625' ] ,
[ 1563273205.589 , '10.337890625' ] ,
[ 1563273265.589 , '10.337890625' ] ,
[ 1563273325.589 , '10.337890625' ] ,
[ 1563273385.589 , '10.337890625' ] ,
[ 1563273445.589 , '10.337890625' ] ,
[ 1563273505.589 , '10.337890625' ] ,
[ 1563273565.589 , '10.337890625' ] ,
[ 1563273625.589 , '10.337890625' ] ,
[ 1563273685.589 , '10.337890625' ] ,
[ 1563273745.589 , '10.337890625' ] ,
[ 1563273805.589 , '10.337890625' ] ,
[ 1563273865.589 , '10.390625' ] ,
[ 1563273925.589 , '10.390625' ] ,
] ,
} ,
] ;
2020-01-01 13:55:28 +05:30
export const mockedEmptyResult = {
metricId : '1_response_metrics_nginx_ingress_throughput_status_code' ,
result : [ ] ,
} ;
2020-04-08 14:13:33 +05:30
export const mockedEmptyThroughputResult = {
metricId : 'undefined_response_metrics_nginx_ingress_16_throughput_status_code' ,
result : [ ] ,
} ;
2019-12-26 22:10:19 +05:30
export const mockedQueryResultPayload = {
2020-04-08 14:13:33 +05:30
metricId : '12_system_metrics_kubernetes_container_memory_total' ,
result : metricsResult ,
2019-12-26 22:10:19 +05:30
} ;
2020-01-01 13:55:28 +05:30
export const mockedQueryResultPayloadCoresTotal = {
metricId : '13_system_metrics_kubernetes_container_cores_total' ,
2020-04-08 14:13:33 +05:30
result : metricsResult ,
} ;
export const mockedQueryResultFixture = {
// First metric in fixture `metrics_dashboard/environment_metrics_dashboard.json`
metricId : 'undefined_response_metrics_nginx_ingress_throughput_status_code' ,
result : metricsResult ,
} ;
export const mockedQueryResultFixtureStatusCode = {
metricId : 'undefined_response_metrics_nginx_ingress_latency_pod_average' ,
result : metricsResult ,
2020-01-01 13:55:28 +05:30
} ;
2020-03-09 13:42:32 +05:30
const extraEnvironmentData = new Array ( 15 ) . fill ( null ) . map ( ( _ , idx ) => ( {
id : ` gid://gitlab/Environments/ ${ 150 + idx } ` ,
name : ` no-deployment/noop-branch- ${ idx } ` ,
state : 'available' ,
created _at : '2018-07-04T18:39:41.702Z' ,
updated _at : '2018-07-04T18:44:54.010Z' ,
} ) ) ;
2019-12-26 22:10:19 +05:30
export const environmentData = [
{
2020-03-09 13:42:32 +05:30
id : 'gid://gitlab/Environments/34' ,
2019-12-26 22:10:19 +05:30
name : 'production' ,
state : 'available' ,
external _url : 'http://root-autodevops-deploy.my-fake-domain.com' ,
environment _type : null ,
stop _action : false ,
metrics _path : '/root/hello-prometheus/environments/34/metrics' ,
environment _path : '/root/hello-prometheus/environments/34' ,
stop _path : '/root/hello-prometheus/environments/34/stop' ,
terminal _path : '/root/hello-prometheus/environments/34/terminal' ,
folder _path : '/root/hello-prometheus/environments/folders/production' ,
created _at : '2018-06-29T16:53:38.301Z' ,
updated _at : '2018-06-29T16:57:09.825Z' ,
last _deployment : {
id : 127 ,
} ,
} ,
{
2020-03-09 13:42:32 +05:30
id : 'gid://gitlab/Environments/35' ,
2019-12-26 22:10:19 +05:30
name : 'review/noop-branch' ,
state : 'available' ,
external _url : 'http://root-autodevops-deploy-review-noop-branc-die93w.my-fake-domain.com' ,
environment _type : 'review' ,
stop _action : true ,
metrics _path : '/root/hello-prometheus/environments/35/metrics' ,
environment _path : '/root/hello-prometheus/environments/35' ,
stop _path : '/root/hello-prometheus/environments/35/stop' ,
terminal _path : '/root/hello-prometheus/environments/35/terminal' ,
folder _path : '/root/hello-prometheus/environments/folders/review' ,
created _at : '2018-07-03T18:39:41.702Z' ,
updated _at : '2018-07-03T18:44:54.010Z' ,
last _deployment : {
id : 128 ,
} ,
} ,
2020-03-09 13:42:32 +05:30
] . concat ( extraEnvironmentData ) ;
2019-12-26 22:10:19 +05:30
2020-03-09 13:42:32 +05:30
export const metricsDashboardPayload = {
dashboard : 'Environment metrics' ,
2020-04-08 14:13:33 +05:30
priority : 1 ,
2020-03-09 13:42:32 +05:30
panel _groups : [
{
2020-04-08 14:13:33 +05:30
group : 'System metrics (Kubernetes)' ,
priority : 5 ,
2020-03-09 13:42:32 +05:30
panels : [
{
2020-04-08 14:13:33 +05:30
title : 'Memory Usage (Total)' ,
type : 'area-chart' ,
y _label : 'Total Memory Used' ,
weight : 4 ,
y _axis : {
format : 'megabytes' ,
} ,
2020-03-09 13:42:32 +05:30
metrics : [
{
2020-04-08 14:13:33 +05:30
id : 'system_metrics_kubernetes_container_memory_total' ,
2020-03-09 13:42:32 +05:30
query _range :
2020-04-08 14:13:33 +05:30
'avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-(.*)",namespace="%{kube_namespace}"}) by (job)) without (job) /1000/1000' ,
label : 'Total' ,
unit : 'MB' ,
metric _id : 12 ,
prometheus _endpoint _path : 'http://test' ,
2020-03-09 13:42:32 +05:30
} ,
] ,
2020-04-08 14:13:33 +05:30
} ,
{
title : 'Core Usage (Total)' ,
2020-03-09 13:42:32 +05:30
type : 'area-chart' ,
2020-04-08 14:13:33 +05:30
y _label : 'Total Cores' ,
weight : 3 ,
metrics : [
{
id : 'system_metrics_kubernetes_container_cores_total' ,
query _range :
'avg(sum(rate(container_cpu_usage_seconds_total{container_name!="POD",pod_name=~"^%{ci_environment_slug}-(.*)",namespace="%{kube_namespace}"}[15m])) by (job)) without (job)' ,
label : 'Total' ,
unit : 'cores' ,
metric _id : 13 ,
} ,
] ,
2020-03-09 13:42:32 +05:30
} ,
{
title : 'Memory Usage (Pod average)' ,
2020-04-08 14:13:33 +05:30
type : 'line-chart' ,
2020-03-09 13:42:32 +05:30
y _label : 'Memory Used per Pod' ,
weight : 2 ,
metrics : [
{
id : 'system_metrics_kubernetes_container_memory_average' ,
query _range :
2020-04-08 14:13:33 +05:30
'avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-(.*)",namespace="%{kube_namespace}"}) by (job)) without (job) / count(avg(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-(.*)",namespace="%{kube_namespace}"}) without (job)) /1024/1024' ,
2020-03-09 13:42:32 +05:30
label : 'Pod average' ,
unit : 'MB' ,
2020-04-08 14:13:33 +05:30
metric _id : 14 ,
2020-03-09 13:42:32 +05:30
} ,
] ,
} ,
{
2020-04-08 14:13:33 +05:30
title : 'memories' ,
2020-03-09 13:42:32 +05:30
type : 'area-chart' ,
2020-04-08 14:13:33 +05:30
y _label : 'memories' ,
2020-03-09 13:42:32 +05:30
metrics : [
{
2020-04-08 14:13:33 +05:30
id : 'metric_of_ages_1000' ,
label : 'memory_1000' ,
unit : 'count' ,
prometheus _endpoint _path : '/root' ,
metric _id : 20 ,
} ,
{
id : 'metric_of_ages_1001' ,
label : 'memory_1000' ,
unit : 'count' ,
prometheus _endpoint _path : '/root' ,
metric _id : 21 ,
} ,
{
id : 'metric_of_ages_1002' ,
label : 'memory_1000' ,
unit : 'count' ,
prometheus _endpoint _path : '/root' ,
metric _id : 22 ,
} ,
{
id : 'metric_of_ages_1003' ,
label : 'memory_1000' ,
unit : 'count' ,
prometheus _endpoint _path : '/root' ,
metric _id : 23 ,
} ,
{
id : 'metric_of_ages_1004' ,
label : 'memory_1004' ,
unit : 'count' ,
prometheus _endpoint _path : '/root' ,
metric _id : 24 ,
} ,
] ,
} ,
] ,
} ,
{
group : 'Response metrics (NGINX Ingress VTS)' ,
priority : 10 ,
panels : [
{
metrics : [
{
id : 'response_metrics_nginx_ingress_throughput_status_code' ,
label : 'Status Code' ,
metric _id : 1 ,
prometheus _endpoint _path :
'/root/autodevops-deploy/environments/32/prometheus/api/v1/query_range?query=sum%28rate%28nginx_upstream_responses_total%7Bupstream%3D~%22%25%7Bkube_namespace%7D-%25%7Bci_environment_slug%7D-.%2A%22%7D%5B2m%5D%29%29+by+%28status_code%29' ,
2020-03-09 13:42:32 +05:30
query _range :
2020-04-08 14:13:33 +05:30
'sum(rate(nginx_upstream_responses_total{upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[2m])) by (status_code)' ,
unit : 'req / sec' ,
2020-03-09 13:42:32 +05:30
} ,
] ,
2020-04-08 14:13:33 +05:30
title : 'Throughput' ,
type : 'area-chart' ,
weight : 1 ,
y _label : 'Requests / Sec' ,
2020-03-09 13:42:32 +05:30
} ,
] ,
} ,
] ,
} ;
2020-04-08 14:13:33 +05:30
/ * *
* Mock of response of metrics _dashboard . json
* /
export const metricsDashboardResponse = {
all _dashboards : [ ] ,
dashboard : metricsDashboardPayload ,
metrics _data : { } ,
status : 'success' ,
} ;
export const metricsDashboardViewModel = mapToDashboardViewModel ( metricsDashboardPayload ) ;
2020-03-09 13:42:32 +05:30
const customDashboardsData = new Array ( 30 ) . fill ( null ) . map ( ( _ , idx ) => ( {
default : false ,
display _name : ` Custom Dashboard ${ idx } ` ,
can _edit : true ,
system _dashboard : false ,
project _blob _path : ` ${ mockProjectDir } /blob/master/dashboards/.gitlab/dashboards/dashboard_ ${ idx } .yml ` ,
path : ` .gitlab/dashboards/dashboard_ ${ idx } .yml ` ,
} ) ) ;
2019-12-26 22:10:19 +05:30
export const dashboardGitResponse = [
{
default : true ,
display _name : 'Default' ,
can _edit : false ,
2020-03-09 13:42:32 +05:30
system _dashboard : true ,
2019-12-26 22:10:19 +05:30
project _blob _path : null ,
path : 'config/prometheus/common_metrics.yml' ,
} ,
2020-03-09 13:42:32 +05:30
... customDashboardsData ,
2019-12-26 22:10:19 +05:30
] ;
2020-01-01 13:55:28 +05:30
2020-04-08 14:13:33 +05:30
export const mockDashboardsErrorResponse = {
all _dashboards : customDashboardsData ,
message : "Each 'panel_group' must define an array :panels" ,
status : 'error' ,
} ;
2020-01-01 13:55:28 +05:30
export const graphDataPrometheusQuery = {
title : 'Super Chart A2' ,
type : 'single-stat' ,
weight : 2 ,
metrics : [
{
id : 'metric_a1' ,
metricId : '2' ,
query : 'max(go_memstats_alloc_bytes{job="prometheus"}) by (job) /1024/1024' ,
unit : 'MB' ,
label : 'Total Consumption' ,
metric _id : 2 ,
prometheus _endpoint _path :
'/root/kubernetes-gke-project/environments/35/prometheus/api/v1/query?query=max%28go_memstats_alloc_bytes%7Bjob%3D%22prometheus%22%7D%29+by+%28job%29+%2F1024%2F1024' ,
result : [
{
metric : { job : 'prometheus' } ,
value : [ '2019-06-26T21:03:20.881Z' , 91 ] ,
} ,
] ,
} ,
] ,
} ;
export const graphDataPrometheusQueryRange = {
title : 'Super Chart A1' ,
type : 'area-chart' ,
weight : 2 ,
metrics : [
{
id : 'metric_a1' ,
metricId : '2' ,
query _range :
'avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-(.*)",namespace="%{kube_namespace}"}) by (job)) without (job) /1024/1024/1024' ,
unit : 'MB' ,
label : 'Total Consumption' ,
metric _id : 2 ,
prometheus _endpoint _path :
'/root/kubernetes-gke-project/environments/35/prometheus/api/v1/query?query=max%28go_memstats_alloc_bytes%7Bjob%3D%22prometheus%22%7D%29+by+%28job%29+%2F1024%2F1024' ,
result : [
{
metric : { } ,
values : [ [ 1495700554.925 , '8.0390625' ] , [ 1495700614.925 , '8.0390625' ] ] ,
} ,
] ,
} ,
] ,
} ;
export const graphDataPrometheusQueryRangeMultiTrack = {
title : 'Super Chart A3' ,
type : 'heatmap' ,
weight : 3 ,
x _label : 'Status Code' ,
y _label : 'Time' ,
metrics : [
{
metricId : '1' ,
id : 'response_metrics_nginx_ingress_throughput_status_code' ,
query _range :
'sum(rate(nginx_upstream_responses_total{upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[60m])) by (status_code)' ,
unit : 'req / sec' ,
label : 'Status Code' ,
metric _id : 1 ,
prometheus _endpoint _path :
'/root/rails_nodb/environments/3/prometheus/api/v1/query_range?query=sum%28rate%28nginx_upstream_responses_total%7Bupstream%3D~%22%25%7Bkube_namespace%7D-%25%7Bci_environment_slug%7D-.%2A%22%7D%5B2m%5D%29%29+by+%28status_code%29' ,
result : [
{
metric : { status _code : '1xx' } ,
values : [
[ '2019-08-30T15:00:00.000Z' , 0 ] ,
[ '2019-08-30T16:00:00.000Z' , 2 ] ,
[ '2019-08-30T17:00:00.000Z' , 0 ] ,
[ '2019-08-30T18:00:00.000Z' , 0 ] ,
[ '2019-08-30T19:00:00.000Z' , 0 ] ,
[ '2019-08-30T20:00:00.000Z' , 3 ] ,
] ,
} ,
{
metric : { status _code : '2xx' } ,
values : [
[ '2019-08-30T15:00:00.000Z' , 1 ] ,
[ '2019-08-30T16:00:00.000Z' , 3 ] ,
[ '2019-08-30T17:00:00.000Z' , 6 ] ,
[ '2019-08-30T18:00:00.000Z' , 10 ] ,
[ '2019-08-30T19:00:00.000Z' , 8 ] ,
[ '2019-08-30T20:00:00.000Z' , 6 ] ,
] ,
} ,
{
metric : { status _code : '3xx' } ,
values : [
[ '2019-08-30T15:00:00.000Z' , 1 ] ,
[ '2019-08-30T16:00:00.000Z' , 2 ] ,
[ '2019-08-30T17:00:00.000Z' , 3 ] ,
[ '2019-08-30T18:00:00.000Z' , 3 ] ,
[ '2019-08-30T19:00:00.000Z' , 2 ] ,
[ '2019-08-30T20:00:00.000Z' , 1 ] ,
] ,
} ,
{
metric : { status _code : '4xx' } ,
values : [
[ '2019-08-30T15:00:00.000Z' , 2 ] ,
[ '2019-08-30T16:00:00.000Z' , 0 ] ,
[ '2019-08-30T17:00:00.000Z' , 0 ] ,
[ '2019-08-30T18:00:00.000Z' , 2 ] ,
[ '2019-08-30T19:00:00.000Z' , 0 ] ,
[ '2019-08-30T20:00:00.000Z' , 2 ] ,
] ,
} ,
{
metric : { status _code : '5xx' } ,
values : [
[ '2019-08-30T15:00:00.000Z' , 0 ] ,
[ '2019-08-30T16:00:00.000Z' , 1 ] ,
[ '2019-08-30T17:00:00.000Z' , 0 ] ,
[ '2019-08-30T18:00:00.000Z' , 0 ] ,
[ '2019-08-30T19:00:00.000Z' , 0 ] ,
[ '2019-08-30T20:00:00.000Z' , 2 ] ,
] ,
} ,
] ,
} ,
] ,
} ;
2020-03-09 13:42:32 +05:30
export const stackedColumnMockedData = {
title : 'memories' ,
type : 'stacked-column' ,
x _label : 'x label' ,
y _label : 'y label' ,
metrics : [
{
label : 'memory_1024' ,
unit : 'count' ,
series _name : 'group 1' ,
prometheus _endpoint _path :
'/root/autodevops-deploy-6/-/environments/24/prometheus/api/v1/query_range?query=avg%28sum%28container_memory_usage_bytes%7Bcontainer_name%21%3D%22POD%22%2Cpod_name%3D~%22%5E%25%7Bci_environment_slug%7D-%28%5B%5Ec%5D.%2A%7Cc%28%5B%5Ea%5D%7Ca%28%5B%5En%5D%7Cn%28%5B%5Ea%5D%7Ca%28%5B%5Er%5D%7Cr%5B%5Ey%5D%29%29%29%29.%2A%7C%29-%28.%2A%29%22%2Cnamespace%3D%22%25%7Bkube_namespace%7D%22%7D%29+by+%28job%29%29+without+%28job%29+%2F+count%28avg%28container_memory_usage_bytes%7Bcontainer_name%21%3D%22POD%22%2Cpod_name%3D~%22%5E%25%7Bci_environment_slug%7D-%28%5B%5Ec%5D.%2A%7Cc%28%5B%5Ea%5D%7Ca%28%5B%5En%5D%7Cn%28%5B%5Ea%5D%7Ca%28%5B%5Er%5D%7Cr%5B%5Ey%5D%29%29%29%29.%2A%7C%29-%28.%2A%29%22%2Cnamespace%3D%22%25%7Bkube_namespace%7D%22%7D%29+without+%28job%29%29+%2F1024%2F1024' ,
metric _id : 'undefined_metric_of_ages_1024' ,
metricId : 'undefined_metric_of_ages_1024' ,
result : [
{
metric : { } ,
values : [
[ '2020-01-30 12:00:00' , '5' ] ,
[ '2020-01-30 12:01:00' , '10' ] ,
[ '2020-01-30 12:02:00' , '15' ] ,
] ,
} ,
] ,
} ,
{
label : 'memory_1000' ,
unit : 'count' ,
series _name : 'group 2' ,
prometheus _endpoint _path :
'/root/autodevops-deploy-6/-/environments/24/prometheus/api/v1/query_range?query=avg%28sum%28container_memory_usage_bytes%7Bcontainer_name%21%3D%22POD%22%2Cpod_name%3D~%22%5E%25%7Bci_environment_slug%7D-%28%5B%5Ec%5D.%2A%7Cc%28%5B%5Ea%5D%7Ca%28%5B%5En%5D%7Cn%28%5B%5Ea%5D%7Ca%28%5B%5Er%5D%7Cr%5B%5Ey%5D%29%29%29%29.%2A%7C%29-%28.%2A%29%22%2Cnamespace%3D%22%25%7Bkube_namespace%7D%22%7D%29+by+%28job%29%29+without+%28job%29+%2F+count%28avg%28container_memory_usage_bytes%7Bcontainer_name%21%3D%22POD%22%2Cpod_name%3D~%22%5E%25%7Bci_environment_slug%7D-%28%5B%5Ec%5D.%2A%7Cc%28%5B%5Ea%5D%7Ca%28%5B%5En%5D%7Cn%28%5B%5Ea%5D%7Ca%28%5B%5Er%5D%7Cr%5B%5Ey%5D%29%29%29%29.%2A%7C%29-%28.%2A%29%22%2Cnamespace%3D%22%25%7Bkube_namespace%7D%22%7D%29+without+%28job%29%29+%2F1024%2F1024' ,
metric _id : 'undefined_metric_of_ages_1000' ,
metricId : 'undefined_metric_of_ages_1000' ,
result : [
{
metric : { } ,
values : [
[ '2020-01-30 12:00:00' , '20' ] ,
[ '2020-01-30 12:01:00' , '25' ] ,
[ '2020-01-30 12:02:00' , '30' ] ,
] ,
} ,
] ,
} ,
] ,
} ;