Skip to content

Commit

Permalink
Take 2 for fix the limit settings (#519)
Browse files Browse the repository at this point in the history
* Revert "Make sure the default for EnforceMetricName is ✅ (#518)"

This reverts commit 199746a.

* Fix overrides unmarshalling properly

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
  • Loading branch information
gouthamve authored Apr 26, 2019
1 parent 9440dc9 commit e2b2561
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cmd/loki/loki-local-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ storage_config:

filesystem:
directory: /tmp/loki/chunks

limits_config:
enforce_metric_name: false
11 changes: 9 additions & 2 deletions cmd/loki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/cortexproject/cortex/pkg/util"
"github.com/cortexproject/cortex/pkg/util/flagext"
"github.com/cortexproject/cortex/pkg/util/validation"
)

func init() {
Expand All @@ -29,8 +30,14 @@ func main() {
flagext.RegisterFlags(&cfg)
flag.Parse()

// The flags set the EnforceMetricName to be true, but in loki it _should_ be false.
cfg.LimitsConfig.EnforceMetricName = false
// LimitsConfig has a customer UnmarshalYAML that will set the defaults to a global.
// This global is set to the config passed into the last call to `NewOverrides`. If we don't
// call it atleast once, the defaults are set to an empty struct.
// We call it with the flag values so that the config file unmarshalling only overrides the values set in the config.
if _, err := validation.NewOverrides(cfg.LimitsConfig); err != nil {
level.Error(util.Logger).Log("msg", "error loading limits", "err", err)
os.Exit(1)
}

util.InitLogger(&cfg.Server)

Expand Down
2 changes: 2 additions & 0 deletions production/helm/loki/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ config:
# prefix: ""
# httpclienttimeout: "20s"
# consistentreads: true
limits_config:
enforce_metric_name: false
schema_config:
configs:
- from: 0
Expand Down
4 changes: 4 additions & 0 deletions production/ksonnet/loki/config.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
grpc_server_max_recv_msg_size: 1024 * 1024 * 64,
},

limits_config: {
enforce_metric_name: false,
},

ingester: {
chunk_idle_period: '15m',

Expand Down

0 comments on commit e2b2561

Please sign in to comment.