Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin running into errors with postgres #73

Open
YashKumarVerma opened this issue Oct 17, 2022 · 2 comments
Open

Plugin running into errors with postgres #73

YashKumarVerma opened this issue Oct 17, 2022 · 2 comments
Assignees

Comments

@YashKumarVerma
Copy link

GORM Playground Link

go-gorm/playground#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)
@YashKumarVerma
Copy link
Author

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

@Setheck
Copy link

Setheck commented May 25, 2023

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

?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants