Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #27 from runabove/refactor-sources-to-scraper
Browse files Browse the repository at this point in the history
Refactor sources to scrapers
  • Loading branch information
d33d33 authored May 24, 2017
2 parents a3b3b42 + 3a06974 commit df506f4
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 154 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "beamium"
version = "1.4.2"
version = "1.5.0"
authors = [ "d33d33 <kevin.georges@corp.ovh.com>" ]

build = "build.rs"
Expand Down
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Beamium - Prometheus to Warp10 metrics forwarder
# Beamium - /metrics scraper (Warp10 & Prometheus) with DFO buffering, and Warp10 forward.
[![version](https://img.shields.io/badge/status-alpha-orange.svg)](https://github.com/runabove/beamium)
[![Build Status](https://travis-ci.org/runabove/beamium.svg?branch=master)](https://travis-ci.org/runabove/beamium)

Beamium collect metrics from Prometheus endpoints and forward them to Warp10 data platform.
Beamium collect metrics from /metrics HTTP endpoints (with support for Prometheus & Warp10/Sensision format) and forward them to Warp10 data platform. While acquiring metrics, Beamium uses DFO (Disk Fail Over) to prevent metrics loss due to eventual network issues or unavailable service.

Beamium is written in Rust to ensure efficiency, a very low footprint and deterministic performances.

Expand All @@ -12,6 +12,20 @@ Beamium key points:
- **Versatile**: Beamium can also fetch metrics from a directory.
- **Powerful**: Beamium is able to filter metrics and to send them to multiple Warp10 platforms.

## How it works?

Scraper (optionals) will collect metrics from defined endpoints. They will store them into the source_dir.
Beamium will read files inside source_dir, and will fan out them according to the provided selector into sink_dir.
Finaly Beamium will push files from the sink_dir to the defined sinks.

The pipeline can be describe this way :

HTTP /metrics endpoint --scrape--> source_dir --route--> sink_dir --forward--> warp10

It also means that given your need, you could produce metrics directly to source/sink directory, example :

$ TS=`date +%s` && echo $TS"000000// metrics{} true" >> /opt/beamium/data/sources/prefix-$TS.metrics

## Status
Beamium is currently under development.

Expand All @@ -27,11 +41,11 @@ Beamium come with a [sample config file](config.sample.yaml). Simply copy the sa
### Definitions
Config is composed of four parts:

#### Sources
Beamium can have none to many Prometheus endpoints. A *source* is defined as follow:
#### Scrapers
Beamium can have none to many Prometheus or Warp10/Sensision endpoints. A *scraper* is defined as follow:
``` yaml
sources: # Sources definitions (Optional)
source1: # Source name (Required)
scrapers: # Scrapers definitions (Optional)
scraper1: # Source name (Required)
url: http://127.0.0.1:9100/metrics # Prometheus endpoint (Required)
period: 10000 # Polling interval(ms) (Required)
format: prometheus # Polling format (Optional, default: prometheus, value: [prometheus, sensision])
Expand Down
13 changes: 7 additions & 6 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ use std::io::prelude::*;

fn main() {
let output = Command::new("git")
.arg("rev-parse")
.arg("HEAD")
.output()
.expect("failed to execute process");
.arg("rev-parse")
.arg("HEAD")
.output()
.expect("failed to execute process");

let hash = String::from_utf8_lossy(&output.stdout);
let content = format!("static COMMIT: &'static str = {:?};\n", hash.trim());
Expand All @@ -18,10 +18,11 @@ fn main() {
if path.exists() {
let mut f = File::open(path).expect("fail to open result.rs");
let mut current = String::new();
f.read_to_string(&mut current).expect("fail to read result.rs");
f.read_to_string(&mut current)
.expect("fail to read result.rs");

if current == content {
return
return;
}
};

Expand Down
Loading

0 comments on commit df506f4

Please sign in to comment.