vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.48k stars 2.09k forks source link

Vitess go-grpc driver registers all vitess flags #4712

Open jscheinblum opened 5 years ago

jscheinblum commented 5 years ago

We're starting to use the vitess golang GRPC driver, but it looks like it registers all the flags of the vitess driver. This is mostly an aesthetic issue, but it does register flags like -v that would be useful for the application that uses the driver. In this case, this prevents us from using Go flags and having a -v verbose for the application's logging.

I have a little repro of the issue: https://github.com/jscheinblum/vitessflags

And this is the output of the help from the simple app:

  -alsologtostderr
        log to standard error as well as files
  -emit_stats
        true iff we should emit stats to push-based monitoring/stats backends
  -grpc_auth_static_client_creds string
        when using grpc_static_auth in the server, this file provides the credentials to use to authenticate with server
  -grpc_compression string
        how to compress gRPC, default: nothing, supported: snappy
  -grpc_enable_tracing
        Enable GRPC tracing
  -grpc_initial_conn_window_size int
        grpc initial connection window size
  -grpc_initial_window_size int
        grpc initial window size
  -grpc_keepalive_time duration
        After a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive.
  -grpc_keepalive_timeout duration
        After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that the connection is closed.
  -grpc_max_message_size int
        Maximum allowed RPC message size. Larger messages will be rejected by gRPC with the error 'exceeding the max size'. (default 16777216)
  -grpc_prometheus
        Enable gRPC monitoring with Prometheus
  -keep_logs duration
        keep logs for this long (zero to keep forever)
  -log_backtrace_at value
        when logging hits line file:N, emit a stack trace
  -log_dir string
        If non-empty, write log files in this directory
  -log_rotate_max_size uint
        size in bytes at which logs are rotated (glog.MaxSize) (default 1887436800)
  -logtostderr
        log to standard error instead of files
  -purge_logs_interval duration
        how often try to remove old logs (default 1h0m0s)
  -stats_backend string
        The name of the registered push-based monitoring/stats backend to use
  -stats_emit_period duration
        Interval between emitting stats to all registered backends (default 1m0s)
  -stderrthreshold value
        logs at or above this threshold go to stderr (default 1)
  -v value
        log level for V logs
  -vmodule value
        comma-separated list of pattern=N settings for file-filtered logging
  -vtgate_grpc_ca string
        the server ca to use to validate servers when connecting
  -vtgate_grpc_cert string
        the cert to use to connect
  -vtgate_grpc_key string
        the key to use to connect
  -vtgate_grpc_server_name string
        the server name to use to validate server certificate
  -vtgate_protocol string
        how to talk to vtgate (default "grpc")
js$ 
harshit-gangal commented 3 years ago

@jscheinblum are you using vitess go driver or have you switched to using mysql protocol with native provided go mysql driver?

derekperkins commented 3 years ago

That's with the Vitess go driver. We see the same thing. It's a good case against stdlib flags.