Skip to content

Commit 2aee205

Browse files
committed
Preserve existing behaviour
Signed-off-by: Kemal Akkoyun <[email protected]>
1 parent f707c11 commit 2aee205

File tree

8 files changed

+31
-1
lines changed

8 files changed

+31
-1
lines changed

cmd/thanos/bucket.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,16 @@ func registerBucketWeb(m map[string]setupFunc, root *kingpin.CmdClause, name str
345345
cancel()
346346
})
347347

348-
g.Add(srv.ListenAndServe, srv.Shutdown)
348+
g.Add(func() error {
349+
statusProber.Healthy()
350+
351+
return srv.ListenAndServe()
352+
}, func(err error) {
353+
statusProber.NotReady(err)
354+
defer statusProber.NotHealthy(err)
355+
356+
srv.Shutdown(err)
357+
})
349358

350359
return nil
351360
}

cmd/thanos/compact.go

+3
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,12 @@ func runCompact(
184184

185185
g.Add(func() error {
186186
statusProber.Healthy()
187+
187188
return srv.ListenAndServe()
188189
}, func(err error) {
189190
statusProber.NotReady(err)
191+
defer statusProber.NotHealthy(err)
192+
190193
srv.Shutdown(err)
191194
})
192195

cmd/thanos/downsample.go

+3
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,12 @@ func runDownsample(
130130
)
131131
g.Add(func() error {
132132
statusProber.Healthy()
133+
133134
return srv.ListenAndServe()
134135
}, func(err error) {
135136
statusProber.NotReady(err)
137+
defer statusProber.NotHealthy(err)
138+
136139
srv.Shutdown(err)
137140
})
138141

cmd/thanos/query.go

+3
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,12 @@ func runQuery(
390390

391391
g.Add(func() error {
392392
statusProber.Healthy()
393+
393394
return srv.ListenAndServe()
394395
}, func(err error) {
395396
statusProber.NotReady(err)
397+
defer statusProber.NotHealthy(err)
398+
396399
srv.Shutdown(err)
397400
})
398401
}

cmd/thanos/receive.go

+3
Original file line numberDiff line numberDiff line change
@@ -345,9 +345,12 @@ func runReceive(
345345
)
346346
g.Add(func() error {
347347
statusProber.Healthy()
348+
348349
return srv.ListenAndServe()
349350
}, func(err error) {
350351
statusProber.NotReady(err)
352+
defer statusProber.NotHealthy(err)
353+
351354
srv.Shutdown(err)
352355
})
353356

cmd/thanos/rule.go

+3
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,12 @@ func runRule(
562562

563563
g.Add(func() error {
564564
statusProber.Healthy()
565+
565566
return srv.ListenAndServe()
566567
}, func(err error) {
567568
statusProber.NotReady(err)
569+
defer statusProber.NotHealthy(err)
570+
568571
srv.Shutdown(err)
569572
})
570573
}

cmd/thanos/sidecar.go

+3
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,12 @@ func runSidecar(
148148

149149
g.Add(func() error {
150150
statusProber.Healthy()
151+
151152
return srv.ListenAndServe()
152153
}, func(err error) {
153154
statusProber.NotReady(err)
155+
defer statusProber.NotHealthy(err)
156+
154157
srv.Shutdown(err)
155158
})
156159

cmd/thanos/store.go

+3
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,12 @@ func runStore(
140140

141141
g.Add(func() error {
142142
statusProber.Healthy()
143+
143144
return srv.ListenAndServe()
144145
}, func(err error) {
145146
statusProber.NotReady(err)
147+
defer statusProber.NotHealthy(err)
148+
146149
srv.Shutdown(err)
147150
})
148151

0 commit comments

Comments
 (0)