File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ RUN GOVERSION=$(egrep "^toolchain " go.mod | awk -Fgo '{print $2}') && \
13
13
14
14
RUN go mod download
15
15
16
- RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./out/trawler .
16
+ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o ./out/trawler -ldflags= "-X 'main.Version=$(git describe --tags)' -X 'main.BuildTime=$(date +%Y%m%dT%H%M)'" .
17
17
RUN dnf install ca-certificates --assumeyes
18
18
RUN groupadd -r app && useradd -r -g app app
19
19
Original file line number Diff line number Diff line change @@ -25,12 +25,14 @@ import (
25
25
)
26
26
27
27
var (
28
- promCounter = promauto .NewCounterVec (
29
- prometheus.CounterOpts {
30
- Name : "myapp_processed_ops_total " ,
31
- Help : "The total number of processed events " ,
28
+ promInfo = promauto .NewGaugeVec (
29
+ prometheus.GaugeOpts {
30
+ Name : "trawler_version_info " ,
31
+ Help : "Trawler version and build info " ,
32
32
},
33
- []string {"collector" })
33
+ []string {"version" , "buildTime" })
34
+ Version = "development"
35
+ BuildTime = ""
34
36
)
35
37
36
38
var log = alog .UseChannel ("trawler" )
@@ -129,6 +131,7 @@ func main() {
129
131
log .Log (alog .WARNING , "Error loading logging config from flags: " , err .Error ())
130
132
}
131
133
134
+ promInfo .WithLabelValues (Version , BuildTime ).Set (1 )
132
135
// Initialise appropriate nets...
133
136
if config .Nets .APIConnect .Enabled {
134
137
a := apiconnect.APIConnect {}
You can’t perform that action at this time.
0 commit comments