Skip to content

frontend: aggregate functions on missing label-values return a null result instead of [] #1645

@faevourite

Description

@faevourite

Hi folks.

I noticed a small difference between the behaviour of OSS Prometheus and the frontend component in the query_range API:

  • Given a metric foo with label values bar="0" and bar="1"
  • If I run an aggregate query on a non-existent label-value like count(foo{bar="2"}),
  • The result in OSS Prometheus is:
    • {"status":"success","data":{"resultType":"matrix","result":[]}}
  • The result in prometheus-engine's frontend is:
    • {"status":"success","data":{"resultType":"matrix","result":null}}

This causes the frontend to break (query ui disappears; screen becomes empty) and causes issues for some prometheus tools like pint.

Is it possible to preserve compatibility and return an empty array in this case instead of null?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions