Skip to content

Commit 91a06df

Browse files
authored
Improve shutdown time in the first 30 seconds (#5725)
* Improve shutdown time in the first 30 seconds Trying to shutdown (SIGINT) tempo in the first 30 seconds would block until we got a stable key which currently takes 30 seconds. This unblock that. * Updated changelog
1 parent a953921 commit 91a06df

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* [ENHANCEMENT] Add endpoints for partition downscaling for live-store [#5600](https://github.com/grafana/tempo/pull/5600) [#5738](https://github.com/grafana/tempo/pull/5738) (@ruslan-mikhailov, @mapno)
88
* [ENHANCEMENT] Add config to enable instance label for spanmetrics series [#5706](https://github.com/grafana/tempo/pull/5706) (@ie-pham)
99
* [ENHANCEMENT] Unsafe search hints for frontend performance tests [#5723](https://github.com/grafana/tempo/pull/5723) (@ruslan-mikhailov)
10+
* [ENHANCEMENT] Improve shutdown time in the first 30 seconds [#5725](https://github.com/grafana/tempo/pull/5725) (@ldufr)
1011
* [FEATURE] Add `tempo_metrics_generator_registry_active_series_demand_estimate` that estimates metrics-generator active series demand even when the active series limit is reached [#5710](https://github.com/grafana/tempo/pull/5710) (@carles-grafana)
1112
* [BUGFIX] Fix issues related to integer dedicated columns in vParquet5-preview2 [#5716](https://github.com/grafana/tempo/pull/5716) (@stoewer)
1213
* [FEATURE] Added validation mode and tests for tempo-vulture [#5605](https://github.com/grafana/tempo/pull/5605)

pkg/usagestats/reporter.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ func (rep *Reporter) initLeader(ctx context.Context) *ClusterSeed {
102102
}
103103
// ensure stability of the cluster seed
104104
stableSeed := ensureStableKey(ctx, kvClient, rep.logger)
105+
if stableSeed == nil {
106+
return nil
107+
}
108+
105109
seed = *stableSeed
106110
// Fetch the remote cluster seed.
107111
remoteSeed, err := rep.fetchSeed(ctx,
@@ -136,7 +140,12 @@ func ensureStableKey(ctx context.Context, kvClient kv.Client, logger log.Logger)
136140
stableCount int
137141
)
138142
for {
139-
time.Sleep(stabilityCheckInterval)
143+
select {
144+
case <-time.After(stabilityCheckInterval):
145+
case <-ctx.Done():
146+
return nil
147+
}
148+
140149
value, err := kvClient.Get(ctx, seedKey)
141150
if err != nil {
142151
level.Debug(logger).Log("msg", "failed to get cluster seed key for stability check", "err", err)

0 commit comments

Comments
 (0)