Skip to content

[BUG] Prometheus query API does not support scalar #5251

@joshuali925

Description

@joshuali925

What is the bug?
Prometheus query API does not support scalar result type

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. add prometheus data source
  2. run query
❯ curl -X 'POST' -H 'Content-Type:application/json' --data-binary '{
  "query": "scalar(count(up))",
  "language": "PROMQL",
  "options": {
    "queryType": "instant",
    "time": "1773874502"
  }
}' --insecure -A 'kulala.nvim/5.3.4' 'localhost:9200/_plugins/_directquery/_query/my_prometheus'
{
  "status": 500,
  "error": {
    "type": "MismatchedInputException",
    "reason": "There was internal problem at backend",
    "details": "Cannot construct instance of `org.opensearch.sql.directquery.transport.model.datasource.PrometheusResult$PrometheusResultItem` (although at least one Creator exists): no int/Int-argument constructor/factory method to deserialize from Number value (1773874502)\n at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 32] (through reference chain: org.opensearch.sql.directquery.transport.model.datasource.PrometheusResult[\"result\"]-\u003ejava.util.ArrayList[0])"
  }
}%

What is the expected behavior?
should not have 500 error

What is your host/environment?

  • OS: [e.g. iOS]
  • Version [e.g. 22] 87067f1
  • Plugins

Do you have any screenshots?
If applicable, add screenshots to help explain your problem.

Do you have any additional context?
Add any other context about the problem.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions