summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/monitoring/stores/utils.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/monitoring/stores/utils.js')
-rw-r--r--app/assets/javascripts/monitoring/stores/utils.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/app/assets/javascripts/monitoring/stores/utils.js b/app/assets/javascripts/monitoring/stores/utils.js
index a47e5f598f5..b6817e7279a 100644
--- a/app/assets/javascripts/monitoring/stores/utils.js
+++ b/app/assets/javascripts/monitoring/stores/utils.js
@@ -229,3 +229,19 @@ export const normalizeQueryResult = timeSeries => {
return normalizedResult;
};
+
+/**
+ * Custom variables defined in the dashboard yml file are
+ * eventually passed over the wire to the backend Prometheus
+ * API proxy.
+ *
+ * This method adds a prefix to the URL param keys so that
+ * the backend can differential these variables from the other
+ * variables.
+ *
+ * This is currently only used by getters/getCustomVariablesParams
+ *
+ * @param {String} key Variable key that needs to be prefixed
+ * @returns {String}
+ */
+export const addPrefixToCustomVariableParams = key => `variables[${key}]`;