Fix typos in comments (#3415)
This commit is contained in:
parent
63842d48fd
commit
5f215c22fe
|
@ -252,7 +252,7 @@ func (a *Agent) flusher(shutdown chan struct{}, metricC chan telegraf.Metric, ag
|
||||||
// the flusher will flush after metrics are collected.
|
// the flusher will flush after metrics are collected.
|
||||||
time.Sleep(time.Millisecond * 300)
|
time.Sleep(time.Millisecond * 300)
|
||||||
|
|
||||||
// create an output metric channel and a gorouting that continously passes
|
// create an output metric channel and a gorouting that continuously passes
|
||||||
// each metric onto the output plugins & aggregators.
|
// each metric onto the output plugins & aggregators.
|
||||||
outMetricC := make(chan telegraf.Metric, 100)
|
outMetricC := make(chan telegraf.Metric, 100)
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
|
|
@ -126,7 +126,7 @@ type AgentConfig struct {
|
||||||
|
|
||||||
// TODO(cam): Remove UTC and parameter, they are no longer
|
// TODO(cam): Remove UTC and parameter, they are no longer
|
||||||
// valid for the agent config. Leaving them here for now for backwards-
|
// valid for the agent config. Leaving them here for now for backwards-
|
||||||
// compatability
|
// compatibility
|
||||||
UTC bool `toml:"utc"`
|
UTC bool `toml:"utc"`
|
||||||
|
|
||||||
// Debug is the option for running in debug mode
|
// Debug is the option for running in debug mode
|
||||||
|
@ -683,7 +683,7 @@ func (c *Config) LoadConfig(path string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// trimBOM trims the Byte-Order-Marks from the beginning of the file.
|
// trimBOM trims the Byte-Order-Marks from the beginning of the file.
|
||||||
// this is for Windows compatability only.
|
// this is for Windows compatibility only.
|
||||||
// see https://github.com/influxdata/telegraf/issues/1378
|
// see https://github.com/influxdata/telegraf/issues/1378
|
||||||
func trimBOM(f []byte) []byte {
|
func trimBOM(f []byte) []byte {
|
||||||
return bytes.TrimPrefix(f, []byte("\xef\xbb\xbf"))
|
return bytes.TrimPrefix(f, []byte("\xef\xbb\xbf"))
|
||||||
|
|
|
@ -647,7 +647,7 @@ func skipWhitespace(buf []byte, i int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
// makeError is a helper function for making a metric parsing error.
|
// makeError is a helper function for making a metric parsing error.
|
||||||
// reason is the reason that the error occured.
|
// reason is the reason why the error occurred.
|
||||||
// buf should be the current buffer we are parsing.
|
// buf should be the current buffer we are parsing.
|
||||||
// i is the current index, to give some context on where in the buffer we are.
|
// i is the current index, to give some context on where in the buffer we are.
|
||||||
func makeError(reason string, buf []byte, i int) error {
|
func makeError(reason string, buf []byte, i int) error {
|
||||||
|
|
|
@ -181,7 +181,7 @@ func TestMetricReader_SplitWithExactLengthSplit(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regresssion test for when a metric requires to be split and one of the
|
// Regression test for when a metric requires to be split and one of the
|
||||||
// split metrics is larger than the buffer.
|
// split metrics is larger than the buffer.
|
||||||
//
|
//
|
||||||
// Previously the metric index would be set incorrectly causing a panic.
|
// Previously the metric index would be set incorrectly causing a panic.
|
||||||
|
@ -218,7 +218,7 @@ func TestMetricReader_SplitOverflowOversized(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regresssion test for when a split metric exactly fits in the buffer.
|
// Regression test for when a split metric exactly fits in the buffer.
|
||||||
//
|
//
|
||||||
// Previously the metric would be overflow split when not required.
|
// Previously the metric would be overflow split when not required.
|
||||||
func TestMetricReader_SplitOverflowUneeded(t *testing.T) {
|
func TestMetricReader_SplitOverflowUneeded(t *testing.T) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ func (c *CloudWatch) SampleConfig() string {
|
||||||
## Collection Delay (required - must account for metrics availability via CloudWatch API)
|
## Collection Delay (required - must account for metrics availability via CloudWatch API)
|
||||||
delay = "5m"
|
delay = "5m"
|
||||||
|
|
||||||
## Recomended: use metric 'interval' that is a multiple of 'period' to avoid
|
## Recommended: use metric 'interval' that is a multiple of 'period' to avoid
|
||||||
## gaps or overlap in pulled data
|
## gaps or overlap in pulled data
|
||||||
interval = "5m"
|
interval = "5m"
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ var sampleConfig = `
|
||||||
## http://admin:secret@couchbase-0.example.com:8091/
|
## http://admin:secret@couchbase-0.example.com:8091/
|
||||||
##
|
##
|
||||||
## If no servers are specified, then localhost is used as the host.
|
## If no servers are specified, then localhost is used as the host.
|
||||||
## If no protocol is specifed, HTTP is used.
|
## If no protocol is specified, HTTP is used.
|
||||||
## If no port is specified, 8091 is used.
|
## If no port is specified, 8091 is used.
|
||||||
servers = ["http://localhost:8091"]
|
servers = ["http://localhost:8091"]
|
||||||
`
|
`
|
||||||
|
|
|
@ -17,7 +17,7 @@ type DnsQuery struct {
|
||||||
// Domains or subdomains to query
|
// Domains or subdomains to query
|
||||||
Domains []string
|
Domains []string
|
||||||
|
|
||||||
// Network protocl name
|
// Network protocol name
|
||||||
Network string
|
Network string
|
||||||
|
|
||||||
// Server to query
|
// Server to query
|
||||||
|
|
|
@ -35,7 +35,7 @@ var sampleConfig = `
|
||||||
##
|
##
|
||||||
# servers = ["USERID:PASSW0RD@lan(192.168.1.1)"]
|
# servers = ["USERID:PASSW0RD@lan(192.168.1.1)"]
|
||||||
|
|
||||||
## Recomended: use metric 'interval' that is a multiple of 'timeout' to avoid
|
## Recommended: use metric 'interval' that is a multiple of 'timeout' to avoid
|
||||||
## gaps or overlap in pulled data
|
## gaps or overlap in pulled data
|
||||||
interval = "30s"
|
interval = "30s"
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ func TestIptables_Gather(t *testing.T) {
|
||||||
K 4520 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0
|
K 4520 RETURN tcp -- * * 0.0.0.0/0 0.0.0.0/0
|
||||||
`},
|
`},
|
||||||
},
|
},
|
||||||
{ // 8 - Multiple rows, multipe chains => no error
|
{ // 8 - Multiple rows, multiple chains => no error
|
||||||
table: "filter",
|
table: "filter",
|
||||||
chains: []string{"INPUT", "FORWARD"},
|
chains: []string{"INPUT", "FORWARD"},
|
||||||
values: []string{
|
values: []string{
|
||||||
|
|
|
@ -367,7 +367,7 @@ func getMetrics(role Role, group string) []string {
|
||||||
ret, ok := m[group]
|
ret, ok := m[group]
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Printf("I! [mesos] Unkown %s metrics group: %s\n", role, group)
|
log.Printf("I! [mesos] Unknown %s metrics group: %s\n", role, group)
|
||||||
return []string{}
|
return []string{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ func (c *Client) Send(typ int32, command string) (response *Packet, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewClient creates a new Client type, creating the connection
|
// NewClient creates a new Client type, creating the connection
|
||||||
// to the server specified by the host and port arguements. If
|
// to the server specified by the host and port arguments. If
|
||||||
// the connection fails, an error is returned.
|
// the connection fails, an error is returned.
|
||||||
func NewClient(host string, port int) (client *Client, err error) {
|
func NewClient(host string, port int) (client *Client, err error) {
|
||||||
client = new(Client)
|
client = new(Client)
|
||||||
|
|
|
@ -47,7 +47,7 @@ func (s *Minecraft) SampleConfig() string {
|
||||||
return sampleConfig
|
return sampleConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gather uses the RCON protocal to collect player and
|
// Gather uses the RCON protocol to collect player and
|
||||||
// scoreboard stats from a minecraft server.
|
// scoreboard stats from a minecraft server.
|
||||||
//var hasClient bool = false
|
//var hasClient bool = false
|
||||||
func (s *Minecraft) Gather(acc telegraf.Accumulator) error {
|
func (s *Minecraft) Gather(acc telegraf.Accumulator) error {
|
||||||
|
|
|
@ -76,7 +76,7 @@ func newClient(server, port string) (*rcon.Client, error) {
|
||||||
return client, nil
|
return client, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gather recieves all player scoreboard information and returns it per player.
|
// Gather receives all player scoreboard information and returns it per player.
|
||||||
func (r *RCON) Gather(producer RCONClientProducer) ([]string, error) {
|
func (r *RCON) Gather(producer RCONClientProducer) ([]string, error) {
|
||||||
if r.client == nil {
|
if r.client == nil {
|
||||||
var err error
|
var err error
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (client *conn) Request(
|
||||||
rec := &record{}
|
rec := &record{}
|
||||||
var err1 error
|
var err1 error
|
||||||
|
|
||||||
// recive untill EOF or FCGI_END_REQUEST
|
// recive until EOF or FCGI_END_REQUEST
|
||||||
READ_LOOP:
|
READ_LOOP:
|
||||||
for {
|
for {
|
||||||
err1 = rec.read(client.rwc)
|
err1 = rec.read(client.rwc)
|
||||||
|
|
|
@ -62,7 +62,7 @@ func TestPhpFpmGeneratesMetrics_From_Fcgi(t *testing.T) {
|
||||||
// Let OS find an available port
|
// Let OS find an available port
|
||||||
tcp, err := net.Listen("tcp", "127.0.0.1:0")
|
tcp, err := net.Listen("tcp", "127.0.0.1:0")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Cannot initalize test server")
|
t.Fatal("Cannot initialize test server")
|
||||||
}
|
}
|
||||||
defer tcp.Close()
|
defer tcp.Close()
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ func TestPhpFpmGeneratesMetrics_From_Socket(t *testing.T) {
|
||||||
binary.Read(rand.Reader, binary.LittleEndian, &randomNumber)
|
binary.Read(rand.Reader, binary.LittleEndian, &randomNumber)
|
||||||
tcp, err := net.Listen("unix", fmt.Sprintf("/tmp/test-fpm%d.sock", randomNumber))
|
tcp, err := net.Listen("unix", fmt.Sprintf("/tmp/test-fpm%d.sock", randomNumber))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Cannot initalize server on port ")
|
t.Fatal("Cannot initialize server on port ")
|
||||||
}
|
}
|
||||||
|
|
||||||
defer tcp.Close()
|
defer tcp.Close()
|
||||||
|
@ -150,7 +150,7 @@ func TestPhpFpmGeneratesMetrics_From_Socket_Custom_Status_Path(t *testing.T) {
|
||||||
binary.Read(rand.Reader, binary.LittleEndian, &randomNumber)
|
binary.Read(rand.Reader, binary.LittleEndian, &randomNumber)
|
||||||
tcp, err := net.Listen("unix", fmt.Sprintf("/tmp/test-fpm%d.sock", randomNumber))
|
tcp, err := net.Listen("unix", fmt.Sprintf("/tmp/test-fpm%d.sock", randomNumber))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Cannot initalize server on port ")
|
t.Fatal("Cannot initialize server on port ")
|
||||||
}
|
}
|
||||||
|
|
||||||
defer tcp.Close()
|
defer tcp.Close()
|
||||||
|
|
|
@ -175,7 +175,7 @@ func (p *Ping) Gather(acc telegraf.Accumulator) error {
|
||||||
totalTimeout := p.timeout() * float64(p.Count)
|
totalTimeout := p.timeout() * float64(p.Count)
|
||||||
out, err := p.pingHost(totalTimeout, args...)
|
out, err := p.pingHost(totalTimeout, args...)
|
||||||
// ping host return exitcode != 0 also when there was no response from host
|
// ping host return exitcode != 0 also when there was no response from host
|
||||||
// but command was execute succesfully
|
// but command was execute successfully
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Combine go err + stderr output
|
// Combine go err + stderr output
|
||||||
pendingError = errors.New(strings.TrimSpace(out) + ", " + err.Error())
|
pendingError = errors.New(strings.TrimSpace(out) + ", " + err.Error())
|
||||||
|
|
|
@ -76,7 +76,7 @@ func TestMemcachedGeneratesMetrics(t *testing.T) {
|
||||||
binary.Read(rand.Reader, binary.LittleEndian, &randomNumber)
|
binary.Read(rand.Reader, binary.LittleEndian, &randomNumber)
|
||||||
socket, err := net.Listen("unix", fmt.Sprintf("/tmp/pdns%d.controlsocket", randomNumber))
|
socket, err := net.Listen("unix", fmt.Sprintf("/tmp/pdns%d.controlsocket", randomNumber))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Cannot initalize server on port ")
|
t.Fatal("Cannot initialize server on port ")
|
||||||
}
|
}
|
||||||
|
|
||||||
defer socket.Close()
|
defer socket.Close()
|
||||||
|
|
|
@ -66,7 +66,7 @@ type Statsd struct {
|
||||||
|
|
||||||
// MetricSeparator is the separator between parts of the metric name.
|
// MetricSeparator is the separator between parts of the metric name.
|
||||||
MetricSeparator string
|
MetricSeparator string
|
||||||
// This flag enables parsing of tags in the dogstatsd extention to the
|
// This flag enables parsing of tags in the dogstatsd extension to the
|
||||||
// statsd protocol (http://docs.datadoghq.com/guides/dogstatsd/)
|
// statsd protocol (http://docs.datadoghq.com/guides/dogstatsd/)
|
||||||
ParseDataDogTags bool
|
ParseDataDogTags bool
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ var sampleConfig = `
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
## Options for the sadf command. The values on the left represent the sadf
|
## Options for the sadf command. The values on the left represent the sadf
|
||||||
## options and the values on the right their description (wich are used for
|
## options and the values on the right their description (which are used for
|
||||||
## grouping and prefixing metrics).
|
## grouping and prefixing metrics).
|
||||||
##
|
##
|
||||||
## Run 'sar -h' or 'man sar' to find out the supported options for your
|
## Run 'sar -h' or 'man sar' to find out the supported options for your
|
||||||
|
|
|
@ -54,7 +54,7 @@ func TestCPUStats(t *testing.T) {
|
||||||
err := cs.Gather(&acc)
|
err := cs.Gather(&acc)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Computed values are checked with delta > 0 becasue of floating point arithmatic
|
// Computed values are checked with delta > 0 because of floating point arithmatic
|
||||||
// imprecision
|
// imprecision
|
||||||
assertContainsTaggedFloat(t, &acc, "cpu", "time_user", 8.8, 0, cputags)
|
assertContainsTaggedFloat(t, &acc, "cpu", "time_user", 8.8, 0, cputags)
|
||||||
assertContainsTaggedFloat(t, &acc, "cpu", "time_system", 8.2, 0, cputags)
|
assertContainsTaggedFloat(t, &acc, "cpu", "time_system", 8.2, 0, cputags)
|
||||||
|
@ -105,7 +105,7 @@ func TestCPUStats(t *testing.T) {
|
||||||
// specific tags within a certain distance of a given expected value. Asserts a failure
|
// specific tags within a certain distance of a given expected value. Asserts a failure
|
||||||
// if the measurement is of the wrong type, or if no matching measurements are found
|
// if the measurement is of the wrong type, or if no matching measurements are found
|
||||||
//
|
//
|
||||||
// Paramaters:
|
// Parameters:
|
||||||
// t *testing.T : Testing object to use
|
// t *testing.T : Testing object to use
|
||||||
// acc testutil.Accumulator: Accumulator to examine
|
// acc testutil.Accumulator: Accumulator to examine
|
||||||
// measurement string : Name of the measurement to examine
|
// measurement string : Name of the measurement to examine
|
||||||
|
@ -224,7 +224,7 @@ func TestCPUTimesDecrease(t *testing.T) {
|
||||||
err := cs.Gather(&acc)
|
err := cs.Gather(&acc)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
// Computed values are checked with delta > 0 becasue of floating point arithmatic
|
// Computed values are checked with delta > 0 because of floating point arithmatic
|
||||||
// imprecision
|
// imprecision
|
||||||
assertContainsTaggedFloat(t, &acc, "cpu", "time_user", 18, 0, cputags)
|
assertContainsTaggedFloat(t, &acc, "cpu", "time_user", 18, 0, cputags)
|
||||||
assertContainsTaggedFloat(t, &acc, "cpu", "time_idle", 80, 0, cputags)
|
assertContainsTaggedFloat(t, &acc, "cpu", "time_idle", 80, 0, cputags)
|
||||||
|
|
|
@ -347,7 +347,7 @@ func PdhGetFormattedCounterValueDouble(hCounter PDH_HCOUNTER, lpdwType *uint32,
|
||||||
//
|
//
|
||||||
// okPath := "\\Process(*)\\% Processor Time" // notice the wildcard * character
|
// okPath := "\\Process(*)\\% Processor Time" // notice the wildcard * character
|
||||||
//
|
//
|
||||||
// // ommitted all necessary stuff ...
|
// // omitted all necessary stuff ...
|
||||||
//
|
//
|
||||||
// var bufSize uint32
|
// var bufSize uint32
|
||||||
// var bufCount uint32
|
// var bufCount uint32
|
||||||
|
|
|
@ -110,7 +110,7 @@ func (m *Win_PerfCounters) AddItem(query string, objectName string, counter stri
|
||||||
ret = PdhAddEnglishCounter(handle, query, 0, &counterHandle)
|
ret = PdhAddEnglishCounter(handle, query, 0, &counterHandle)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Call PdhCollectQueryData one time to check existance of the counter
|
// Call PdhCollectQueryData one time to check existence of the counter
|
||||||
ret = PdhCollectQueryData(handle)
|
ret = PdhCollectQueryData(handle)
|
||||||
if ret != ERROR_SUCCESS {
|
if ret != ERROR_SUCCESS {
|
||||||
PdhCloseQuery(handle)
|
PdhCloseQuery(handle)
|
||||||
|
|
|
@ -16,7 +16,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Graphite struct {
|
type Graphite struct {
|
||||||
// URL is only for backwards compatability
|
// URL is only for backwards compatibility
|
||||||
Servers []string
|
Servers []string
|
||||||
Prefix string
|
Prefix string
|
||||||
Template string
|
Template string
|
||||||
|
|
|
@ -22,7 +22,7 @@ var (
|
||||||
|
|
||||||
// InfluxDB struct is the primary data structure for the plugin
|
// InfluxDB struct is the primary data structure for the plugin
|
||||||
type InfluxDB struct {
|
type InfluxDB struct {
|
||||||
// URL is only for backwards compatability
|
// URL is only for backwards compatibility
|
||||||
URL string
|
URL string
|
||||||
URLs []string `toml:"urls"`
|
URLs []string `toml:"urls"`
|
||||||
Username string
|
Username string
|
||||||
|
@ -100,7 +100,7 @@ func (i *InfluxDB) Connect() error {
|
||||||
var urls []string
|
var urls []string
|
||||||
urls = append(urls, i.URLs...)
|
urls = append(urls, i.URLs...)
|
||||||
|
|
||||||
// Backward-compatability with single Influx URL config files
|
// Backward-compatibility with single Influx URL config files
|
||||||
// This could eventually be removed in favor of specifying the urls as a list
|
// This could eventually be removed in favor of specifying the urls as a list
|
||||||
if i.URL != "" {
|
if i.URL != "" {
|
||||||
urls = append(urls, i.URL)
|
urls = append(urls, i.URL)
|
||||||
|
|
|
@ -183,7 +183,7 @@ func BenchmarkHttpSend(b *testing.B) {
|
||||||
// err = o.Write(testutil.MockMetrics())
|
// err = o.Write(testutil.MockMetrics())
|
||||||
// require.NoError(t, err)
|
// require.NoError(t, err)
|
||||||
|
|
||||||
// // Verify postive and negative test cases of writing data
|
// // Verify positive and negative test cases of writing data
|
||||||
// metrics := testutil.MockMetrics()
|
// metrics := testutil.MockMetrics()
|
||||||
// metrics = append(metrics, testutil.TestMetric(float64(1.0),
|
// metrics = append(metrics, testutil.TestMetric(float64(1.0),
|
||||||
// "justametric.float"))
|
// "justametric.float"))
|
||||||
|
|
|
@ -84,7 +84,7 @@ func (r *Riemann) Write(metrics []telegraf.Metric) error {
|
||||||
|
|
||||||
var senderr = r.client.SendMulti(events)
|
var senderr = r.client.SendMulti(events)
|
||||||
if senderr != nil {
|
if senderr != nil {
|
||||||
r.Close() // always retuns nil
|
r.Close() // always returns nil
|
||||||
return fmt.Errorf("FAILED to send riemann message (will try to reconnect). Error: %s\n",
|
return fmt.Errorf("FAILED to send riemann message (will try to reconnect). Error: %s\n",
|
||||||
senderr)
|
senderr)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue