prometheus
prometheus copied to clipboard
Plugin running into errors with postgres
GORM Playground Link
https://github.com/go-gorm/playground/pull/1
Description
Getting this error in the console when trying the plugin with postgres
Continuoiusly
2022/10/17 10:16:47 /home/yashkumarverma/go/pkg/mod/gorm.io/plugin/[email protected]/mysql.go:48 ERROR: unrecognized configuration parameter "status" (SQLSTATE 42704)
[0.449ms] [rows:-] SHOW STATUS
2022/10/17 10:16:47 /home/yashkumarverma/go/pkg/mod/gorm.io/plugin/[email protected]/mysql.go:51
[error] gorm:prometheus query error: ERROR: unrecognized configuration parameter "status" (SQLSTATE 42704)
2022/10/17 10:16:52 /home/yashkumarverma/go/pkg/mod/gorm.io/plugin/[email protected]/mysql.go:48 ERROR: unrecognized configuration parameter "status" (SQLSTATE 42704)
[0.422ms] [rows:-] SHOW STATUS
2022/10/17 10:16:52 /home/yashkumarverma/go/pkg/mod/gorm.io/plugin/[email protected]/mysql.go:51
[error] gorm:prometheus query error: ERROR: unrecognized configuration parameter "status" (SQLSTATE 42704)
db.Use(prometheus.New(prometheus.Config{
DBName: "gorm_", // use `DBName` as metrics label
RefreshInterval: 5, // Refresh metrics interval (default 15 seconds)
StartServer: false, // start http server to expose metrics
HTTPServerPort: 8080, // configure http server port, default port 8080 (if you have configured multiple instances, only the first `HTTPServerPort` will be used to start server)
MetricsCollector: []prometheus.MetricsCollector{
&prometheus.MySQL{
VariableNames: []string{"Threads_running"},
},
}, // user defined metrics
}))
removing the MetricsCollector removes the error altogether
MetricsCollector: []prometheus.MetricsCollector{
&prometheus.MySQL{
VariableNames: []string{"Threads_running"},
},
}, // user defined metrics
Maybe this is because you are using the MYSQL collector for postgres?
Try
MetricsCollector: []prometheus.MetricsCollector{
&prometheus.Postgres{
VariableNames: []string{"Threads_running"},
},
}, // user defined metrics
?