vector cannot contain metrics with the same labelset

163 views
Skip to first unread message

li yun

unread,
Jun 11, 2020, 7:07:50 PM6/11/20
to Prometheus Users
I execute the following query
label_replace(sum_over_time(augmento{coins="xxx"}[20m]), "instance", "", "", "")



Got the following error:

vector cannot contain metrics with the same labelset

What am I doing wrong? thank you very much for your help


Christian Hoffmann

unread,
Jun 12, 2020, 3:53:34 AM6/12/20
to li yun, Prometheus Users
Hi,
Looks like the attempted removal of the instance label would lead to
multiple results with the same label combinations, which isn't allowed.

What are you trying to do?
What do your results look like without the label_replace call?

Maybe you are looking for some aggregation function (min, max, avg, topk)?

Kind regards,
Christian

Julien Pivotto

unread,
Jun 12, 2020, 3:57:32 AM6/12/20
to Christian Hoffmann, li yun, Prometheus Users
On 12 Jun 09:53, Christian Hoffmann wrote:
> Hi,
>
>
> On 6/12/20 1:07 AM, li yun wrote:
> > I execute the following query
> > |
> > label_replace(sum_over_time(augmento{coins="xxx"}[20m]),"instance","","","")

Hi,

You probably want:

sum without(instance) sum_over_time(augmento{coins="xxx"}[20m])

> > |
> >
> > Got the following error:
> >
> > vector cannot contain metrics with the same labelset
> >
> > What am I doing wrong? thank you very much for your help
>
> Looks like the attempted removal of the instance label would lead to
> multiple results with the same label combinations, which isn't allowed.
>
> What are you trying to do?
> What do your results look like without the label_replace call?
>
> Maybe you are looking for some aggregation function (min, max, avg, topk)?
>
> Kind regards,
> Christian
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/1ebab6b0-af3f-2a07-3897-4889e520f847%40hoffmann-christian.info.

--
Julien Pivotto
@roidelapluie

li yun

unread,
Jun 12, 2020, 8:20:00 PM6/12/20
to Christian Hoffmann, li yun, Prometheus Users
Yes, I want to remove the instance, I tried sum without(instance) sum_over_time(augmento{coins="xxx"}[20m]), but there was an error

{"status":"error","errorType":"bad_data","error":"parse error at char 24: unexpected identifier \"sum_over_time\" in aggregation, expected \"(\""}

Julien Pivotto <roidel...@prometheus.io> 于2020年6月12日周五 下午3:57写道:

Julien Pivotto

unread,
Jun 13, 2020, 12:44:03 AM6/13/20
to li yun, Christian Hoffmann, Prometheus Users
sum without(instance) (sum_over_time(augmento{coins="xxx"}[20m])
)


Le sam. 13 juin 2020 à 02:19, li yun <linux...@gmail.com> a écrit :
Yes, I want to remove the instance, I tried a, but there was an error
Reply all
Reply to author
Forward
0 new messages