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

Server flags categorization #1125

Merged
merged 5 commits into from
Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
64 changes: 0 additions & 64 deletions cmd/mimir/help.txt.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -719,76 +719,14 @@ Usage of ./cmd/mimir/mimir:
File with the configuration that can be updated in runtime.
-runtime-config.reload-period duration
How often to check runtime config file. (default 10s)
-server.graceful-shutdown-timeout duration
Timeout for graceful shutdowns (default 30s)
-server.grpc-conn-limit int
Maximum number of simultaneous grpc connections, <=0 to disable
-server.grpc-listen-address string
gRPC server listen address.
-server.grpc-listen-network string
gRPC server listen network (default "tcp")
-server.grpc-listen-port int
gRPC server listen port. (default 9095)
-server.grpc-max-concurrent-streams uint
Limit on the number of concurrent streams for gRPC calls (0 = unlimited) (default 100)
-server.grpc-max-recv-msg-size-bytes int
Limit on the size of a gRPC message this server can receive (bytes). (default 4194304)
-server.grpc-max-send-msg-size-bytes int
Limit on the size of a gRPC message this server can send (bytes). (default 4194304)
-server.grpc-tls-ca-path string
GRPC TLS Client CA path.
-server.grpc-tls-cert-path string
GRPC TLS server cert path.
-server.grpc-tls-client-auth string
GRPC TLS Client Auth type.
-server.grpc-tls-key-path string
GRPC TLS server key path.
-server.grpc.keepalive.max-connection-age duration
The duration for the maximum amount of time a connection may exist before it will be closed. Default: infinity (default 2562047h47m16.854775807s)
-server.grpc.keepalive.max-connection-age-grace duration
An additive period after max-connection-age after which the connection will be forcibly closed. Default: infinity (default 2562047h47m16.854775807s)
-server.grpc.keepalive.max-connection-idle duration
The duration after which an idle connection should be closed. Default: infinity (default 2562047h47m16.854775807s)
-server.grpc.keepalive.min-time-between-pings duration
Minimum amount of time a client should wait before sending a keepalive ping. If client sends keepalive ping more often, server will send GOAWAY and close the connection. (default 10s)
-server.grpc.keepalive.ping-without-stream-allowed
If true, server allows keepalive pings even when there are no active streams(RPCs). If false, and client sends ping when there are no active streams, server will send GOAWAY and close the connection. (default true)
-server.grpc.keepalive.time duration
Duration after which a keepalive probe is sent in case of no activity over the connection., Default: 2h (default 2h0m0s)
-server.grpc.keepalive.timeout duration
After having pinged for keepalive check, the duration after which an idle connection should be closed, Default: 20s (default 20s)
-server.http-conn-limit int
Maximum number of simultaneous http connections, <=0 to disable
-server.http-idle-timeout duration
Idle timeout for HTTP server (default 2m0s)
-server.http-listen-address string
HTTP server listen address.
-server.http-listen-network string
HTTP server listen network, default tcp (default "tcp")
-server.http-listen-port int
HTTP server listen port. (default 8080)
-server.http-read-timeout duration
Read timeout for HTTP server (default 30s)
-server.http-tls-ca-path string
HTTP TLS Client CA path.
-server.http-tls-cert-path string
HTTP server cert path.
-server.http-tls-client-auth string
HTTP TLS Client Auth type.
-server.http-tls-key-path string
HTTP server key path.
-server.http-write-timeout duration
Write timeout for HTTP server (default 30s)
-server.log-source-ips-enabled
Optionally log the source IPs.
-server.log-source-ips-header string
Header field storing the source IPs. Only used if server.log-source-ips-enabled is true. If not set the default Forwarded, X-Real-IP and X-Forwarded-For headers are used
-server.log-source-ips-regex string
Regex for matching the source IPs. Only used if server.log-source-ips-enabled is true. If not set the default Forwarded, X-Real-IP and X-Forwarded-For headers are used
-server.path-prefix string
Base path to serve all API routes from (e.g. /v1/)
-server.register-instrumentation
Register the intrumentation handlers (/metrics etc). (default true)
-store-gateway.sharding-ring.consul.hostname string
Hostname and port of Consul. (default "localhost:8500")
-store-gateway.sharding-ring.etcd.endpoints value
Expand Down Expand Up @@ -833,8 +771,6 @@ Usage of ./cmd/mimir/mimir:
Limit the query time range (end - start time). This limit is enforced in the query-frontend (on the received query), in the querier (on the query possibly split by the query-frontend) and ruler. 0 to disable.
-target value
Comma-separated list of modules to load. The alias 'all' can be used in the list to load a number of core modules and will enable single-binary mode. Use '-modules' command line flag to get a list of available modules, and to see which modules are included in 'all'. (default all)
-tenant-federation.enabled
If enabled on all services, queries can be federated across multiple tenants. The tenant IDs involved need to be specified separated by a '|' character in the 'X-Scope-OrgID' header.
-validation.create-grace-period value
Duration which table will be created/deleted before/after it's needed; we won't accept sample from before this time. (default 10m)
-validation.enforce-metadata-metric-name
Expand Down
28 changes: 10 additions & 18 deletions cmd/mimir/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,7 @@ import (
"strings"

"github.com/grafana/mimir/pkg/mimir"
)

