Skip to content

Metric label collision #12

Open
Open
@bobrik

Description

@bobrik

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions