Skip to content

[TEST][BUG] Prometheus query API returns 500 error for scalar result type #5329

@qianheng-aws

Description

@qianheng-aws

What is the bug?
When using Prometheus query API with scalar functions like scalar(count(up)), the API returns a 500 internal server error instead of the expected result.

How can one reproduce the bug?

  1. Add a Prometheus data source
  2. Run a PROMQL query that returns a scalar result type:
curl -X 'POST' -H 'Content-Type:application/json' --data-binary '{
  "query": "scalar(count(up))",
  "language": "PROMQL",
  "options": {
    "queryType": "instant",
    "time": "1773874502"
  }
}' 'localhost:9200/_plugins/_directquery/_query/my_prometheus'

What is the expected behavior?
The query should return the scalar result without error.

What is your host/environment?
OpenSearch 2.19

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssue is a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions