Getting "was collected before with the same name and label values"

5,141 views
Skip to first unread message

KK

unread,
Jun 11, 2018, 6:00:08 PM6/11/18
to Prometheus Users
I am trying to write my own custom exporter and getting the following error message. Would like to know as to why i am getting this message  and how do solve the problem ?

was collected before with the same name and label values

One thing to note is the value for a given label keeps changing.

KK

unread,
Jun 12, 2018, 6:53:46 PM6/12/18
to Prometheus Users
Any thoughts on this would be very helpful.

Nicholas Capo

unread,
Jun 12, 2018, 6:57:55 PM6/12/18
to KK, Prometheus Users
Can you post the metrics from your exporter? Like by using curl?

Nicholas

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/1aadf7ab-841e-4890-a572-7184d05246b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

KK

unread,
Jun 12, 2018, 7:14:46 PM6/12/18
to Prometheus Users
Followed these steps

1) Declared []string for labelNames as below

          LabelNames = []string{
                                                   "src_ip",
                                                   "dst_ip",
                                                   "proto",
        }

2) Created a gauge as below

c.connections = typedDesc{prometheus.NewDesc(
                prometheus.BuildFQName(namespace, subsystem, "connections"),
                "The current active connections by local and remote address.",
                labelNames, nil,
        ), prometheus.GaugeValue}

3) Filled info for the labels

       for _, flowStats := range flowsStats {
                labelValues := []string{
                        flowStats.SrcIP,
                        flowStats.DstIP,
                        flowStats.Proto,
                }
                ch <- c.connections.mustNewConstMetric(float64(1) , labelValues...)

See these in console.
* [from Gatherer #2] collected metric node_conntrack_nf_conntrack_connections label:<name:"dst_ip" value:"172.17.0.2" > label:<name:"proto" value:"tcp" > label:<name:"src_ip" value:"172.17.0.1" > gauge:<value:1 >  was collected before with the same name and label values
* [from Gatherer #2] collected metric node_conntrack_nf_conntrack_connections label:<name:"dst_ip" value:"172.17.0.2" > label:<name:"proto" value:"tcp" > label:<name:"src_ip" value:"172.17.0.1" > gauge:<value:1 >  was collected before with the same name and label values
* [from Gatherer #2] collected metric node_conntrack_nf_conntrack_connections label:<name:"dst_ip" value:"10.11.181.243" > label:<name:"proto" value:"tcp" > label:<name:"src_ip" value:"10.11.45.1" > gauge:<value:1 >  was collected before with the same name and label values
* [from Gatherer #2] collected metric node_conntrack_nf_conntrack_connections label:<name:"dst_ip" value:"172.17.0.2" > label:<name:"proto" value:"tcp" > label:<name:"src_ip" value:"172.17.0.1" > gauge:<value:1 >  was collected before with the same name and label values
* [from Gatherer #2] collected metric node_conntrack_nf_conntrack_connections label:<name:"dst_ip" value:"172.17.0.2" > label:<name:"proto" value:"tcp" > label:<name:"src_ip" value:"172.17.0.1" > gauge:<value:1 >  was collected before with the same name and label values
* [from Gatherer #2] collected metric node_conntrack_nf_conntrack_connections label:<name:"dst_ip" value:"172.17.0.2" > label:<name:"proto" value:"tcp" > label:<name:"src_ip" value:"172.17.0.1" > gauge:<value:1 >  was collected before with the same name and label values

Nicholas Capo

unread,
Jun 12, 2018, 7:25:17 PM6/12/18
to KK, Prometheus Users
Is flowsStats a unique set of (src, dest, proto) entries?
If there are duplicate entries, that will cause this problem.


Can you post the output of `curl {exporter ip}:{port}`?

Nicholas

Nicholas
--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To post to this group, send email to promethe...@googlegroups.com.

KK

unread,
Jun 13, 2018, 1:09:46 AM6/13/18
to Prometheus Users
You are right. There were duplicate entries. The problem went away the duplicate entries were address.

Appreciate your help here.
Reply all
Reply to author
Forward
0 new messages