move plugin interfaces into separate package

This commit is contained in:
David Norton
2016-12-23 10:18:27 -05:00
parent 3e6c4a53a4
commit 81caa56859
182 changed files with 817 additions and 817 deletions

View File

@@ -5,7 +5,7 @@ import (
"net/url"
"sync"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins"
"github.com/influxdata/telegraf/plugins/inputs"
"gopkg.in/dancannon/gorethink.v1"
@@ -36,7 +36,7 @@ var localhost = &Server{Url: &url.URL{Host: "127.0.0.1:28015"}}
// Reads stats from all configured servers accumulates stats.
// Returns one of the errors encountered while gather stats (if any).
func (r *RethinkDB) Gather(acc telegraf.Accumulator) error {
func (r *RethinkDB) Gather(acc plugins.Accumulator) error {
if len(r.Servers) == 0 {
r.gatherServer(localhost, acc)
return nil
@@ -66,7 +66,7 @@ func (r *RethinkDB) Gather(acc telegraf.Accumulator) error {
return outerr
}
func (r *RethinkDB) gatherServer(server *Server, acc telegraf.Accumulator) error {
func (r *RethinkDB) gatherServer(server *Server, acc plugins.Accumulator) error {
var err error
connectOpts := gorethink.ConnectOpts{
Address: server.Url.Host,
@@ -88,7 +88,7 @@ func (r *RethinkDB) gatherServer(server *Server, acc telegraf.Accumulator) error
}
func init() {
inputs.Add("rethinkdb", func() telegraf.Input {
inputs.Add("rethinkdb", func() plugins.Input {
return &RethinkDB{}
})
}

View File

@@ -4,7 +4,7 @@ import (
"reflect"
"time"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins"
)
type serverStatus struct {
@@ -88,7 +88,7 @@ var engineStats = map[string]string{
func (e *Engine) AddEngineStats(
keys []string,
acc telegraf.Accumulator,
acc plugins.Accumulator,
tags map[string]string,
) {
engine := reflect.ValueOf(e).Elem()
@@ -99,7 +99,7 @@ func (e *Engine) AddEngineStats(
acc.AddFields("rethinkdb_engine", fields, tags)
}
func (s *Storage) AddStats(acc telegraf.Accumulator, tags map[string]string) {
func (s *Storage) AddStats(acc plugins.Accumulator, tags map[string]string) {
fields := map[string]interface{}{
"cache_bytes_in_use": s.Cache.BytesInUse,
"disk_read_bytes_per_sec": s.Disk.ReadBytesPerSec,

View File

@@ -9,7 +9,7 @@ import (
"strconv"
"strings"
"github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins"
"gopkg.in/dancannon/gorethink.v1"
)
@@ -20,7 +20,7 @@ type Server struct {
serverStatus serverStatus
}
func (s *Server) gatherData(acc telegraf.Accumulator) error {
func (s *Server) gatherData(acc plugins.Accumulator) error {
if err := s.getServerStatus(); err != nil {
return fmt.Errorf("Failed to get server_status, %s\n", err)
}
@@ -110,7 +110,7 @@ var ClusterTracking = []string{
"written_docs_per_sec",
}
func (s *Server) addClusterStats(acc telegraf.Accumulator) error {
func (s *Server) addClusterStats(acc plugins.Accumulator) error {
cursor, err := gorethink.DB("rethinkdb").Table("stats").Get([]string{"cluster"}).Run(s.session)
if err != nil {
return fmt.Errorf("cluster stats query error, %s\n", err.Error())
@@ -138,7 +138,7 @@ var MemberTracking = []string{
"total_writes",
}
func (s *Server) addMemberStats(acc telegraf.Accumulator) error {
func (s *Server) addMemberStats(acc plugins.Accumulator) error {
cursor, err := gorethink.DB("rethinkdb").Table("stats").Get([]string{"server", s.serverStatus.Id}).Run(s.session)
if err != nil {
return fmt.Errorf("member stats query error, %s\n", err.Error())
@@ -162,7 +162,7 @@ var TableTracking = []string{
"total_writes",
}
func (s *Server) addTableStats(acc telegraf.Accumulator) error {
func (s *Server) addTableStats(acc plugins.Accumulator) error {
tablesCursor, err := gorethink.DB("rethinkdb").Table("table_status").Run(s.session)
defer tablesCursor.Close()
var tables []tableStatus