NEZ-1332 feat: alert message 查看请求参数调整(metrics,logs)
This commit is contained in:
@@ -264,8 +264,7 @@ export default {
|
||||
if (this.$refs.messageChart) {
|
||||
this.$refs.messageChart.startLoading()
|
||||
const axiosArr = []
|
||||
const paramStr = JSON.stringify(this.promQueryParamConvert(this.currentMsg))
|
||||
axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + paramStr.substring(1, paramStr.length - 1) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step))
|
||||
axiosArr.push(axios.get('/prom/api/v1/query_range?query=' + escape(this.currentMsg.alertRule.expr.replace(/\s+/g, '')) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&step=' + step + '&filter=' + escape(unescape(this.promQueryParamLabels(this.currentMsg.labels)))))
|
||||
this.legend = []
|
||||
this.chartDatas = []
|
||||
axios.all(axiosArr).then(res => {
|
||||
@@ -458,6 +457,14 @@ export default {
|
||||
}
|
||||
return r
|
||||
},
|
||||
promQueryParamLabels (labels) {
|
||||
const obj = JSON.parse(labels)
|
||||
const filterArr = ['alertname', 'severity_id', 'severity', 'rule_type']
|
||||
filterArr.forEach(key => {
|
||||
delete obj[key]
|
||||
})
|
||||
return JSON.stringify(obj)
|
||||
},
|
||||
// asset弹框控制
|
||||
tabControl (data) {
|
||||
if (data === 'close') {
|
||||
@@ -731,7 +738,7 @@ export default {
|
||||
const start = this.searchTime[0] ? this.searchTime[0] : getTime(-1, 'h')
|
||||
const end = this.searchTime[1] ? this.searchTime[1] : getTime(0, 'h')
|
||||
this.expressions = [this.currentMsg.alertRule.expr]
|
||||
this.$get('/logs/loki/api/v1/query_range?format=1&query=' + this.currentMsg.alertRule.expr + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&limit=' + limit).then(res => {
|
||||
this.$get('/logs/loki/api/v1/query_range?format=1&query=' + escape(this.currentMsg.alertRule.expr) + '&start=' + this.$stringTimeParseToUnix(start) + '&end=' + this.$stringTimeParseToUnix(end) + '&limit=' + limit + '&filter=' + escape(unescape(this.promQueryParamLabels(this.currentMsg.labels)))).then(res => {
|
||||
this.chartLoading = false
|
||||
const logData = [res.data]
|
||||
this.resultType = res.data.resultType
|
||||
|
||||
Reference in New Issue
Block a user