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.
VERSION := 0.1.0
TARGET := statsd_bridge
TARGET := statsd_exporter
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
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
### With StatsD
To pipe metrics from an existing StatsD environment into Prometheus, configure
StatsD's repeater backend to repeat all received packets to a StatsD-Bridge
process. This bridge translates StatsD metrics to Prometheus metrics via
StatsD's repeater backend to repeat all received packets to a `statsd_exporter`
process. This exporter translates StatsD metrics to Prometheus metrics via
configured mapping rules.
+----------+ +-----------------+ +--------------+
| StatsD |---(UDP repeater)--->| StatsD-Bridge |<---(scrape /metrics)---| Prometheus |
+----------+ +-----------------+ +--------------+
+----------+ +-------------------+ +--------------+
| StatsD |---(UDP repeater)--->| statsd_exporter |<---(scrape /metrics)---| Prometheus |
+----------+ +-------------------+ +--------------+
### Without StatsD
Since the StatsD bridge uses the same UDP protocol as StatsD itself, you can
also configure your applications to send StatsD metrics directly to the bridge.
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 exporter.
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
@ -29,8 +29,8 @@ in the long term.
## Building and Running
$ go build
$ ./statsd_bridge --help
Usage of ./statsd_bridge:
$ ./statsd_exporter --help
Usage of ./statsd_exporter:
-statsd.listen-address=":9125": The UDP address on which to receive statsd metric lines.
-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.
@ -42,7 +42,7 @@ in the long term.
## 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
mapping definition starts with a line matching the StatsD metric in question,
with `*`s acting as wildcards for each dot-separated metric component. The
@ -97,14 +97,14 @@ follows:
## 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:
```bash
docker pull prom/statsd-bridge
docker pull prom/statsd-exporter
docker run -d -p 9102:9102 -p 9125/udp:9125/udp \
-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 (
defaultHelp = "Metric autogenerated by statsd_bridge."
defaultHelp = "Metric autogenerated by statsd_exporter."
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"
)
@ -171,7 +171,7 @@ func (t *TimerEvent) Value() float64 { return t.value }
type Events []Event
type Bridge struct {
type Exporter struct {
Counters *CounterContainer
Gauges *GaugeContainer
Summaries *SummaryContainer
@ -189,7 +189,7 @@ func escapeMetricName(metricName string) string {
return metricName
}
func (b *Bridge) Listen(e <-chan Events) {
func (b *Exporter) Listen(e <-chan Events) {
for {
events := <-e
for _, event := range events {
@ -244,8 +244,8 @@ func (b *Bridge) Listen(e <-chan Events) {
}
}
func NewBridge(mapper *metricMapper) *Bridge {
return &Bridge{
func NewExporter(mapper *metricMapper) *Exporter {
return &Exporter{
Counters: NewCounterContainer(),
Gauges: NewGaugeContainer(),
Summaries: NewSummaryContainer(),

View file

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

View file

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