Create public models for telegraf metrics, accumlator, plugins

This will basically make the root directory a place for storing the
major telegraf interfaces, which will make telegraf's godoc looks quite
a bit nicer. And make it easier for contributors to lookup the few data
types that they actually care about.

closes #564
This commit is contained in:
Cameron Sparr
2016-01-27 14:21:36 -07:00
parent a822d942cd
commit 9c0d14bb60
83 changed files with 699 additions and 525 deletions

View File

@@ -11,6 +11,7 @@ import (
"sync"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/inputs"
)
@@ -31,7 +32,7 @@ func (n *Nginx) Description() string {
return "Read Nginx's basic status information (ngx_http_stub_status_module)"
}
func (n *Nginx) Gather(acc inputs.Accumulator) error {
func (n *Nginx) Gather(acc telegraf.Accumulator) error {
var wg sync.WaitGroup
var outerr error
@@ -59,7 +60,7 @@ var tr = &http.Transport{
var client = &http.Client{Transport: tr}
func (n *Nginx) gatherUrl(addr *url.URL, acc inputs.Accumulator) error {
func (n *Nginx) gatherUrl(addr *url.URL, acc telegraf.Accumulator) error {
resp, err := client.Get(addr.String())
if err != nil {
return fmt.Errorf("error making HTTP request to %s: %s", addr.String(), err)
@@ -159,7 +160,7 @@ func getTags(addr *url.URL) map[string]string {
}
func init() {
inputs.Add("nginx", func() inputs.Input {
inputs.Add("nginx", func() telegraf.Input {
return &Nginx{}
})
}