Skip to content

Commit

Permalink
feat: add support for debug logging (#2107)
Browse files Browse the repository at this point in the history
Co-authored-by: Jack Wotherspoon <[email protected]>
  • Loading branch information
enocom and jackwotherspoon authored Feb 14, 2024
1 parent 8e26fa6 commit c8f7a0a
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 71 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,13 @@ To enable Prometheus, use the `--prometheus` flag. This will start an HTTP
server on localhost with a `/metrics` endpoint. The Prometheus namespace may
optionally be set with `--prometheus-namespace`.

## Debug logging

To enable debug logging to report on internal certificate refresh operations,
use the `--debug-logs` flag. Typical use of the Proxy should not require debug
logs, but if you are surprised by the Proxy's behavior, debug logging should
provide insight into internal operations and can help when reporting issues.
## Localhost Admin Server
The Proxy includes support for an admin server on localhost. By default, the
Expand Down
9 changes: 9 additions & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,13 @@ Localhost Admin Server
/quitquitquit. The admin server exits gracefully when it receives a POST
request at /quitquitquit.
Debug logging
On occasion, it can help to enable debug logging which will report on
internal certificate refresh operations. To enable debug logging, use:
./cloud-sql-proxy <INSTANCE_CONNECTION_NAME> --debug-logs
Waiting for Startup
See the wait subcommand's help for details.
Expand Down Expand Up @@ -458,6 +465,8 @@ Instead prefer Application Default Credentials
the Proxy will then pick-up automatically.`)
localFlags.BoolVarP(&c.conf.StructuredLogs, "structured-logs", "l", false,
"Enable structured logging with LogEntry format")
localFlags.BoolVar(&c.conf.DebugLogs, "debug-logs", false,
"Enable debug logging")
localFlags.Uint64Var(&c.conf.MaxConnections, "max-connections", 0,
"Limit the number of connections. Default is no limit.")
localFlags.DurationVar(&c.conf.WaitOnClose, "max-sigterm-delay", 0,
Expand Down
42 changes: 21 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,31 @@ module github.com/GoogleCloudPlatform/cloud-sql-proxy/v2
go 1.20

require (
cloud.google.com/go/cloudsqlconn v1.6.0
cloud.google.com/go/cloudsqlconn v1.7.0
contrib.go.opencensus.io/exporter/prometheus v0.4.2
contrib.go.opencensus.io/exporter/stackdriver v0.13.14
github.com/coreos/go-systemd/v22 v22.5.0
github.com/go-sql-driver/mysql v1.7.1
github.com/google/go-cmp v0.6.0
github.com/hanwen/go-fuse/v2 v2.5.0
github.com/jackc/pgx/v5 v5.5.2
github.com/jackc/pgx/v5 v5.5.3
github.com/microsoft/go-mssqldb v1.6.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
go.opencensus.io v0.24.0
go.uber.org/zap v1.26.0
golang.org/x/oauth2 v0.16.0
golang.org/x/sys v0.16.0
google.golang.org/api v0.156.0
golang.org/x/oauth2 v0.17.0
golang.org/x/sys v0.17.0
google.golang.org/api v0.164.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
)

require (
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute v1.23.4 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/monitoring v1.17.0 // indirect
cloud.google.com/go/trace v1.10.4 // indirect
cloud.google.com/go/monitoring v1.17.1 // indirect
cloud.google.com/go/trace v1.10.5 // indirect
github.com/aws/aws-sdk-go v1.43.31 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.4.1 // indirect
Expand All @@ -36,14 +36,14 @@ require (
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand All @@ -68,23 +68,23 @@ require (
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/metric v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.23.0 // indirect
go.opentelemetry.io/otel/metric v1.23.0 // indirect
go.opentelemetry.io/otel/trace v1.23.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.5.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240102182953-50ed04b92917 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/genproto v0.0.0-20240205150955-31a09d347014 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/grpc v1.61.0 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
Expand Down
Loading

0 comments on commit c8f7a0a

Please sign in to comment.