Skip to content

Conversation

@ChrsMark
Copy link
Member

@ChrsMark ChrsMark commented Mar 12, 2020

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

What does this PR do?

This PR implements Prometheus remote write as a new metricset.

Why is it important?

How to test this PR locally

Start metricbeat

  1. Enable metricbeat Prometheus module
  2. config:
- module: prometheus
  period: 10s
  metricsets: ["remote_write"]
  1. start metricbeat and expect to see:
2020-02-27T17:49:14.724+0200	DEBUG	[module]	module/wrapper.go:189	Starting metricSetWrapper[module=prometheus, name=remote_write, host=]
2020-02-27T17:49:14.724+0200	INFO	remote_write/remote_write.go:92	Starting HTTP server on localhost:9201

Sending metrics from Prometheus

Use this forked project: https://github.com/ChrsMark/dockprom.

  1. Download the project.
  2. Add to `prometheus/prometheus.yml:
remote_write:
  - url: "http://host.docker.internal:9201/write"
  1. docker-compose up

With that metrics should be collected by metricbeat and reported.

Related issues

Notes about changes

This PR changes HttpServer so as to accept handlerFunc from metricset on server initialisation. This makes it reusable from different metricsets and not only server metricset of http module. In order to confirm that server metricset of http module is not broken I run INTEGRATION_TESTS=1 BEAT_STRICT_PERMS=false nosetests ./module/http/test_http.py successfully which shows that functionality is preserved.

@ChrsMark ChrsMark self-assigned this Mar 12, 2020
@ChrsMark ChrsMark added Team:Integrations Label for the Integrations team Team:Platforms Label for the Integrations - Platforms team labels Mar 12, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/integrations (Team:Integrations)

@elasticmachine
Copy link
Contributor

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

@ChrsMark ChrsMark requested a review from jsoriano March 13, 2020 14:16
@ChrsMark ChrsMark merged commit d8cd2ff into elastic:7.x Mar 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport review Team:Integrations Label for the Integrations team Team:Platforms Label for the Integrations - Platforms team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants