Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Prometheus] unexpected end of JSON input #5178

Open
ch9hn opened this issue Feb 3, 2023 · 1 comment
Open

[Prometheus] unexpected end of JSON input #5178

ch9hn opened this issue Feb 3, 2023 · 1 comment
Labels

Comments

@ch9hn
Copy link

ch9hn commented Feb 3, 2023

Hello,
we are using the Prometheus Integration to scrape Metrics from an endpoint which is working quite well with Metricbeat, but the same endpoint is not working with the Prometheus integration.

Metricsbeat Config:

- module: prometheus
  period: 10s
  environment: ["mysql-production", "xx-xx-xx"]
  tags: ["mysql-production", "mysql", "scw-metrics", "scw-mysql"]
  metricsets: ["query"]
  hosts: ["https://metrics.prd.obs.fr-par.scw.cloud/api/prom"]
  headers:
    x-token: ${SCW_PROM_TOKEN}
  queries:
    - name: "mysql_cpu"
      path: "/api/v1/query"
      params:
        query: '100 - avg by (instance) (irate(rdb_instance_mysql_node_cpu_seconds_total{resource_id="xx-xx-xx-xx", mode="idle"}[5m])) * 100'

We implemented the same config in the Prometheus Integration Query field:

Collect Prometheus Metrics => ON
HTTP config options: headers
x-token: <token>
Prometheus query metrics => ON
Host: https://metrics.prd.obs.fr-par.scw.cloud/api/prom

Queries:

- name: "mysql_cpu"
  path: "/api/v1/query"
  params:
    query: '100 - avg by (instance) (irate(rdb_instance_mysql_node_cpu_seconds_total{resource_id="xx-xx-xx-xx", mode="idle"}[5m])) * 100'

Leader election: ON

Error:

error.message:
error parsing response from: https://metrics.prd.obs.fr-par.scw.cloud/api/prom/api/v1/query?query=%28irate%28rdb_instance_mysql_node_cpu_seconds_total%7Bresource_id%3D%xx-xx-xx-xx%22%2C+mode%3D%22idle%22%7D%5B5m%5D%29%29: Failed to parse api response: unexpected end of JSON input

Ive inserted the exact same path into Postman and got a response with success:

{
    "status": "success",
    "data": {
        "resultType": "vector",
        "result": [
            {
                "metric": {
                    "cluster_type": "cluster",
                    "cpu": "0",
                    "instance": "cluster main xxx",
                    "mode": "idle",
                    "node_role": "main",
                    "resource_id": "xx-xx-xx-xx",
                    "resource_name": "mysql-name"
                },
                "value": [
                    1675452321.505,
                    "0.9931666666719442"
                ]
            }, 
            ....
@botelastic
Copy link

botelastic bot commented Feb 3, 2024

Hi! We just realized that we haven't looked into this issue in a while. We're sorry! We're labeling this issue as Stale to make it hit our filters and make sure we get back to it as soon as possible. In the meantime, it'd be extremely helpful if you could take a look at it as well and confirm its relevance. A simple comment with a nice emoji will be enough :+1. Thank you for your contribution!

@botelastic botelastic bot added the Stalled label Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant