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

Metric label collision #12

Open
bobrik opened this issue Jul 2, 2017 · 2 comments
Open

Metric label collision #12

bobrik opened this issue Jul 2, 2017 · 2 comments

Comments

@bobrik
Copy link
Contributor

bobrik commented Jul 2, 2017

I want to select user-level stats from a database and naturally I added user as a label for my metrics. Unfortunately, sql_exporter crashed immediately, because it adds a lot of own labels:

panic: descriptor Desc{fqName: "sql_clickhouse_user_query_read_rows", help: "Rows read in queries", constLabels: {}, variableLabels: [user type driver host database user col]} is invalid: duplicate label names

goroutine 1 [running]:
github.com/justwatchcom/sql_exporter/vendor/github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0xc420044880, 0xc4202ac850, 0x1, 0x1)
	/Users/bobrik/projects/sql_exporter/src/github.com/justwatchcom/sql_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:353 +0x92
github.com/justwatchcom/sql_exporter/vendor/github.com/prometheus/client_golang/prometheus.MustRegister(0xc4202ac850, 0x1, 0x1)
	/Users/bobrik/projects/sql_exporter/src/github.com/justwatchcom/sql_exporter/vendor/github.com/prometheus/client_golang/prometheus/registry.go:152 +0x53
main.main()
	/Users/bobrik/projects/sql_exporter/src/github.com/justwatchcom/sql_exporter/main.go:63 +0x7a5

Relabeling later in Prometheus seems cumbersome. Not sure what's the cleanest way forward here.

@dominikschulz
Copy link
Contributor

Thank you for bringing this up.

I see two options here: Either you don't use conflicting rows names in your queries, or we rename these fields in the SQL exporter. As they are very generic it may make sense to do so.

I'm not quite sure what the best naming would be. Maybe something like sql_connection_user?
Of course this could conflict as well, if someone wants to return an row named sql_connection_user.

@bobrik
Copy link
Contributor Author

bobrik commented Jul 9, 2017

sql_exporter_ may be a more specific prefix than sql_connection_.

@dominikschulz dominikschulz removed their assignment Mar 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants