Merge pull request #26 from macb/exporter_rename

rename bridge to exporter
This commit is contained in:
Julius Volz 2015-10-17 15:50:01 +02:00
commit 3727277927
6 changed files with 30 additions and 30 deletions

View file

@ -12,6 +12,6 @@
# limitations under the License. # limitations under the License.
VERSION := 0.1.0 VERSION := 0.1.0
TARGET := statsd_bridge TARGET := statsd_exporter
include Makefile.COMMON include Makefile.COMMON

2
NOTICE
View file

@ -1,4 +1,4 @@
StatsD-to-Prometheus bridge StatsD-to-Prometheus exporter
Copyright 2013-2015 The Prometheus Authors Copyright 2013-2015 The Prometheus Authors
This product includes software developed at This product includes software developed at

View file

@ -1,25 +1,25 @@
StatsD-Bridge statsd_exporter
============= =============
StatsD-Bridge receives StatsD-style metrics and exports them as Prometheus metrics. `statsd_exporter` receives StatsD-style metrics and exports them as Prometheus metrics.
## Overview ## Overview
### With StatsD ### With StatsD
To pipe metrics from an existing StatsD environment into Prometheus, configure To pipe metrics from an existing StatsD environment into Prometheus, configure
StatsD's repeater backend to repeat all received packets to a StatsD-Bridge StatsD's repeater backend to repeat all received packets to a `statsd_exporter`
process. This bridge translates StatsD metrics to Prometheus metrics via process. This exporter translates StatsD metrics to Prometheus metrics via
configured mapping rules. configured mapping rules.
+----------+ +-----------------+ +--------------+ +----------+ +-------------------+ +--------------+
| StatsD |---(UDP repeater)--->| StatsD-Bridge |<---(scrape /metrics)---| Prometheus | | StatsD |---(UDP repeater)--->| statsd_exporter |<---(scrape /metrics)---| Prometheus |
+----------+ +-----------------+ +--------------+ +----------+ +-------------------+ +--------------+
### Without StatsD ### Without StatsD
Since the StatsD bridge uses the same UDP protocol as StatsD itself, you can Since the StatsD exporter uses the same UDP protocol as StatsD itself, you can
also configure your applications to send StatsD metrics directly to the bridge. also configure your applications to send StatsD metrics directly to the exporter.
In that case, you don't need to run a StatsD server anymore. In that case, you don't need to run a StatsD server anymore.
We recommend this only as an intermediate solution and recommend switching to We recommend this only as an intermediate solution and recommend switching to
@ -29,8 +29,8 @@ in the long term.
## Building and Running ## Building and Running
$ go build $ go build
$ ./statsd_bridge --help $ ./statsd_exporter --help
Usage of ./statsd_bridge: Usage of ./statsd_exporter:
-statsd.listen-address=":9125": The UDP address on which to receive statsd metric lines. -statsd.listen-address=":9125": The UDP address on which to receive statsd metric lines.
-statsd.mapping-config="": Metric mapping configuration file name. -statsd.mapping-config="": Metric mapping configuration file name.
-web.listen-address=":9102": The address on which to expose the web interface and generated Prometheus metrics. -web.listen-address=":9102": The address on which to expose the web interface and generated Prometheus metrics.
@ -42,7 +42,7 @@ in the long term.
## Metric Mapping and Configuration ## Metric Mapping and Configuration
The StatsD-Bridge can be configured to translate specific dot-separated StatsD The `statsd_exporter` can be configured to translate specific dot-separated StatsD
metrics into labeled Prometheus metrics via a simple mapping language. A metrics into labeled Prometheus metrics via a simple mapping language. A
mapping definition starts with a line matching the StatsD metric in question, mapping definition starts with a line matching the StatsD metric in question,
with `*`s acting as wildcards for each dot-separated metric component. The with `*`s acting as wildcards for each dot-separated metric component. The
@ -97,14 +97,14 @@ follows:
## Using Docker ## Using Docker
You can deploy this exporter using the [prom/statsd-bridge](https://registry.hub.docker.com/u/prom/statsd-bridge/) Docker image. You can deploy this exporter using the [prom/statsd-exporter](https://registry.hub.docker.com/u/prom/statsd-exporter/) Docker image.
For example: For example:
```bash ```bash
docker pull prom/statsd-bridge docker pull prom/statsd-exporter
docker run -d -p 9102:9102 -p 9125/udp:9125/udp \ docker run -d -p 9102:9102 -p 9125/udp:9125/udp \
-v $PWD/statsd_mapping.conf:/tmp/statsd_mapping.conf \ -v $PWD/statsd_mapping.conf:/tmp/statsd_mapping.conf \
prom/statsd-bridge -statsd.mapping-config=/tmp/statsd_mapping.conf prom/statsd-exporter -statsd.mapping-config=/tmp/statsd_mapping.conf
``` ```

View file

@ -29,9 +29,9 @@ import (
) )
const ( const (
defaultHelp = "Metric autogenerated by statsd_bridge." defaultHelp = "Metric autogenerated by statsd_exporter."
regErrF = "A change of configuration created inconsistent metrics for " + regErrF = "A change of configuration created inconsistent metrics for " +
"%q. You have to restart the statsd_bridge, and you should " + "%q. You have to restart the statsd_exporter, and you should " +
"consider the effects on your monitoring setup. Error: %s" "consider the effects on your monitoring setup. Error: %s"
) )
@ -171,7 +171,7 @@ func (t *TimerEvent) Value() float64 { return t.value }
type Events []Event type Events []Event
type Bridge struct { type Exporter struct {
Counters *CounterContainer Counters *CounterContainer
Gauges *GaugeContainer Gauges *GaugeContainer
Summaries *SummaryContainer Summaries *SummaryContainer
@ -189,7 +189,7 @@ func escapeMetricName(metricName string) string {
return metricName return metricName
} }
func (b *Bridge) Listen(e <-chan Events) { func (b *Exporter) Listen(e <-chan Events) {
for { for {
events := <-e events := <-e
for _, event := range events { for _, event := range events {
@ -244,8 +244,8 @@ func (b *Bridge) Listen(e <-chan Events) {
} }
} }
func NewBridge(mapper *metricMapper) *Bridge { func NewExporter(mapper *metricMapper) *Exporter {
return &Bridge{ return &Exporter{
Counters: NewCounterContainer(), Counters: NewCounterContainer(),
Gauges: NewGaugeContainer(), Gauges: NewGaugeContainer(),
Summaries: NewSummaryContainer(), Summaries: NewSummaryContainer(),

View file

@ -108,7 +108,7 @@ func watchConfig(fileName string, mapper *metricMapper) {
func main() { func main() {
flag.Parse() flag.Parse()
log.Println("Starting StatsD -> Prometheus Bridge...") log.Println("Starting StatsD -> Prometheus Exporter...")
log.Println("Accepting StatsD Traffic on", *statsdListenAddress) log.Println("Accepting StatsD Traffic on", *statsdListenAddress)
log.Println("Accepting Prometheus Requests on", *listenAddress) log.Println("Accepting Prometheus Requests on", *listenAddress)
@ -141,6 +141,6 @@ func main() {
} }
go watchConfig(*mappingConfig, mapper) go watchConfig(*mappingConfig, mapper)
} }
bridge := NewBridge(mapper) exporter := NewExporter(mapper)
bridge.Listen(events) exporter.Listen(events)
} }

View file

@ -20,27 +20,27 @@ import (
var ( var (
eventStats = prometheus.NewCounterVec( eventStats = prometheus.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "statsd_bridge_events_total", Name: "statsd_exporter_events_total",
Help: "The total number of StatsD events seen.", Help: "The total number of StatsD events seen.",
}, },
[]string{"type"}, []string{"type"},
) )
networkStats = prometheus.NewCounterVec( networkStats = prometheus.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "statsd_bridge_packets_total", Name: "statsd_exporter_packets_total",
Help: "The total number of StatsD packets seen.", Help: "The total number of StatsD packets seen.",
}, },
[]string{"type"}, []string{"type"},
) )
configLoads = prometheus.NewCounterVec( configLoads = prometheus.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Name: "statsd_bridge_config_reloads_total", Name: "statsd_exporter_config_reloads_total",
Help: "The number of configuration reloads.", Help: "The number of configuration reloads.",
}, },
[]string{"outcome"}, []string{"outcome"},
) )
mappingsCount = prometheus.NewGauge(prometheus.GaugeOpts{ mappingsCount = prometheus.NewGauge(prometheus.GaugeOpts{
Name: "statsd_bridge_loaded_mappings_count", Name: "statsd_exporter_loaded_mappings_count",
Help: "The number of configured metric mappings.", Help: "The number of configured metric mappings.",
}) })
) )