Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loki: Revert distributor defaulting to inmemory #4638

Merged
merged 1 commit into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
## Main
* [4400](https://github.com/grafana/loki/pull/4400) **trevorwhitney**: Config: automatically apply memberlist config too all rings when provided
* [4435](https://github.com/grafana/loki/pull/4435) **trevorwhitney**: Change default values for two GRPC settings so querier can connect to frontend/scheduler
* [4440](https://github.com/grafana/loki/pull/4440) **DylanGuedes**: Config: Override distributor's default ring KV store
* [4443](https://github.com/grafana/loki/pull/4443) **DylanGuedes**: Loki: Change how push API checks for contentType
* [4415](https://github.com/grafana/loki/pull/4415) **DylanGuedes**: Change default limits to common values
* [4473](https://github.com/grafana/loki/pull/4473) **trevorwhitney**: Config: add object storage configuration to common config
Expand Down
15 changes: 0 additions & 15 deletions docs/sources/upgrading/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,6 @@ ingester:
enabled: true
```

#### Distributor now stores ring in memory by default instead of Consul

PR [4440](https://github.com/grafana/loki/pull/4440) **DylanGuedes**: Config: Override distributor's default ring KV store

This change sets `inmemory` as the new default storage for the Distributor ring (previously `consul`).
The motivation is making the Distributor easier to run with default configs, by not requiring Consul anymore.
In any case, if you prefer to use Consul as the ring storage, you can set it by using the following config:

```yaml
distributor:
ring:
kvstore:
store: consul
```

#### Memberlist config now automatically applies to all non-configured rings
PR [4400](https://github.com/grafana/loki/pull/4400) **trevorwhitney**: Config: automatically apply memberlist config too all rings when provided

Expand Down
19 changes: 1 addition & 18 deletions pkg/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,8 @@ type Config struct {
}

// RegisterFlags registers distributor-related flags.
//
// Since they are registered through an external library, we override some of them to set
// different default values.
func (cfg *Config) RegisterFlags(fs *flag.FlagSet) {
throwaway := flag.NewFlagSet("throwaway", flag.PanicOnError)

cfg.DistributorRing.RegisterFlags(throwaway)

// Register to throwaway flags first. Default values are remembered during registration and cannot be changed,
// but we can take values from throwaway flag set and reregister into supplied flags with new default values.
throwaway.VisitAll(func(f *flag.Flag) {
// Ignore errors when setting new values. We have a test to verify that it works.
switch f.Name {
case "distributor.ring.store":
_ = f.Value.Set("inmemory")
}

fs.Var(f.Value, f.Name, f.Usage)
})
cfg.DistributorRing.RegisterFlags(fs)
}

// Distributor coordinates replicates and distribution of log streams.
Expand Down
7 changes: 1 addition & 6 deletions pkg/loki/loki_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,7 @@ func TestFlagDefaults(t *testing.T) {
gotFlags[splittedLine] = nextLine
}

flagToCheck := "-distributor.ring.store"
require.Contains(t, gotFlags, flagToCheck)
require.Equal(t, c.Distributor.DistributorRing.KVStore.Store, "inmemory")
require.Contains(t, gotFlags[flagToCheck], "(default \"inmemory\")")

flagToCheck = "-server.grpc.keepalive.min-time-between-pings"
flagToCheck := "-server.grpc.keepalive.min-time-between-pings"
require.Contains(t, gotFlags, flagToCheck)
require.Equal(t, c.Server.GRPCServerMinTimeBetweenPings, 10*time.Second)
require.Contains(t, gotFlags[flagToCheck], "(default 10s)")
Expand Down