2019-12-13 12:07:41 +00:00
|
|
|
export const PROMETHEUS_TIMEOUT = 120000; // TWO_MINUTES
|
|
|
|
|
2020-07-09 12:08:56 +00:00
|
|
|
export const dashboardEmptyStates = {
|
|
|
|
GETTING_STARTED: 'gettingStarted',
|
|
|
|
LOADING: 'loading',
|
|
|
|
NO_DATA: 'noData',
|
|
|
|
UNABLE_TO_CONNECT: 'unableToConnect',
|
|
|
|
};
|
|
|
|
|
2019-12-13 12:07:41 +00:00
|
|
|
/**
|
2019-12-17 15:08:15 +00:00
|
|
|
* States and error states in Prometheus Queries (PromQL) for metrics
|
2019-12-13 12:07:41 +00:00
|
|
|
*/
|
2019-12-17 15:08:15 +00:00
|
|
|
export const metricStates = {
|
|
|
|
/**
|
|
|
|
* Metric data is available
|
|
|
|
*/
|
|
|
|
OK: 'OK',
|
|
|
|
|
|
|
|
/**
|
2020-04-14 12:09:26 +00:00
|
|
|
* Metric data is being fetched for the first time.
|
|
|
|
*
|
|
|
|
* Not used during data refresh, if data is available in
|
|
|
|
* the metric, the recommneded state is OK.
|
2019-12-17 15:08:15 +00:00
|
|
|
*/
|
|
|
|
LOADING: 'LOADING',
|
|
|
|
|
2019-12-13 12:07:41 +00:00
|
|
|
/**
|
|
|
|
* 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',
|
|
|
|
|
|
|
|
/**
|
2019-12-17 15:08:15 +00:00
|
|
|
* The prometheus server was reached but it cannot process
|
2019-12-13 12:07:41 +00:00
|
|
|
* the query. This can happen for several reasons:
|
|
|
|
* - PromQL syntax is incorrect
|
|
|
|
* - An operator is not supported
|
|
|
|
*/
|
2019-12-17 15:08:15 +00:00
|
|
|
BAD_QUERY: 'BAD_QUERY',
|
2019-12-13 12:07:41 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* No specific reason found for error
|
|
|
|
*/
|
|
|
|
UNKNOWN_ERROR: 'UNKNOWN_ERROR',
|
|
|
|
};
|
|
|
|
|
2020-04-21 15:21:10 +00:00
|
|
|
/**
|
|
|
|
* Supported panel types in dashboards, values of `panel.type`.
|
|
|
|
*
|
|
|
|
* Values should not be changed as they correspond to
|
|
|
|
* values in users the `.yml` dashboard definition.
|
|
|
|
*/
|
|
|
|
export const panelTypes = {
|
|
|
|
/**
|
|
|
|
* Area Chart
|
|
|
|
*
|
|
|
|
* Time Series chart with an area
|
|
|
|
*/
|
|
|
|
AREA_CHART: 'area-chart',
|
|
|
|
/**
|
|
|
|
* Line Chart
|
|
|
|
*
|
|
|
|
* Time Series chart with a line
|
|
|
|
*/
|
|
|
|
LINE_CHART: 'line-chart',
|
|
|
|
/**
|
|
|
|
* Anomaly Chart
|
|
|
|
*
|
|
|
|
* Time Series chart with 3 metrics
|
|
|
|
*/
|
|
|
|
ANOMALY_CHART: 'anomaly-chart',
|
|
|
|
/**
|
|
|
|
* Single Stat
|
|
|
|
*
|
|
|
|
* Single data point visualization
|
|
|
|
*/
|
|
|
|
SINGLE_STAT: 'single-stat',
|
2020-08-06 21:10:15 +00:00
|
|
|
/**
|
|
|
|
* Gauge
|
|
|
|
*/
|
2020-08-11 18:10:06 +00:00
|
|
|
GAUGE_CHART: 'gauge',
|
2020-04-21 15:21:10 +00:00
|
|
|
/**
|
|
|
|
* Heatmap
|
|
|
|
*/
|
|
|
|
HEATMAP: 'heatmap',
|
|
|
|
/**
|
|
|
|
* Bar chart
|
|
|
|
*/
|
|
|
|
BAR: 'bar',
|
|
|
|
/**
|
|
|
|
* Column chart
|
|
|
|
*/
|
|
|
|
COLUMN: 'column',
|
|
|
|
/**
|
|
|
|
* Stacked column chart
|
|
|
|
*/
|
|
|
|
STACKED_COLUMN: 'stacked-column',
|
|
|
|
};
|
|
|
|
|
2019-07-22 12:01:42 +00:00
|
|
|
export const sidebarAnimationDuration = 300; // milliseconds.
|
2019-03-07 09:39:45 +00:00
|
|
|
export const chartHeight = 300;
|
|
|
|
|
|
|
|
export const graphTypes = {
|
2020-04-05 00:09:22 +00:00
|
|
|
annotationsData: 'scatter',
|
2019-03-07 09:39:45 +00:00
|
|
|
};
|
|
|
|
|
2019-08-21 13:43:01 +00:00
|
|
|
export const symbolSizes = {
|
2019-10-30 15:14:17 +00:00
|
|
|
anomaly: 8,
|
2019-08-21 13:43:01 +00:00
|
|
|
default: 14,
|
|
|
|
};
|
|
|
|
|
2019-10-30 15:14:17 +00:00
|
|
|
export const areaOpacityValues = {
|
|
|
|
default: 0.2,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const colorValues = {
|
|
|
|
primaryColor: '#1f78d1', // $blue-500 (see variables.scss)
|
|
|
|
anomalySymbol: '#db3b21',
|
|
|
|
anomalyAreaColor: '#1f78d1',
|
|
|
|
};
|
|
|
|
|
2019-03-07 09:39:45 +00:00
|
|
|
export const lineTypes = {
|
|
|
|
default: 'solid',
|
|
|
|
};
|
2019-03-12 18:55:43 +00:00
|
|
|
|
2019-10-30 15:14:17 +00:00
|
|
|
export const lineWidths = {
|
|
|
|
default: 2,
|
|
|
|
};
|
|
|
|
|
2020-06-10 09:08:35 +00:00
|
|
|
/**
|
|
|
|
* User-defined links can be passed in dashboard yml file.
|
|
|
|
* These are the supported type of links.
|
|
|
|
*/
|
|
|
|
export const linkTypes = {
|
|
|
|
GRAFANA: 'grafana',
|
|
|
|
};
|
|
|
|
|
2020-06-16 18:09:01 +00:00
|
|
|
/**
|
|
|
|
* These are the supported values for the GitLab-UI
|
|
|
|
* chart legend layout.
|
|
|
|
*
|
|
|
|
* Currently defined in
|
2021-02-05 18:09:44 +00:00
|
|
|
* https://gitlab.com/gitlab-org/gitlab-ui/-/blob/main/src/utils/charts/constants.js
|
2020-06-16 18:09:01 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
export const legendLayoutTypes = {
|
|
|
|
inline: 'inline',
|
|
|
|
table: 'table',
|
|
|
|
};
|
|
|
|
|
2020-04-01 21:07:56 +00:00
|
|
|
/**
|
|
|
|
* These Vuex store properties are allowed to be
|
|
|
|
* replaced dynamically after component has been created
|
|
|
|
* and initial state has been set.
|
|
|
|
*
|
|
|
|
* Currently used in `receiveMetricsDashboardSuccess` action.
|
|
|
|
*/
|
|
|
|
export const endpointKeys = [
|
|
|
|
'deploymentsEndpoint',
|
|
|
|
'dashboardEndpoint',
|
|
|
|
'dashboardsEndpoint',
|
|
|
|
'currentDashboard',
|
|
|
|
'projectPath',
|
|
|
|
'logsPath',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* These Vuex store properties are set as soon as the
|
|
|
|
* dashboard component has been created. The values are
|
|
|
|
* passed as data-* attributes and received by dashboard
|
|
|
|
* as Vue props.
|
|
|
|
*/
|
|
|
|
export const initialStateKeys = [...endpointKeys, 'currentEnvironmentName'];
|
2020-04-02 21:07:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constant to indicate if a metric exists in the database
|
|
|
|
*/
|
|
|
|
export const NOT_IN_DB_PREFIX = 'NO_DB';
|
2020-04-08 21:09:50 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* graphQL environments API value for active environments.
|
|
|
|
* Used as a value for the 'states' query filter
|
|
|
|
*/
|
|
|
|
export const ENVIRONMENT_AVAILABLE_STATE = 'available';
|
2020-04-09 09:10:17 +00:00
|
|
|
|
|
|
|
/**
|
2020-04-21 15:21:10 +00:00
|
|
|
* As of %12.10, the svg icon library does not have an annotation
|
|
|
|
* arrow icon yet. In order to deliver annotations feature, the icon
|
|
|
|
* is hard coded until the icon is added. The below issue is
|
|
|
|
* to track the icon.
|
|
|
|
*
|
|
|
|
* https://gitlab.com/gitlab-org/gitlab-svgs/-/issues/118
|
|
|
|
*
|
|
|
|
* Once the icon is merged this can be removed.
|
|
|
|
* https://gitlab.com/gitlab-org/gitlab/-/issues/214540
|
|
|
|
*/
|
|
|
|
export const annotationsSymbolIcon = 'path://m5 229 5 8h-10z';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* As of %12.10, dashboard path is required to create annotation.
|
|
|
|
* The FE gets the dashboard name from the URL params. It is not
|
|
|
|
* ideal to store the path this way but there is no other way to
|
|
|
|
* get this path unless annotations fetch is delayed. This could
|
|
|
|
* potentially be removed and have the backend send this to the FE.
|
|
|
|
*
|
|
|
|
* This technical debt is being tracked here
|
|
|
|
* https://gitlab.com/gitlab-org/gitlab/-/issues/214671
|
2020-04-09 09:10:17 +00:00
|
|
|
*/
|
2020-07-30 21:09:35 +00:00
|
|
|
export const OVERVIEW_DASHBOARD_PATH = 'config/prometheus/common_metrics.yml';
|
2020-04-21 15:21:10 +00:00
|
|
|
|
2020-06-30 12:08:57 +00:00
|
|
|
/**
|
|
|
|
* GitLab provide metrics dashboards that are available to a user once
|
|
|
|
* the Prometheus managed app has been installed, without any extra setup
|
|
|
|
* required. These "out of the box" dashboards are defined under the
|
|
|
|
* `config/prometheus` path.
|
|
|
|
*/
|
|
|
|
export const OUT_OF_THE_BOX_DASHBOARDS_PATH_PREFIX = 'config/prometheus/';
|
|
|
|
|
2020-04-21 15:21:10 +00:00
|
|
|
export const OPERATORS = {
|
|
|
|
greaterThan: '>',
|
|
|
|
equalTo: '==',
|
|
|
|
lessThan: '<',
|
2020-04-09 09:10:17 +00:00
|
|
|
};
|
2020-05-08 12:09:37 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Dashboard yml files support custom user-defined variables that
|
|
|
|
* are rendered as input elements in the monitoring dashboard.
|
|
|
|
* These values can be edited by the user and are passed on to the
|
|
|
|
* the backend and eventually to Prometheus API proxy.
|
|
|
|
*
|
|
|
|
* As of 13.0, the supported types are:
|
|
|
|
* simple custom -> dropdown elements
|
|
|
|
* advanced custom -> dropdown elements
|
|
|
|
* text -> text input elements
|
|
|
|
*
|
|
|
|
* Custom variables have a simple and a advanced variant.
|
|
|
|
*/
|
|
|
|
export const VARIABLE_TYPES = {
|
|
|
|
custom: 'custom',
|
|
|
|
text: 'text',
|
2020-06-24 03:08:44 +00:00
|
|
|
metric_label_values: 'metric_label_values',
|
2020-05-08 12:09:37 +00:00
|
|
|
};
|
2020-05-13 15:08:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The names of templating variables defined in the dashboard yml
|
|
|
|
* file are prefixed with a constant so that it doesn't collide with
|
|
|
|
* other URL params that the monitoring dashboard relies on for
|
|
|
|
* features like panel fullscreen etc.
|
|
|
|
*
|
|
|
|
* The prefix is added before it is appended to the URL and removed
|
|
|
|
* before passing the data to the backend.
|
|
|
|
*/
|
|
|
|
export const VARIABLE_PREFIX = 'var-';
|
2020-07-06 12:09:00 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* All of the actions inside each panel dropdown can be accessed
|
|
|
|
* via keyboard shortcuts than can be activated via mouse hovers
|
|
|
|
* and or focus via tabs.
|
|
|
|
*/
|
|
|
|
|
|
|
|
export const keyboardShortcutKeys = {
|
|
|
|
EXPAND: 'e',
|
|
|
|
VISIT_LOGS: 'l',
|
|
|
|
SHOW_ALERT: 'a',
|
|
|
|
DOWNLOAD_CSV: 'd',
|
|
|
|
CHART_COPY: 'c',
|
|
|
|
};
|
2020-08-06 21:10:15 +00:00
|
|
|
|
|
|
|
export const thresholdModeTypes = {
|
|
|
|
ABSOLUTE: 'absolute',
|
|
|
|
PERCENTAGE: 'percentage',
|
|
|
|
};
|