// category is an enumeration of flag categories.
type category int

const (
// categoryBasic is the basic flag category, and the default if none is defined.
categoryBasic category = iota
// categoryAdvanced is the advanced flag category.
categoryAdvanced
// categoryExperimental is the experimental flag category.
categoryExperimental
"github.com/grafana/mimir/pkg/util/fieldcategory"
)

// usage prints command-line usage, the printAll argument controls whether also non-basic flags will be included.
Expand All @@ -35,22 +24,25 @@ func usage(cfg *mimir.Config, printAll bool) error {
fmt.Fprintf(fs.Output(), "Usage of %s:\n", os.Args[0])
fs.VisitAll(func(fl *flag.Flag) {
v := reflect.ValueOf(fl.Value)
fieldCat := categoryBasic
if v.Kind() == reflect.Ptr {
fieldCat := fieldcategory.Basic

if override, ok := fieldcategory.GetOverride(fl.Name); ok {
fieldCat = override
} else if v.Kind() == reflect.Ptr {
ptr := v.Pointer()
field, ok := fields[ptr]
if ok {
catStr := field.Tag.Get("category")
switch catStr {
case "advanced":
fieldCat = categoryAdvanced
fieldCat = fieldcategory.Advanced
case "experimental":
fieldCat = categoryExperimental
fieldCat = fieldcategory.Experimental
}
}
}

if fieldCat != categoryBasic && !printAll {
if fieldCat != fieldcategory.Basic && !printAll {
// Don't print help for this flag since we're supposed to print only basic flags
return
}
Expand All @@ -66,7 +58,7 @@ func usage(cfg *mimir.Config, printAll bool) error {
// Four spaces before the tab triggers good alignment
// for both 4- and 8-space tab stops.
b.WriteString("\n \t")
if fieldCat == categoryExperimental {
if fieldCat == fieldcategory.Experimental {
b.WriteString("[experimental] ")
}
b.WriteString(strings.ReplaceAll(fl.Usage, "\n", "\n \t"))
Expand Down
90 changes: 46 additions & 44 deletions docs/sources/configuration/reference-configuration-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,9 @@ api:
[store_gateway: <store_gateway_config>]

tenant_federation:
# If enabled on all services, queries can be federated across multiple
# tenants. The tenant IDs involved need to be specified separated by a '|'
# character in the 'X-Scope-OrgID' header.
# (advanced) If enabled on all services, queries can be federated across
# multiple tenants. The tenant IDs involved need to be specified separated by
# a '|' character in the 'X-Scope-OrgID' header.
# CLI flag: -tenant-federation.enabled
[enabled: <boolean> | default = false]

Expand Down Expand Up @@ -266,7 +266,7 @@ query_scheduler:
The `server_config` configures the HTTP and gRPC server of the launched service(s).

```yaml
# HTTP server listen network, default tcp
# (advanced) HTTP server listen network, default tcp
# CLI flag: -server.http-listen-network
[http_listen_network: <string> | default = "tcp"]

Expand All @@ -278,11 +278,11 @@ The `server_config` configures the HTTP and gRPC server of the launched service(
# CLI flag: -server.http-listen-port
[http_listen_port: <int> | default = 8080]

# Maximum number of simultaneous http connections, <=0 to disable
# (advanced) Maximum number of simultaneous http connections, <=0 to disable
# CLI flag: -server.http-conn-limit
[http_listen_conn_limit: <int> | default = 0]

# gRPC server listen network
# (advanced) gRPC server listen network
# CLI flag: -server.grpc-listen-network
[grpc_listen_network: <string> | default = "tcp"]

Expand All @@ -294,109 +294,111 @@ The `server_config` configures the HTTP and gRPC server of the launched service(
# CLI flag: -server.grpc-listen-port
[grpc_listen_port: <int> | default = 9095]

# Maximum number of simultaneous grpc connections, <=0 to disable
# (advanced) Maximum number of simultaneous grpc connections, <=0 to disable
# CLI flag: -server.grpc-conn-limit
[grpc_listen_conn_limit: <int> | default = 0]

http_tls_config:
# HTTP server cert path.
# (advanced) HTTP server cert path.
# CLI flag: -server.http-tls-cert-path
[cert_file: <string> | default = ""]

# HTTP server key path.
# (advanced) HTTP server key path.
# CLI flag: -server.http-tls-key-path
[key_file: <string> | default = ""]

# HTTP TLS Client Auth type.
# (advanced) HTTP TLS Client Auth type.
# CLI flag: -server.http-tls-client-auth
[client_auth_type: <string> | default = ""]

# HTTP TLS Client CA path.
# (advanced) HTTP TLS Client CA path.
# CLI flag: -server.http-tls-ca-path
[client_ca_file: <string> | default = ""]

grpc_tls_config:
# GRPC TLS server cert path.
# (advanced) GRPC TLS server cert path.
# CLI flag: -server.grpc-tls-cert-path
[cert_file: <string> | default = ""]

# GRPC TLS server key path.
# (advanced) GRPC TLS server key path.
# CLI flag: -server.grpc-tls-key-path
[key_file: <string> | default = ""]

# GRPC TLS Client Auth type.
# (advanced) GRPC TLS Client Auth type.
# CLI flag: -server.grpc-tls-client-auth
[client_auth_type: <string> | default = ""]

# GRPC TLS Client CA path.
# (advanced) GRPC TLS Client CA path.
# CLI flag: -server.grpc-tls-ca-path
[client_ca_file: <string> | default = ""]

# Register the intrumentation handlers (/metrics etc).
# (advanced) Register the intrumentation handlers (/metrics etc).
# CLI flag: -server.register-instrumentation
[register_instrumentation: <boolean> | default = true]

# Timeout for graceful shutdowns
# (advanced) Timeout for graceful shutdowns
# CLI flag: -server.graceful-shutdown-timeout
[graceful_shutdown_timeout: <duration> | default = 30s]

# Read timeout for HTTP server
# (advanced) Read timeout for HTTP server
# CLI flag: -server.http-read-timeout
[http_server_read_timeout: <duration> | default = 30s]

# Write timeout for HTTP server
# (advanced) Write timeout for HTTP server
# CLI flag: -server.http-write-timeout
[http_server_write_timeout: <duration> | default = 30s]

# Idle timeout for HTTP server
# (advanced) Idle timeout for HTTP server
# CLI flag: -server.http-idle-timeout
[http_server_idle_timeout: <duration> | default = 2m]

# Limit on the size of a gRPC message this server can receive (bytes).
# (advanced) Limit on the size of a gRPC message this server can receive
# (bytes).
# CLI flag: -server.grpc-max-recv-msg-size-bytes
[grpc_server_max_recv_msg_size: <int> | default = 4194304]

# Limit on the size of a gRPC message this server can send (bytes).
# (advanced) Limit on the size of a gRPC message this server can send (bytes).
# CLI flag: -server.grpc-max-send-msg-size-bytes
[grpc_server_max_send_msg_size: <int> | default = 4194304]

# Limit on the number of concurrent streams for gRPC calls (0 = unlimited)
# (advanced) Limit on the number of concurrent streams for gRPC calls (0 =
# unlimited)
# CLI flag: -server.grpc-max-concurrent-streams
[grpc_server_max_concurrent_streams: <int> | default = 100]

# The duration after which an idle connection should be closed. Default:
# infinity
# (advanced) The duration after which an idle connection should be closed.
# Default: infinity
# CLI flag: -server.grpc.keepalive.max-connection-idle
[grpc_server_max_connection_idle: <duration> | default = 2562047h47m16.854775807s]

# The duration for the maximum amount of time a connection may exist before it
# will be closed. Default: infinity
# (advanced) The duration for the maximum amount of time a connection may exist
# before it will be closed. Default: infinity
# CLI flag: -server.grpc.keepalive.max-connection-age
[grpc_server_max_connection_age: <duration> | default = 2562047h47m16.854775807s]

# An additive period after max-connection-age after which the connection will be
# forcibly closed. Default: infinity
# (advanced) An additive period after max-connection-age after which the
# connection will be forcibly closed. Default: infinity
# CLI flag: -server.grpc.keepalive.max-connection-age-grace
[grpc_server_max_connection_age_grace: <duration> | default = 2562047h47m16.854775807s]

# Duration after which a keepalive probe is sent in case of no activity over the
# connection., Default: 2h
# (advanced) Duration after which a keepalive probe is sent in case of no
# activity over the connection., Default: 2h
# CLI flag: -server.grpc.keepalive.time
[grpc_server_keepalive_time: <duration> | default = 2h]

# After having pinged for keepalive check, the duration after which an idle
# connection should be closed, Default: 20s
# (advanced) After having pinged for keepalive check, the duration after which
# an idle connection should be closed, Default: 20s
# CLI flag: -server.grpc.keepalive.timeout
[grpc_server_keepalive_timeout: <duration> | default = 20s]

# Minimum amount of time a client should wait before sending a keepalive ping.
# If client sends keepalive ping more often, server will send GOAWAY and close
# the connection.
# (advanced) Minimum amount of time a client should wait before sending a
# keepalive ping. If client sends keepalive ping more often, server will send
# GOAWAY and close the connection.
# CLI flag: -server.grpc.keepalive.min-time-between-pings
[grpc_server_min_time_between_pings: <duration> | default = 10s]

# If true, server allows keepalive pings even when there are no active
# streams(RPCs). If false, and client sends ping when there are no active
# (advanced) If true, server allows keepalive pings even when there are no
# active streams(RPCs). If false, and client sends ping when there are no active
# streams, server will send GOAWAY and close the connection.
# CLI flag: -server.grpc.keepalive.ping-without-stream-allowed
[grpc_server_ping_without_stream_allowed: <boolean> | default = true]
Expand All @@ -410,23 +412,23 @@ grpc_tls_config:
# CLI flag: -log.level
[log_level: <string> | default = "info"]

# Optionally log the source IPs.
# (advanced) Optionally log the source IPs.
# CLI flag: -server.log-source-ips-enabled
[log_source_ips_enabled: <boolean> | default = false]

# Header field storing the source IPs. Only used if
# (advanced) Header field storing the source IPs. Only used if
# server.log-source-ips-enabled is true. If not set the default Forwarded,
# X-Real-IP and X-Forwarded-For headers are used
# CLI flag: -server.log-source-ips-header
[log_source_ips_header: <string> | default = ""]

# Regex for matching the source IPs. Only used if server.log-source-ips-enabled
# is true. If not set the default Forwarded, X-Real-IP and X-Forwarded-For
# headers are used
# (advanced) Regex for matching the source IPs. Only used if
# server.log-source-ips-enabled is true. If not set the default Forwarded,
# X-Real-IP and X-Forwarded-For headers are used
# CLI flag: -server.log-source-ips-regex
[log_source_ips_regex: <string> | default = ""]

# Base path to serve all API routes from (e.g. /v1/)
# (advanced) Base path to serve all API routes from (e.g. /v1/)
# CLI flag: -server.path-prefix
[http_path_prefix: <string> | default = ""]
```
Expand Down
2 changes: 1 addition & 1 deletion pkg/querier/tenantfederation/tenant_federation.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const (

type Config struct {
// Enabled switches on support for multi tenant query federation
Enabled bool `yaml:"enabled"`
Enabled bool `yaml:"enabled" category:"advanced"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be advanced, because this is a core (stable) feature. I left the same comment in a previous PR that was proposing to flag it as advanced.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed the spreadsheet so hopefully it doesn't happen again.

}

func (cfg *Config) RegisterFlags(f *flag.FlagSet) {
Expand Down
Loading