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

Update changelog, fix acl-token flags in help. #1587

Merged
merged 3 commits into from
Apr 1, 2022
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: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* [ENHANCEMENT] Alertmanager: added `insight=true` field to alertmanager dispatch logs. #1379
* [BUGFIX] Query-frontend: do not shard queries with a subquery unless the subquery is inside a shardable aggregation function call. #1542
* [BUGFIX] Mimir: services' status content-type is now correctly set to `text/html`. #1575
* [BUGFIX] Multikv: Fix panic when using using runtime config to set primary KV store used by `multi` KV. #1587

### Mixin

Expand Down
14 changes: 0 additions & 14 deletions cmd/mimir/help.txt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ Usage of ./cmd/mimir/mimir:
Comma-separated list of network CIDRs to block in Alertmanager receiver integrations.
-alertmanager.receivers-firewall-block-private-addresses
True to block private and local addresses in Alertmanager receiver integrations. It blocks private addresses defined by RFC 1918 (IPv4 addresses) and RFC 4193 (IPv6 addresses), as well as loopback, local unicast and local multicast addresses.
-alertmanager.sharding-ring.consul.acl-token string
ACL Token used to interact with Consul.
-alertmanager.sharding-ring.consul.hostname string
Hostname and port of Consul. (default "localhost:8500")
-alertmanager.sharding-ring.etcd.endpoints value
Expand Down Expand Up @@ -201,8 +199,6 @@ Usage of ./cmd/mimir/mimir:
Max number of compactors that can compact blocks for single tenant. 0 to disable the limit and use all compactors.
-compactor.data-dir string
Directory to temporarily store blocks during compaction. This directory is not required to be persisted between restarts. (default "./data-compactor/")
-compactor.ring.consul.acl-token string
ACL Token used to interact with Consul.
-compactor.ring.consul.hostname string
Hostname and port of Consul. (default "localhost:8500")
-compactor.ring.etcd.endpoints value
Expand All @@ -225,8 +221,6 @@ Usage of ./cmd/mimir/mimir:
Configuration file to load.
-distributor.ha-tracker.cluster string
Prometheus label to look for in samples to identify a Prometheus HA cluster. (default "cluster")
-distributor.ha-tracker.consul.acl-token string
ACL Token used to interact with Consul.
-distributor.ha-tracker.consul.hostname string
Hostname and port of Consul. (default "localhost:8500")
-distributor.ha-tracker.enable
Expand All @@ -251,8 +245,6 @@ Usage of ./cmd/mimir/mimir:
Per-tenant ingestion rate limit in samples per second. (default 10000)
-distributor.ingestion-tenant-shard-size int
The tenant's shard size used by shuffle-sharding. Must be set both on ingesters and distributors. 0 disables shuffle sharding.
-distributor.ring.consul.acl-token string
ACL Token used to interact with Consul.
-distributor.ring.consul.hostname string
Hostname and port of Consul. (default "localhost:8500")
-distributor.ring.etcd.endpoints value
Expand All @@ -279,8 +271,6 @@ Usage of ./cmd/mimir/mimir:
The maximum number of active series per metric name, across the cluster before replication. 0 to disable. (default 20000)
-ingester.max-global-series-per-user int
The maximum number of active series per tenant, across the cluster before replication. 0 to disable. (default 150000)
-ingester.ring.consul.acl-token string
ACL Token used to interact with Consul.
-ingester.ring.consul.hostname string
Hostname and port of Consul. (default "localhost:8500")
-ingester.ring.etcd.endpoints value
Expand Down Expand Up @@ -453,8 +443,6 @@ Usage of ./cmd/mimir/mimir:
Maximum number of rule groups per-tenant. 0 to disable. (default 70)
-ruler.max-rules-per-rule-group int
Maximum number of rules per rule group per-tenant. 0 to disable. (default 20)
-ruler.ring.consul.acl-token string
ACL Token used to interact with Consul.
-ruler.ring.consul.hostname string
Hostname and port of Consul. (default "localhost:8500")
-ruler.ring.etcd.endpoints value
Expand Down Expand Up @@ -483,8 +471,6 @@ Usage of ./cmd/mimir/mimir:
HTTP server listen address.
-server.http-listen-port int
HTTP server listen port. (default 8080)
-store-gateway.sharding-ring.consul.acl-token string
ACL Token used to interact with Consul.
-store-gateway.sharding-ring.consul.hostname string
Hostname and port of Consul. (default "localhost:8500")
-store-gateway.sharding-ring.etcd.endpoints value
Expand Down
20 changes: 19 additions & 1 deletion cmd/mimir/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import (
"reflect"
"strings"

"github.com/grafana/dskit/flagext"

"github.com/grafana/mimir/pkg/mimir"
"github.com/grafana/mimir/pkg/util/fieldcategory"
)
Expand Down Expand Up @@ -131,7 +133,7 @@ func parseStructure(structure interface{}, fields map[uintptr]reflect.StructFiel
fields[fieldValue.Addr().Pointer()] = field

// Recurse if a struct
if field.Type.Kind() != reflect.Struct {
if field.Type.Kind() != reflect.Struct || ignoreStructType(field.Type) {
continue
}

Expand All @@ -143,6 +145,22 @@ func parseStructure(structure interface{}, fields map[uintptr]reflect.StructFiel
return nil
}

// Descending into some structs breaks check for "advanced" category for some fields (eg. flagext.Secret),
// because field itself is at the same memory address as the internal field in the struct, and advanced-category-check
// then gets confused.
var ignoredStructTypes = []reflect.Type{
reflect.TypeOf(flagext.Secret{}),
}

func ignoreStructType(fieldType reflect.Type) bool {
for _, t := range ignoredStructTypes {
if fieldType == t {
return true
}
}
return false
}

func getFlagName(fl *flag.Flag) string {
if getter, ok := fl.Value.(flag.Getter); ok {
if v := reflect.ValueOf(getter.Get()); v.IsValid() {
Expand Down