fix: only collect prometheus database metrics when explicitly enabled (#8045)

* fix: only collect prometheus database metrics when explicitly enabled

* add missing test

* de-duplicate wrapping
This commit is contained in:
Cian Johnston
2023-06-15 12:34:16 +01:00
committed by GitHub
parent 3f81f38fcc
commit 6e598234b6
14 changed files with 158 additions and 58 deletions
+1
View File
@@ -275,6 +275,7 @@ curl -X GET http://coder-server:8080/api/v2/deployment/config \
"port": "string"
},
"collect_agent_stats": true,
"collect_db_metrics": true,
"enable": true
},
"provisioner": {
+4
View File
@@ -1943,6 +1943,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
"port": "string"
},
"collect_agent_stats": true,
"collect_db_metrics": true,
"enable": true
},
"provisioner": {
@@ -2270,6 +2271,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
"port": "string"
},
"collect_agent_stats": true,
"collect_db_metrics": true,
"enable": true
},
"provisioner": {
@@ -3092,6 +3094,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
"port": "string"
},
"collect_agent_stats": true,
"collect_db_metrics": true,
"enable": true
}
```
@@ -3102,6 +3105,7 @@ AuthorizationObject can represent a "set" of objects, such as: all workspaces in
| --------------------- | ------------------------------------ | -------- | ------------ | ----------- |
| `address` | [clibase.HostPort](#clibasehostport) | false | | |
| `collect_agent_stats` | boolean | false | | |
| `collect_db_metrics` | boolean | false | | |
| `enable` | boolean | false | | |
## codersdk.ProvisionerConfig
+11
View File
@@ -565,6 +565,17 @@ The bind address to serve prometheus metrics.
Collect agent stats (may increase charges for metrics storage).
### --prometheus-collect-db-metrics
| | |
| ----------- | -------------------------------------------------------- |
| Type | <code>bool</code> |
| Environment | <code>$CODER_PROMETHEUS_COLLECT_DB_METRICS</code> |
| YAML | <code>introspection.prometheus.collect_db_metrics</code> |
| Default | <code>false</code> |
Collect database metrics (may increase charges for metrics storage).
### --prometheus-enable
| | |