mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
chore: add tx metrics and logs for serialization errors (#15215)
Before db_metrics were all or nothing. Now `InTx` metrics are always recorded, and query metrics are opt in. Adds instrumentation & logging around serialization failures in the database.
This commit is contained in:
@ -718,7 +718,9 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
|
||||
}
|
||||
|
||||
if options.DeploymentValues.Prometheus.Enable && options.DeploymentValues.Prometheus.CollectDBMetrics {
|
||||
options.Database = dbmetrics.New(options.Database, options.PrometheusRegistry)
|
||||
options.Database = dbmetrics.NewQueryMetrics(options.Database, options.Logger, options.PrometheusRegistry)
|
||||
} else {
|
||||
options.Database = dbmetrics.NewDBMetrics(options.Database, options.Logger, options.PrometheusRegistry)
|
||||
}
|
||||
|
||||
var deploymentID string
|
||||
|
4
cli/testdata/coder_server_--help.golden
vendored
4
cli/testdata/coder_server_--help.golden
vendored
@ -145,7 +145,9 @@ INTROSPECTION / PROMETHEUS OPTIONS:
|
||||
Collect agent stats (may increase charges for metrics storage).
|
||||
|
||||
--prometheus-collect-db-metrics bool, $CODER_PROMETHEUS_COLLECT_DB_METRICS (default: false)
|
||||
Collect database metrics (may increase charges for metrics storage).
|
||||
Collect database query metrics (may increase charges for metrics
|
||||
storage). If set to false, a reduced set of database metrics are still
|
||||
collected.
|
||||
|
||||
--prometheus-enable bool, $CODER_PROMETHEUS_ENABLE
|
||||
Serve prometheus metrics on the address defined by prometheus address.
|
||||
|
3
cli/testdata/server-config.yaml.golden
vendored
3
cli/testdata/server-config.yaml.golden
vendored
@ -197,7 +197,8 @@ introspection:
|
||||
- template_name
|
||||
- username
|
||||
- workspace_name
|
||||
# Collect database metrics (may increase charges for metrics storage).
|
||||
# Collect database query metrics (may increase charges for metrics storage). If
|
||||
# set to false, a reduced set of database metrics are still collected.
|
||||
# (default: false, type: bool)
|
||||
collect_db_metrics: false
|
||||
pprof:
|
||||
|
Reference in New Issue
Block a user