diff --git a/CHANGELOG.md b/CHANGELOG.md index facb029812843..2ed2fef0f6416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * [10395](https://github.com/grafana/loki/pull/10395/) **shantanualshi** Remove deprecated `split_queries_by_interval` and `forward_headers_list` configuration options in the `query_range` section * [10456](https://github.com/grafana/loki/pull/10456) **dannykopping** Add `loki_distributor_ingester_append_timeouts_total` metric, remove `loki_distributor_ingester_append_failures_total` metric * [10534](https://github.com/grafana/loki/pull/10534) **chaudum** Remove configuration `use_boltdb_shipper_as_backup` +* [10655](https://github.com/grafana/loki/pull/10655) **chaudum** Remove legacy ingester shutdown handler `/ingester/flush_shutdown`. ##### Fixes diff --git a/docs/sources/reference/api.md b/docs/sources/reference/api.md index bd644df66fcbb..12233fc8ee196 100644 --- a/docs/sources/reference/api.md +++ b/docs/sources/reference/api.md @@ -55,7 +55,6 @@ These endpoints are exposed by the ingester: - [`POST /flush`](#flush-in-memory-chunks-to-backing-store) - [`POST /ingester/shutdown`](#flush-in-memory-chunks-and-shut-down) -- **Deprecated** [`POST /ingester/flush_shutdown`](#post-ingesterflush_shutdown) The API endpoints starting with `/loki/` are [Prometheus API-compatible](https://prometheus.io/docs/prometheus/latest/querying/api/) and the result formats can be used interchangeably. @@ -1470,14 +1469,3 @@ In microservices mode, `/api/prom/push` is exposed by the distributor. $ curl -H "Content-Type: application/json" -XPOST -s "https://localhost:3100/api/prom/push" --data-raw \ '{"streams": [{ "labels": "{foo=\"bar\"}", "entries": [{ "ts": "2018-12-18T08:28:06.801064-04:00", "line": "fizzbuzz" }] }]}' ``` - -### `POST /ingester/flush_shutdown` - -> **WARNING**: `/ingester/flush_shutdown` is DEPRECATED; use `/ingester/shutdown?flush=true` -> instead. - -`/ingester/flush_shutdown` triggers a shutdown of the ingester and notably will _always_ flush any in memory chunks it holds. -This is helpful for scaling down WAL-enabled ingesters where we want to ensure old WAL directories are not orphaned, -but instead flushed to our chunk backend. - -In microservices mode, the `/ingester/flush_shutdown` endpoint is exposed by the ingester. diff --git a/docs/sources/setup/upgrade/_index.md b/docs/sources/setup/upgrade/_index.md index 1f3abeae307fd..5a0a0dcd7e3ef 100644 --- a/docs/sources/setup/upgrade/_index.md +++ b/docs/sources/setup/upgrade/_index.md @@ -55,6 +55,10 @@ The previous default value `false` is applied. 6. `split_queries_by_interval` is removed from `query_range` YAML section. You can instead configure it in [Limits Config](/docs/loki/latest/configuration/#limits_config). 7. `frontend.forward-headers-list` CLI flag and its corresponding YAML setting are removed. +#### Legacy ingester shutdown handler is removed + +The already deprecated handler `/ingester/flush_shutdown` is removed in favor of `/ingester/shutdown?flush=true`. + #### Distributor metric changes The `loki_distributor_ingester_append_failures_total` metric has been removed in favour of `loki_distributor_ingester_append_timeouts_total`. diff --git a/pkg/ingester/ingester.go b/pkg/ingester/ingester.go index 1f0e870352c6b..f50051c47763a 100644 --- a/pkg/ingester/ingester.go +++ b/pkg/ingester/ingester.go @@ -188,8 +188,6 @@ type Interface interface { CheckReady(ctx context.Context) error FlushHandler(w http.ResponseWriter, _ *http.Request) GetOrCreateInstance(instanceID string) (*instance, error) - // deprecated - LegacyShutdownHandler(w http.ResponseWriter, r *http.Request) ShutdownHandler(w http.ResponseWriter, r *http.Request) PrepareShutdown(w http.ResponseWriter, r *http.Request) } @@ -612,25 +610,6 @@ func (i *Ingester) loop() { } } -// LegacyShutdownHandler triggers the following set of operations in order: -// - Change the state of ring to stop accepting writes. -// - Flush all the chunks. -// -// Note: This handler does not trigger a termination of the Loki process, -// despite its name. Instead, the ingester service is stopped, so an external -// source can trigger a safe termination through a signal to the process. -// The handler is deprecated and usage is discouraged. Use ShutdownHandler -// instead. -func (i *Ingester) LegacyShutdownHandler(w http.ResponseWriter, _ *http.Request) { - level.Warn(util_log.Logger).Log("msg", "The handler /ingester/flush_shutdown is deprecated and usage is discouraged. Please use /ingester/shutdown?flush=true instead.") - originalState := i.lifecycler.FlushOnShutdown() - // We want to flush the chunks if transfer fails irrespective of original flag. - i.lifecycler.SetFlushOnShutdown(true) - _ = services.StopAndAwaitTerminated(context.Background(), i) - i.lifecycler.SetFlushOnShutdown(originalState) - w.WriteHeader(http.StatusNoContent) -} - // PrepareShutdown will handle the /ingester/prepare_shutdown endpoint. // // Internally, when triggered, this handler will configure the ingester service to release their resources whenever a SIGTERM is received. diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index 1ebda261abe65..232a2c923e042 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -506,9 +506,6 @@ func (t *Loki) initIngester() (_ services.Service, err error) { t.Server.HTTP.Methods("GET", "POST").Path("/flush").Handler( httpMiddleware.Wrap(http.HandlerFunc(t.Ingester.FlushHandler)), ) - t.Server.HTTP.Methods("POST").Path("/ingester/flush_shutdown").Handler( - httpMiddleware.Wrap(http.HandlerFunc(t.Ingester.LegacyShutdownHandler)), - ) t.Server.HTTP.Methods("POST", "GET", "DELETE").Path("/ingester/prepare_shutdown").Handler( httpMiddleware.Wrap(http.HandlerFunc(t.Ingester.PrepareShutdown)), )