debian-mirror-gitlab/app/assets/javascripts/monitoring/constants.js

126 lines
2.3 KiB
JavaScript
Raw Normal View History

2019-07-07 11:18:12 +05:30
import { __ } from '~/locale';
2020-01-01 13:55:28 +05:30
export const PROMETHEUS_TIMEOUT = 120000; // TWO_MINUTES
/**
* States and error states in Prometheus Queries (PromQL) for metrics
*/
export const metricStates = {
/**
* Metric data is available
*/
OK: 'OK',
/**
* Metric data is being fetched
*/
LOADING: 'LOADING',
/**
* Connection timed out to prometheus server
* the timeout is set to PROMETHEUS_TIMEOUT
*
*/
TIMEOUT: 'TIMEOUT',
/**
* The prometheus server replies with an empty data set
*/
NO_DATA: 'NO_DATA',
/**
* The prometheus server cannot be reached
*/
CONNECTION_FAILED: 'CONNECTION_FAILED',
/**
* The prometheus server was reached but it cannot process
* the query. This can happen for several reasons:
* - PromQL syntax is incorrect
* - An operator is not supported
*/
BAD_QUERY: 'BAD_QUERY',
/**
* No specific reason found for error
*/
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
};
2019-10-12 21:52:04 +05:30
export const sidebarAnimationDuration = 300; // milliseconds.
2019-07-07 11:18:12 +05:30
export const chartHeight = 300;
export const graphTypes = {
deploymentData: 'scatter',
};
2019-12-04 20:38:33 +05:30
export const symbolSizes = {
2019-12-26 22:10:19 +05:30
anomaly: 8,
2019-12-04 20:38:33 +05:30
default: 14,
};
2019-12-26 22:10:19 +05:30
export const areaOpacityValues = {
default: 0.2,
};
export const colorValues = {
primaryColor: '#1f78d1', // $blue-500 (see variables.scss)
anomalySymbol: '#db3b21',
anomalyAreaColor: '#1f78d1',
};
2020-03-13 15:44:24 +05:30
export const chartColorValues = [
'#1f78d1', // $blue-500 (see variables.scss)
'#1aaa55', // $green-500
'#fc9403', // $orange-500
'#6d49cb', // $purple
];
2019-07-07 11:18:12 +05:30
export const lineTypes = {
default: 'solid',
};
2019-12-26 22:10:19 +05:30
export const lineWidths = {
default: 2,
};
2019-12-04 20:38:33 +05:30
export const dateFormats = {
timeOfDay: 'h:MM TT',
default: 'dd mmm yyyy, h:MMTT',
};
2020-03-13 15:44:24 +05:30
export const timeRanges = [
{
label: __('30 minutes'),
duration: { seconds: 60 * 30 },
},
{
label: __('3 hours'),
duration: { seconds: 60 * 60 * 3 },
},
{
label: __('8 hours'),
duration: { seconds: 60 * 60 * 8 },
default: true,
},
{
label: __('1 day'),
duration: { seconds: 60 * 60 * 24 * 1 },
},
{
label: __('3 days'),
duration: { seconds: 60 * 60 * 24 * 3 },
},
{
label: __('1 week'),
duration: { seconds: 60 * 60 * 24 * 7 * 1 },
},
{
label: __('1 month'),
duration: { seconds: 60 * 60 * 24 * 30 },
},
];
2019-10-12 21:52:04 +05:30
2020-03-13 15:44:24 +05:30
export const defaultTimeRange = timeRanges.find(tr => tr.default);