Skip to content

query and query_range endpoints don't return utf8 labels in metric field when grouping by utf8 label  #15470

@itsmylife

Description

@itsmylife

What did you do?

When querying a metric with utf8 label name, I expect to get labels in the result. When I do the same without utf8 label it works. Check the metric field in both responses below:

Without utf8 labels

Query: sum by (instance)(rate(fakedata_highcard_http_requests_total{"label with space"="space"}[1m]))

{
  "status": "success",
  "data": {
    "resultType": "matrix",
    "result": [
      {
        "metric": {
          "instance": "prometheus-high-card:9111"
        },
        "values": [
          [
            1732653240,
            "449.4510109797804"
          ],
          [
            1732653255,
            "453.818152726109"
          ],
          [
            1732653270,
            "451.28902578051566"
          ]
        ]
      }
    ]
  }
}

With utf8 labels:

Query: sum by("label with space")(rate(fakedata_highcard_http_requests_total{"label with space"="space"}[1m]))

{
  "status": "success",
  "data": {
    "resultType": "matrix",
    "result": [
      {
        "metric": {},
        "values": [
          [
            1732651560,
            "437.98496120310375"
          ],
          [
            1732652430,
            "415.46154615461546"
          ],
          [
            1732652445,
            "423.90847816956347"
          ]
        ]
      }
    ]
  }
}

What did you expect to see?

I expect to see the labels in metric field.

What did you see instead? Under which circumstances?

I got no labels in metric field when I requested grouping by a utf8 label.

System information

Darwin 24.1.0 arm64

Prometheus version

version	3.0.0
revision	c5d009d57fcccb7247e1191a0b10d74b06295388
branch	HEAD
buildUser	root@aa286d0eb00a
buildDate	20241114-16:43:34
goVersion	go1.23.3

Prometheus configuration file

No response

Alertmanager version

No response

Alertmanager configuration file

No response

Logs

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions