Document and add support to input plugins for logging alias (#6357)

This commit is contained in:
Greg
2019-09-23 16:39:50 -06:00
committed by Daniel Nelson
parent e42d2e39c6
commit 817c9a69a9
111 changed files with 961 additions and 659 deletions

View File

@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"log"
"net/http"
"strconv"
"strings"
@@ -29,6 +28,8 @@ type Jenkins struct {
tls.ClientConfig
client *client
Log telegraf.Logger
MaxConnections int `toml:"max_connections"`
MaxBuildAge internal.Duration `toml:"max_build_age"`
MaxSubJobDepth int `toml:"max_subjob_depth"`
@@ -304,7 +305,7 @@ func (j *Jenkins) getJobDetail(jr jobRequest, acc telegraf.Accumulator) error {
}
if build.Building {
log.Printf("D! Ignore running build on %s, build %v", jr.name, number)
j.Log.Debugf("Ignore running build on %s, build %v", jr.name, number)
return nil
}

View File

@@ -206,6 +206,7 @@ func TestGatherNodeData(t *testing.T) {
ts := httptest.NewServer(test.input)
defer ts.Close()
j := &Jenkins{
Log: testutil.Logger{},
URL: ts.URL,
ResponseTimeout: internal.Duration{Duration: time.Microsecond},
NodeExclude: []string{"ignore-1", "ignore-2"},
@@ -258,6 +259,7 @@ func TestInitialize(t *testing.T) {
{
name: "bad jenkins config",
input: &Jenkins{
Log: testutil.Logger{},
URL: "http://a bad url",
ResponseTimeout: internal.Duration{Duration: time.Microsecond},
},
@@ -266,6 +268,7 @@ func TestInitialize(t *testing.T) {
{
name: "has filter",
input: &Jenkins{
Log: testutil.Logger{},
URL: ts.URL,
ResponseTimeout: internal.Duration{Duration: time.Microsecond},
JobExclude: []string{"job1", "job2"},
@@ -275,10 +278,12 @@ func TestInitialize(t *testing.T) {
{
name: "default config",
input: &Jenkins{
Log: testutil.Logger{},
URL: ts.URL,
ResponseTimeout: internal.Duration{Duration: time.Microsecond},
},
output: &Jenkins{
Log: testutil.Logger{},
MaxConnections: 5,
MaxSubJobPerLayer: 10,
},
@@ -570,6 +575,7 @@ func TestGatherJobs(t *testing.T) {
ts := httptest.NewServer(test.input)
defer ts.Close()
j := &Jenkins{
Log: testutil.Logger{},
URL: ts.URL,
MaxBuildAge: internal.Duration{Duration: time.Hour},
ResponseTimeout: internal.Duration{Duration: time.Microsecond},