Add prometheus_client service output module, update prometheus client
- Adds a client implementation using the prometheus go_client library
that exposes metrics.
- Adds a new type of output "ServiceOutput" which follows inline with
the "ServicePlugin", adding a Stop and Start method for the service
This change also requires the newer prometheus/client_golang code, so
the prometheus plugin needed to be changed.
Added the following to Godep:
- bitbucket.org/ww/goautoneg (in github.com/common/expfmt/encode.go)
- prometheus/common/expfmt (in plugins/prometheus.go)
- github.com/prometheus/common/model (in plugins/prometheus.go)
- github.com/prometheus/procfs (in github.com/client_golang/prometheus)
- github.com/beorn7/perks/quantile (in github.com/client_golang/prometheus)
X-Github-Meta: closes #306
This commit is contained in:
committed by
Cameron Sparr
parent
7cc60dfb8f
commit
4449f7f2fb
@@ -230,6 +230,35 @@ func init() {
|
||||
|
||||
```
|
||||
|
||||
## Service Outputs
|
||||
|
||||
This section is for developers who want to create new "service" output. A
|
||||
service output differs from a regular output in that it operates a background service
|
||||
while Telegraf is running. One example would be the `prometheus_client` output,
|
||||
which operates an HTTP server.
|
||||
|
||||
Their interface is quite similar to a regular output, with the addition of `Start()`
|
||||
and `Stop()` methods.
|
||||
|
||||
### Service Output Guidelines
|
||||
|
||||
* Same as the `Output` guidelines, except that they must conform to the
|
||||
`plugins.ServiceOutput` interface.
|
||||
|
||||
### Service Output interface
|
||||
|
||||
```go
|
||||
type ServiceOutput interface {
|
||||
Connect() error
|
||||
Close() error
|
||||
Description() string
|
||||
SampleConfig() string
|
||||
Write(points []*client.Point) error
|
||||
Start() error
|
||||
Stop()
|
||||
}
|
||||
```
|
||||
|
||||
## Unit Tests
|
||||
|
||||
### Execute short tests
|
||||
|
||||
Reference in New Issue
Block a user