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

Cherry-pick #17104 to 7.x: [Metricbeat] Add 'query' metricset for prometheus module #17178

Merged
merged 1 commit into from
Mar 23, 2020

Conversation

ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Mar 23, 2020

Cherry-pick of PR #17104 to 7.x branch. Original message:

What does this PR do?

Adds 'query' metricset for prometheus module. It continues the PR #15177, and aims to the cleanups/changes required.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works

How to test this PR locally

  1. Start a Prometheus container: docker run -p 9090:9090 prom/prometheus
  2. Enable Prometheus module of Metricbeat and test with the following cases:
    a.
- module: prometheus
  period: 10s
  hosts: ["localhost:9090"]
  metricsets: ["query"]
  queries:
  - query_name: "string"
    path: "/api/v1/query"
    query_params:
      query: "some_value"

b.

- module: prometheus
  period: 10s
  hosts: ["localhost:9090"]
  metricsets: ["query"]
  queries:
  - query_name: "scalar"
    path: "/api/v1/query"
    query_params:
      query: "100"

c.

- module: prometheus
  period: 10s
  hosts: ["localhost:9090"]
  metricsets: ["query"]
  queries:
  - query_name: "instant_vector"
    path: "/api/v1/query"
    query_params:
      query: "sum(rate(prometheus_http_requests_total[1m]))"

d.
Change time range accordingly. Also some time is needed so the the metrics to have been populated in Prometheus for the respective range

- module: prometheus
  period: 10s
  hosts: ["localhost:9090"]
  metricsets: ["query"]
  queries:
  - query_name: "range_vector"
    path: "/api/v1/query_range"
    query_params:
      query: "up"
      start: "2020-03-20T00:00:00.000Z"
      end:  "2020-03-20T00:00:10.000Z"
      step: 1m

Related issues

Co-authored-by: esther kim <jabbukka@naver.com>
(cherry picked from commit 7c82034)
@ChrsMark ChrsMark requested review from a team March 23, 2020 12:51
@ChrsMark ChrsMark self-assigned this Mar 23, 2020
@ChrsMark ChrsMark added [zube]: In Review Team:Platforms Label for the Integrations - Platforms team labels Mar 23, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/integrations-platforms (Team:Platforms)

@zube zube bot removed the Team:Platforms Label for the Integrations - Platforms team label Mar 23, 2020
@ChrsMark ChrsMark merged commit 952e72d into elastic:7.x Mar 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants