You need to aggregate the data. Most likely what you are looking for (given your example) is
sum by (namespace, svc_name) up If sum is not the right aggregation, you can use any of the aggregation operators <https://prometheus.io/docs/prometheus/latest/querying/operators/#aggregation-operators> . On Mon, May 10, 2021 at 9:09 AM Hello World <[email protected]> wrote: > This is not filtering the labels by values here I only want to select > couple of labels in the results instead of getting all the labels over the > wire. > Also, I'm not using this for visualization, I'm trying to write a backend > API which fetches the data from prometheus and runs some business logic on > the data. > > Thanks for your time. > > On Monday, 10 May 2021 at 12:38:50 UTC+5:30 Hello World wrote: > >> Hi All, >> >> Let us assume that we have some metrics like this, >> up {instance="instance1", job="job1", namespace="namespace1", >> svc_name="first_service"} >> up {instance="instance1", job="job2", namespace="namespace2", >> svc_name="second_service"} >> >> is there a way to select specific labels from the server instead of >> getting all the labels in the result? like the svc_name, namespace.etc >> something like this, >> >> up{namespace="namespace1", svc_name="first_service"} >> up{namespace="namespace2", svc_name="second_service"} >> >> This is like selecting a couple of columns from a table containing 20 >> columns. >> >> Thanks. >> > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/5494d002-4f35-4799-971a-cb1e12a281c5n%40googlegroups.com > <https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_prometheus-2Dusers_5494d002-2D4f35-2D4799-2D971a-2Dcb1e12a281c5n-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=o2Rg2hCP31Es1DdrOYH75Q&r=j64P62uxP3fuCGhy7QIFzHc5tMo0hYAmg9RiTtOmVJM&m=ho-wnkrBA9hHu9LfubqIOFXLYx6Cbe1NsbWlSftkKZ4&s=HpAyJ3mALMHBQT2hOjrU55NzMBH1bljEEQk7nLZxDvY&e=> > . > -- This e-mail and all information in, attached to, or linked via this e-mail (together the ‘e-mail’) is confidential and may be legally privileged. It is intended solely for the intended addressee(s). Access to, or any onward transmission, of this e-mail by any other person is not authorised. If you are not the intended recipient, you are requested to immediately alert the sender of this e-mail and to immediately delete this e-mail. Any disclosure in any form of all or part of this e-mail, or of any the parties to it, including any copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful. This e-mail is not, and is not intended to be, and should not be construed as being, (a) any offer, solicitation, or promotion of any kind; (b) the basis of any investment or other decision(s); (c) any recommendation to buy, sell or transact in any manner any good(s), product(s) or service(s), nor engage in any investment(s) or other transaction(s) or activities; or (d) the provision of, or related to, any advisory service(s) or activities, including regarding any investment, tax, legal, financial, accounting, consulting or any other related service(s). -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/CAJsAWL6z8FT1Dp8DVOJqDRYShqGfO7G9eDDp9htpEPzky1%2BQnw%40mail.gmail.com.

