Update logic of handling no label prometheus query result, and update nuxt version

This commit is contained in:
2022-04-01 23:49:19 +11:00
parent d53bb89620
commit 3efde77bf2
5 changed files with 23023 additions and 98 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
FROM golang:1.14-alpine AS build
FROM golang:1.17-alpine AS build
RUN apk add --no-cache git openssh
+1 -1
View File
@@ -1,6 +1,6 @@
module github.com/wahyd4/badger
go 1.14
go 1.17
require (
github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca
+8
View File
@@ -293,6 +293,10 @@ func (handler *BadgesHandler) generateSVG(c *gin.Context, colorScheme ColorSchem
if len(label) <= 10 {
labelContainerWidth = 74
} else if len(label) >= 20 && len(label) < 25 {
labelContainerWidth = 150
} else if len(label) >= 25 {
labelContainerWidth = 174
}
if metricValue > 10000 && metricValue < 1000000 {
@@ -515,6 +519,10 @@ func (handler *BadgesHandler) queryPrometheus(badge *models.Badge, options *mode
Time: v.Timestamp.Time(),
}
}
// handle label is empty, then use badge label from database
if len(metric.Label) == 0 {
metric.Label = badge.Label
}
handler.DB.Save(&models.ViewRecord{ULID: badge.ULID})
return &metric, nil
}
+23012 -95
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -11,7 +11,7 @@
},
"dependencies": {
"@nuxt/typescript-runtime": "^1.0.0",
"@nuxtjs/auth-next": "5.0.0-1611574754.9020f2a",
"@nuxtjs/auth-next": "5.0.0-1643791578.532b3d6",
"@nuxtjs/axios": "^5.12.5",
"@nuxtjs/pwa": "^3.0.0-beta.20",
"bootstrap": "^4.6.0",