From 8331fd83d015fcb188d81e4688d16fe33759d6c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=BBak?= Date: Mon, 21 Jun 2021 17:07:52 +0200 Subject: [PATCH 01/85] Linter fixes for plugins/inputs/[de]* (#9379) (cherry picked from commit 9a794919e3393e4c0fe30d6e3ab1b690719baf23) --- .golangci.yml | 2 +- plugins/inputs/dcos/client.go | 34 ++++++------ plugins/inputs/dcos/dcos.go | 5 +- .../directory_monitor/directory_monitor.go | 22 ++++---- .../directory_monitor_test.go | 6 ++- plugins/inputs/disk/disk.go | 6 +-- plugins/inputs/disk/disk_test.go | 52 ++++++++++--------- plugins/inputs/diskio/diskio.go | 4 +- plugins/inputs/diskio/diskio_linux_test.go | 16 +++--- plugins/inputs/disque/disque.go | 4 +- plugins/inputs/dns_query/dns_query.go | 6 +-- plugins/inputs/docker/client.go | 16 +++--- plugins/inputs/docker/docker.go | 52 +++++++++---------- plugins/inputs/docker/docker_test.go | 18 +++++-- plugins/inputs/docker_log/docker_log.go | 16 +++--- plugins/inputs/ecs/ecs.go | 12 ++--- plugins/inputs/elasticsearch/elasticsearch.go | 3 +- .../elasticsearch/elasticsearch_test.go | 12 ++--- plugins/inputs/ethtool/ethtool_linux.go | 9 ++-- plugins/inputs/ethtool/ethtool_test.go | 17 +++--- .../eventhub_consumer/eventhub_consumer.go | 35 +++++++------ plugins/inputs/exec/exec.go | 7 +-- plugins/inputs/execd/execd_test.go | 4 +- 23 files changed, 187 insertions(+), 171 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 23218a5c7ff1b..47bfdae26e95f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -50,7 +50,7 @@ linters-settings: - name: error-return - name: error-strings - name: errorf - - name: flag-parameter +# - name: flag-parameter #disable for now - name: function-result-limit arguments: [ 3 ] - name: identical-branches diff --git a/plugins/inputs/dcos/client.go b/plugins/inputs/dcos/client.go index 534c2fcb1eab7..fcb976e311ccf 100644 --- a/plugins/inputs/dcos/client.go +++ b/plugins/inputs/dcos/client.go @@ -156,7 +156,7 @@ func (c *ClusterClient) Login(ctx context.Context, sa *ServiceAccount) (*AuthTok return nil, err } - loc := c.url("/acs/api/v1/auth/login") + loc := c.toURL("/acs/api/v1/auth/login") req, err := http.NewRequest("POST", loc, bytes.NewBuffer(octets)) if err != nil { return nil, err @@ -208,7 +208,7 @@ func (c *ClusterClient) Login(ctx context.Context, sa *ServiceAccount) (*AuthTok func (c *ClusterClient) GetSummary(ctx context.Context) (*Summary, error) { summary := &Summary{} - err := c.doGet(ctx, c.url("/mesos/master/state-summary"), summary) + err := c.doGet(ctx, c.toURL("/mesos/master/state-summary"), summary) if err != nil { return nil, err } @@ -220,7 +220,7 @@ func (c *ClusterClient) GetContainers(ctx context.Context, node string) ([]Conta list := []string{} path := fmt.Sprintf("/system/v1/agent/%s/metrics/v0/containers", node) - err := c.doGet(ctx, c.url(path), &list) + err := c.doGet(ctx, c.toURL(path), &list) if err != nil { return nil, err } @@ -233,10 +233,10 @@ func (c *ClusterClient) GetContainers(ctx context.Context, node string) ([]Conta return containers, nil } -func (c *ClusterClient) getMetrics(ctx context.Context, url string) (*Metrics, error) { +func (c *ClusterClient) getMetrics(ctx context.Context, address string) (*Metrics, error) { metrics := &Metrics{} - err := c.doGet(ctx, url, metrics) + err := c.doGet(ctx, address, metrics) if err != nil { return nil, err } @@ -246,21 +246,21 @@ func (c *ClusterClient) getMetrics(ctx context.Context, url string) (*Metrics, e func (c *ClusterClient) GetNodeMetrics(ctx context.Context, node string) (*Metrics, error) { path := fmt.Sprintf("/system/v1/agent/%s/metrics/v0/node", node) - return c.getMetrics(ctx, c.url(path)) + return c.getMetrics(ctx, c.toURL(path)) } func (c *ClusterClient) GetContainerMetrics(ctx context.Context, node, container string) (*Metrics, error) { path := fmt.Sprintf("/system/v1/agent/%s/metrics/v0/containers/%s", node, container) - return c.getMetrics(ctx, c.url(path)) + return c.getMetrics(ctx, c.toURL(path)) } func (c *ClusterClient) GetAppMetrics(ctx context.Context, node, container string) (*Metrics, error) { path := fmt.Sprintf("/system/v1/agent/%s/metrics/v0/containers/%s/app", node, container) - return c.getMetrics(ctx, c.url(path)) + return c.getMetrics(ctx, c.toURL(path)) } -func createGetRequest(url string, token string) (*http.Request, error) { - req, err := http.NewRequest("GET", url, nil) +func createGetRequest(address string, token string) (*http.Request, error) { + req, err := http.NewRequest("GET", address, nil) if err != nil { return nil, err } @@ -273,8 +273,8 @@ func createGetRequest(url string, token string) (*http.Request, error) { return req, nil } -func (c *ClusterClient) doGet(ctx context.Context, url string, v interface{}) error { - req, err := createGetRequest(url, c.token) +func (c *ClusterClient) doGet(ctx context.Context, address string, v interface{}) error { + req, err := createGetRequest(address, c.token) if err != nil { return err } @@ -304,7 +304,7 @@ func (c *ClusterClient) doGet(ctx context.Context, url string, v interface{}) er if resp.StatusCode < 200 || resp.StatusCode >= 300 { return &APIError{ - URL: url, + URL: address, StatusCode: resp.StatusCode, Title: resp.Status, } @@ -318,10 +318,10 @@ func (c *ClusterClient) doGet(ctx context.Context, url string, v interface{}) er return err } -func (c *ClusterClient) url(path string) string { - url := *c.clusterURL - url.Path = path - return url.String() +func (c *ClusterClient) toURL(path string) string { + clusterURL := *c.clusterURL + clusterURL.Path = path + return clusterURL.String() } func (c *ClusterClient) createLoginToken(sa *ServiceAccount) (string, error) { diff --git a/plugins/inputs/dcos/dcos.go b/plugins/inputs/dcos/dcos.go index 25e4e4755cc30..8fcb321ff36cf 100644 --- a/plugins/inputs/dcos/dcos.go +++ b/plugins/inputs/dcos/dcos.go @@ -10,6 +10,7 @@ import ( "time" jwt "github.com/dgrijalva/jwt-go/v4" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/filter" @@ -352,13 +353,13 @@ func (d *DCOS) createClient() (Client, error) { return nil, err } - url, err := url.Parse(d.ClusterURL) + address, err := url.Parse(d.ClusterURL) if err != nil { return nil, err } client := NewClusterClient( - url, + address, time.Duration(d.ResponseTimeout), d.MaxConnections, tlsCfg, diff --git a/plugins/inputs/directory_monitor/directory_monitor.go b/plugins/inputs/directory_monitor/directory_monitor.go index d8ed8acf04764..45acd1c062ba9 100644 --- a/plugins/inputs/directory_monitor/directory_monitor.go +++ b/plugins/inputs/directory_monitor/directory_monitor.go @@ -2,27 +2,27 @@ package directory_monitor import ( "bufio" + "compress/gzip" "context" "errors" "fmt" + "io" + "io/ioutil" + "os" + "path/filepath" "regexp" + "sync" "time" + "golang.org/x/sync/semaphore" + "gopkg.in/djherbis/times.v1" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/plugins/inputs" "github.com/influxdata/telegraf/plugins/parsers" "github.com/influxdata/telegraf/plugins/parsers/csv" "github.com/influxdata/telegraf/selfstat" - "golang.org/x/sync/semaphore" - "gopkg.in/djherbis/times.v1" - - "compress/gzip" - "io" - "io/ioutil" - "os" - "path/filepath" - "sync" ) const sampleConfig = ` @@ -263,9 +263,7 @@ func (monitor *DirectoryMonitor) parseFile(parser parsers.Parser, reader io.Read if err != nil { return err } - if firstLine { - firstLine = false - } + firstLine = false if err := monitor.sendMetrics(metrics); err != nil { return err diff --git a/plugins/inputs/directory_monitor/directory_monitor_test.go b/plugins/inputs/directory_monitor/directory_monitor_test.go index 3cad4ee6857b9..2ad504637c6c2 100644 --- a/plugins/inputs/directory_monitor/directory_monitor_test.go +++ b/plugins/inputs/directory_monitor/directory_monitor_test.go @@ -8,9 +8,10 @@ import ( "path/filepath" "testing" + "github.com/stretchr/testify/require" + "github.com/influxdata/telegraf/plugins/parsers" "github.com/influxdata/telegraf/testutil" - "github.com/stretchr/testify/require" ) func TestCSVGZImport(t *testing.T) { @@ -77,8 +78,9 @@ func TestCSVGZImport(t *testing.T) { // File should have gone back to the test directory, as we configured. _, err = os.Stat(filepath.Join(finishedDirectory, testCsvFile)) - _, err = os.Stat(filepath.Join(finishedDirectory, testCsvGzFile)) + require.NoError(t, err) + _, err = os.Stat(filepath.Join(finishedDirectory, testCsvGzFile)) require.NoError(t, err) } diff --git a/plugins/inputs/disk/disk.go b/plugins/inputs/disk/disk.go index 0ceea27167389..0a0fbf6f728a3 100644 --- a/plugins/inputs/disk/disk.go +++ b/plugins/inputs/disk/disk.go @@ -13,7 +13,7 @@ type DiskStats struct { ps system.PS // Legacy support - Mountpoints []string `toml:"mountpoints"` + LegacyMountPoints []string `toml:"mountpoints"` MountPoints []string `toml:"mount_points"` IgnoreFS []string `toml:"ignore_fs"` @@ -38,8 +38,8 @@ func (ds *DiskStats) SampleConfig() string { func (ds *DiskStats) Gather(acc telegraf.Accumulator) error { // Legacy support: - if len(ds.Mountpoints) != 0 { - ds.MountPoints = ds.Mountpoints + if len(ds.LegacyMountPoints) != 0 { + ds.MountPoints = ds.LegacyMountPoints } disks, partitions, err := ds.ps.DiskUsage(ds.MountPoints, ds.IgnoreFS) diff --git a/plugins/inputs/disk/disk_test.go b/plugins/inputs/disk/disk_test.go index 13180fffb1c37..47a822b4410bf 100644 --- a/plugins/inputs/disk/disk_test.go +++ b/plugins/inputs/disk/disk_test.go @@ -5,12 +5,12 @@ import ( "os" "testing" - "github.com/influxdata/telegraf/plugins/inputs/system" - "github.com/influxdata/telegraf/testutil" - "github.com/shirou/gopsutil/disk" - "github.com/stretchr/testify/assert" + diskUtil "github.com/shirou/gopsutil/disk" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + + "github.com/influxdata/telegraf/plugins/inputs/system" + "github.com/influxdata/telegraf/testutil" ) type MockFileInfo struct { @@ -25,7 +25,7 @@ func TestDiskUsage(t *testing.T) { var acc testutil.Accumulator var err error - psAll := []disk.PartitionStat{ + psAll := []diskUtil.PartitionStat{ { Device: "/dev/sda", Mountpoint: "/", @@ -39,7 +39,7 @@ func TestDiskUsage(t *testing.T) { Opts: "rw,noatime,nodiratime,errors=remount-ro", }, } - duAll := []disk.UsageStat{ + duAll := []diskUtil.UsageStat{ { Path: "/", Fstype: "ext4", @@ -72,7 +72,7 @@ func TestDiskUsage(t *testing.T) { numDiskMetrics := acc.NFields() expectedAllDiskMetrics := 14 - assert.Equal(t, expectedAllDiskMetrics, numDiskMetrics) + require.Equal(t, expectedAllDiskMetrics, numDiskMetrics) tags1 := map[string]string{ "path": string(os.PathSeparator), @@ -111,26 +111,28 @@ func TestDiskUsage(t *testing.T) { // We expect 6 more DiskMetrics to show up with an explicit match on "/" // and /home not matching the /dev in MountPoints err = (&DiskStats{ps: &mps, MountPoints: []string{"/", "/dev"}}).Gather(&acc) - assert.Equal(t, expectedAllDiskMetrics+7, acc.NFields()) + require.NoError(t, err) + require.Equal(t, expectedAllDiskMetrics+7, acc.NFields()) // We should see all the diskpoints as MountPoints includes both // / and /home err = (&DiskStats{ps: &mps, MountPoints: []string{"/", "/home"}}).Gather(&acc) - assert.Equal(t, 2*expectedAllDiskMetrics+7, acc.NFields()) + require.NoError(t, err) + require.Equal(t, 2*expectedAllDiskMetrics+7, acc.NFields()) } func TestDiskUsageHostMountPrefix(t *testing.T) { tests := []struct { name string - partitionStats []disk.PartitionStat - usageStats []*disk.UsageStat + partitionStats []diskUtil.PartitionStat + usageStats []*diskUtil.UsageStat hostMountPrefix string expectedTags map[string]string expectedFields map[string]interface{} }{ { name: "no host mount prefix", - partitionStats: []disk.PartitionStat{ + partitionStats: []diskUtil.PartitionStat{ { Device: "/dev/sda", Mountpoint: "/", @@ -138,7 +140,7 @@ func TestDiskUsageHostMountPrefix(t *testing.T) { Opts: "ro", }, }, - usageStats: []*disk.UsageStat{ + usageStats: []*diskUtil.UsageStat{ { Path: "/", Total: 42, @@ -162,7 +164,7 @@ func TestDiskUsageHostMountPrefix(t *testing.T) { }, { name: "host mount prefix", - partitionStats: []disk.PartitionStat{ + partitionStats: []diskUtil.PartitionStat{ { Device: "/dev/sda", Mountpoint: "/hostfs/var", @@ -170,7 +172,7 @@ func TestDiskUsageHostMountPrefix(t *testing.T) { Opts: "ro", }, }, - usageStats: []*disk.UsageStat{ + usageStats: []*diskUtil.UsageStat{ { Path: "/hostfs/var", Total: 42, @@ -195,7 +197,7 @@ func TestDiskUsageHostMountPrefix(t *testing.T) { }, { name: "host mount prefix exact match", - partitionStats: []disk.PartitionStat{ + partitionStats: []diskUtil.PartitionStat{ { Device: "/dev/sda", Mountpoint: "/hostfs", @@ -203,7 +205,7 @@ func TestDiskUsageHostMountPrefix(t *testing.T) { Opts: "ro", }, }, - usageStats: []*disk.UsageStat{ + usageStats: []*diskUtil.UsageStat{ { Path: "/hostfs", Total: 42, @@ -259,7 +261,7 @@ func TestDiskStats(t *testing.T) { var acc testutil.Accumulator var err error - duAll := []*disk.UsageStat{ + duAll := []*diskUtil.UsageStat{ { Path: "/", Fstype: "ext4", @@ -281,7 +283,7 @@ func TestDiskStats(t *testing.T) { InodesUsed: 2000, }, } - duFiltered := []*disk.UsageStat{ + duFiltered := []*diskUtil.UsageStat{ { Path: "/", Fstype: "ext4", @@ -294,7 +296,7 @@ func TestDiskStats(t *testing.T) { }, } - psAll := []*disk.PartitionStat{ + psAll := []*diskUtil.PartitionStat{ { Device: "/dev/sda", Mountpoint: "/", @@ -309,7 +311,7 @@ func TestDiskStats(t *testing.T) { }, } - psFiltered := []*disk.PartitionStat{ + psFiltered := []*diskUtil.PartitionStat{ { Device: "/dev/sda", Mountpoint: "/", @@ -327,7 +329,7 @@ func TestDiskStats(t *testing.T) { numDiskMetrics := acc.NFields() expectedAllDiskMetrics := 14 - assert.Equal(t, expectedAllDiskMetrics, numDiskMetrics) + require.Equal(t, expectedAllDiskMetrics, numDiskMetrics) tags1 := map[string]string{ "path": "/", @@ -366,10 +368,12 @@ func TestDiskStats(t *testing.T) { // We expect 6 more DiskMetrics to show up with an explicit match on "/" // and /home not matching the /dev in MountPoints err = (&DiskStats{ps: &mps, MountPoints: []string{"/", "/dev"}}).Gather(&acc) - assert.Equal(t, expectedAllDiskMetrics+7, acc.NFields()) + require.NoError(t, err) + require.Equal(t, expectedAllDiskMetrics+7, acc.NFields()) // We should see all the diskpoints as MountPoints includes both // / and /home err = (&DiskStats{ps: &mps, MountPoints: []string{"/", "/home"}}).Gather(&acc) - assert.Equal(t, 2*expectedAllDiskMetrics+7, acc.NFields()) + require.NoError(t, err) + require.Equal(t, 2*expectedAllDiskMetrics+7, acc.NFields()) } diff --git a/plugins/inputs/diskio/diskio.go b/plugins/inputs/diskio/diskio.go index c347e90a36526..9458b2af7a68f 100644 --- a/plugins/inputs/diskio/diskio.go +++ b/plugins/inputs/diskio/diskio.go @@ -74,11 +74,11 @@ func hasMeta(s string) bool { func (d *DiskIO) init() error { for _, device := range d.Devices { if hasMeta(device) { - filter, err := filter.Compile(d.Devices) + deviceFilter, err := filter.Compile(d.Devices) if err != nil { return fmt.Errorf("error compiling device pattern: %s", err.Error()) } - d.deviceFilter = filter + d.deviceFilter = deviceFilter } } d.initialized = true diff --git a/plugins/inputs/diskio/diskio_linux_test.go b/plugins/inputs/diskio/diskio_linux_test.go index 222cb783f1870..ede35b5befead 100644 --- a/plugins/inputs/diskio/diskio_linux_test.go +++ b/plugins/inputs/diskio/diskio_linux_test.go @@ -92,12 +92,14 @@ func TestDiskIOStats_diskName(t *testing.T) { } for _, tc := range tests { - s := DiskIO{ - NameTemplates: tc.templates, - } - defer setupNullDisk(t, &s, "null")() - name, _ := s.diskName("null") - require.Equal(t, tc.expected, name, "Templates: %#v", tc.templates) + func() { + s := DiskIO{ + NameTemplates: tc.templates, + } + defer setupNullDisk(t, &s, "null")() //nolint:revive // done on purpose, cleaning will be executed properly + name, _ := s.diskName("null") + require.Equal(t, tc.expected, name, "Templates: %#v", tc.templates) + }() } } @@ -107,7 +109,7 @@ func TestDiskIOStats_diskTags(t *testing.T) { s := &DiskIO{ DeviceTags: []string{"MY_PARAM_2"}, } - defer setupNullDisk(t, s, "null")() + defer setupNullDisk(t, s, "null")() //nolint:revive // done on purpose, cleaning will be executed properly dt := s.diskTags("null") require.Equal(t, map[string]string{"MY_PARAM_2": "myval2"}, dt) } diff --git a/plugins/inputs/disque/disque.go b/plugins/inputs/disque/disque.go index 6c2606af4ad94..6fa63ec8bd874 100644 --- a/plugins/inputs/disque/disque.go +++ b/plugins/inputs/disque/disque.go @@ -65,10 +65,10 @@ var ErrProtocolError = errors.New("disque protocol error") // Returns one of the errors encountered while gather stats (if any). func (d *Disque) Gather(acc telegraf.Accumulator) error { if len(d.Servers) == 0 { - url := &url.URL{ + address := &url.URL{ Host: ":7711", } - return d.gatherServer(url, acc) + return d.gatherServer(address, acc) } var wg sync.WaitGroup diff --git a/plugins/inputs/dns_query/dns_query.go b/plugins/inputs/dns_query/dns_query.go index 4c721a0964776..a3b2f262ba7e0 100644 --- a/plugins/inputs/dns_query/dns_query.go +++ b/plugins/inputs/dns_query/dns_query.go @@ -16,9 +16,9 @@ import ( type ResultType uint64 const ( - Success ResultType = 0 - Timeout = 1 - Error = 2 + Success ResultType = iota + Timeout + Error ) type DNSQuery struct { diff --git a/plugins/inputs/docker/client.go b/plugins/inputs/docker/client.go index 14e4396980b9a..6abba44c549d6 100644 --- a/plugins/inputs/docker/client.go +++ b/plugins/inputs/docker/client.go @@ -7,7 +7,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" - docker "github.com/docker/docker/client" + dockerClient "github.com/docker/docker/client" ) var ( @@ -27,7 +27,7 @@ type Client interface { } func NewEnvClient() (Client, error) { - client, err := docker.NewClientWithOpts(docker.FromEnv) + client, err := dockerClient.NewClientWithOpts(dockerClient.FromEnv) if err != nil { return nil, err } @@ -40,11 +40,11 @@ func NewClient(host string, tlsConfig *tls.Config) (Client, error) { } httpClient := &http.Client{Transport: transport} - client, err := docker.NewClientWithOpts( - docker.WithHTTPHeaders(defaultHeaders), - docker.WithHTTPClient(httpClient), - docker.WithVersion(version), - docker.WithHost(host)) + client, err := dockerClient.NewClientWithOpts( + dockerClient.WithHTTPHeaders(defaultHeaders), + dockerClient.WithHTTPClient(httpClient), + dockerClient.WithVersion(version), + dockerClient.WithHost(host)) if err != nil { return nil, err } @@ -53,7 +53,7 @@ func NewClient(host string, tlsConfig *tls.Config) (Client, error) { } type SocketClient struct { - client *docker.Client + client *dockerClient.Client } func (c *SocketClient) Info(ctx context.Context) (types.Info, error) { diff --git a/plugins/inputs/docker/docker.go b/plugins/inputs/docker/docker.go index 47eab7ce2430e..4e6dc5ad4d221 100644 --- a/plugins/inputs/docker/docker.go +++ b/plugins/inputs/docker/docker.go @@ -15,11 +15,12 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/swarm" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/filter" "github.com/influxdata/telegraf/internal/choice" - "github.com/influxdata/telegraf/internal/docker" + dockerint "github.com/influxdata/telegraf/internal/docker" tlsint "github.com/influxdata/telegraf/plugins/common/tls" "github.com/influxdata/telegraf/plugins/inputs" ) @@ -513,7 +514,7 @@ func (d *Docker) gatherContainer( return nil } - imageName, imageVersion := docker.ParseImage(container.Image) + imageName, imageVersion := dockerint.ParseImage(container.Image) tags := map[string]string{ "engine_host": d.engineHost, @@ -628,18 +629,16 @@ func (d *Docker) gatherContainerInspect( } } - parseContainerStats(v, acc, tags, container.ID, d.PerDeviceInclude, d.TotalInclude, daemonOSType) + d.parseContainerStats(v, acc, tags, container.ID, daemonOSType) return nil } -func parseContainerStats( +func (d *Docker) parseContainerStats( stat *types.StatsJSON, acc telegraf.Accumulator, tags map[string]string, id string, - perDeviceInclude []string, - totalInclude []string, daemonOSType string, ) { tm := stat.Read @@ -708,7 +707,7 @@ func parseContainerStats( acc.AddFields("docker_container_mem", memfields, tags, tm) - if choice.Contains("cpu", totalInclude) { + if choice.Contains("cpu", d.TotalInclude) { cpufields := map[string]interface{}{ "usage_total": stat.CPUStats.CPUUsage.TotalUsage, "usage_in_usermode": stat.CPUStats.CPUUsage.UsageInUsermode, @@ -735,7 +734,7 @@ func parseContainerStats( acc.AddFields("docker_container_cpu", cpufields, cputags, tm) } - if choice.Contains("cpu", perDeviceInclude) && len(stat.CPUStats.CPUUsage.PercpuUsage) > 0 { + if choice.Contains("cpu", d.PerDeviceInclude) && len(stat.CPUStats.CPUUsage.PercpuUsage) > 0 { // If we have OnlineCPUs field, then use it to restrict stats gathering to only Online CPUs // (https://github.com/moby/moby/commit/115f91d7575d6de6c7781a96a082f144fd17e400) var percpuusage []uint64 @@ -770,12 +769,12 @@ func parseContainerStats( "container_id": id, } // Create a new network tag dictionary for the "network" tag - if choice.Contains("network", perDeviceInclude) { + if choice.Contains("network", d.PerDeviceInclude) { nettags := copyTags(tags) nettags["network"] = network acc.AddFields("docker_container_net", netfields, nettags, tm) } - if choice.Contains("network", totalInclude) { + if choice.Contains("network", d.TotalInclude) { for field, value := range netfields { if field == "container_id" { continue @@ -802,17 +801,14 @@ func parseContainerStats( } // totalNetworkStatMap could be empty if container is running with --net=host. - if choice.Contains("network", totalInclude) && len(totalNetworkStatMap) != 0 { + if choice.Contains("network", d.TotalInclude) && len(totalNetworkStatMap) != 0 { nettags := copyTags(tags) nettags["network"] = "total" totalNetworkStatMap["container_id"] = id acc.AddFields("docker_container_net", totalNetworkStatMap, nettags, tm) } - perDeviceBlkio := choice.Contains("blkio", perDeviceInclude) - totalBlkio := choice.Contains("blkio", totalInclude) - - gatherBlockIOMetrics(stat, acc, tags, tm, id, perDeviceBlkio, totalBlkio) + d.gatherBlockIOMetrics(acc, stat, tags, tm, id) } // Make a map of devices to their block io stats @@ -877,27 +873,27 @@ func getDeviceStatMap(blkioStats types.BlkioStats) map[string]map[string]interfa return deviceStatMap } -func gatherBlockIOMetrics( - stat *types.StatsJSON, +func (d *Docker) gatherBlockIOMetrics( acc telegraf.Accumulator, + stat *types.StatsJSON, tags map[string]string, tm time.Time, id string, - perDevice bool, - total bool, ) { + perDeviceBlkio := choice.Contains("blkio", d.PerDeviceInclude) + totalBlkio := choice.Contains("blkio", d.TotalInclude) blkioStats := stat.BlkioStats deviceStatMap := getDeviceStatMap(blkioStats) totalStatMap := make(map[string]interface{}) for device, fields := range deviceStatMap { fields["container_id"] = id - if perDevice { + if perDeviceBlkio { iotags := copyTags(tags) iotags["device"] = device acc.AddFields("docker_container_blkio", fields, iotags, tm) } - if total { + if totalBlkio { for field, value := range fields { if field == "container_id" { continue @@ -922,7 +918,7 @@ func gatherBlockIOMetrics( } } } - if total { + if totalBlkio { totalStatMap["container_id"] = id iotags := copyTags(tags) iotags["device"] = "total" @@ -965,20 +961,20 @@ func (d *Docker) createContainerFilters() error { d.ContainerInclude = append(d.ContainerInclude, d.ContainerNames...) } - filter, err := filter.NewIncludeExcludeFilter(d.ContainerInclude, d.ContainerExclude) + containerFilter, err := filter.NewIncludeExcludeFilter(d.ContainerInclude, d.ContainerExclude) if err != nil { return err } - d.containerFilter = filter + d.containerFilter = containerFilter return nil } func (d *Docker) createLabelFilters() error { - filter, err := filter.NewIncludeExcludeFilter(d.LabelInclude, d.LabelExclude) + labelFilter, err := filter.NewIncludeExcludeFilter(d.LabelInclude, d.LabelExclude) if err != nil { return err } - d.labelFilter = filter + d.labelFilter = labelFilter return nil } @@ -986,11 +982,11 @@ func (d *Docker) createContainerStateFilters() error { if len(d.ContainerStateInclude) == 0 && len(d.ContainerStateExclude) == 0 { d.ContainerStateInclude = []string{"running"} } - filter, err := filter.NewIncludeExcludeFilter(d.ContainerStateInclude, d.ContainerStateExclude) + stateFilter, err := filter.NewIncludeExcludeFilter(d.ContainerStateInclude, d.ContainerStateExclude) if err != nil { return err } - d.stateFilter = filter + d.stateFilter = stateFilter return nil } diff --git a/plugins/inputs/docker/docker_test.go b/plugins/inputs/docker/docker_test.go index f5a8ff7a89b83..599adae409e99 100644 --- a/plugins/inputs/docker/docker_test.go +++ b/plugins/inputs/docker/docker_test.go @@ -12,10 +12,11 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/swarm" + "github.com/stretchr/testify/require" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal/choice" "github.com/influxdata/telegraf/testutil" - "github.com/stretchr/testify/require" ) type MockClient struct { @@ -120,7 +121,12 @@ func TestDockerGatherContainerStats(t *testing.T) { "container_image": "redis/image", } - parseContainerStats(stats, &acc, tags, "123456789", containerMetricClasses, containerMetricClasses, "linux") + d := &Docker{ + Log: testutil.Logger{}, + PerDeviceInclude: containerMetricClasses, + TotalInclude: containerMetricClasses, + } + d.parseContainerStats(stats, &acc, tags, "123456789", "linux") // test docker_container_net measurement netfields := map[string]interface{}{ @@ -1270,8 +1276,12 @@ func Test_parseContainerStatsPerDeviceAndTotal(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { var acc testutil.Accumulator - parseContainerStats(tt.args.stat, &acc, tt.args.tags, tt.args.id, tt.args.perDeviceInclude, - tt.args.totalInclude, tt.args.daemonOSType) + d := &Docker{ + Log: testutil.Logger{}, + PerDeviceInclude: tt.args.perDeviceInclude, + TotalInclude: tt.args.totalInclude, + } + d.parseContainerStats(tt.args.stat, &acc, tt.args.tags, tt.args.id, tt.args.daemonOSType) actual := FilterMetrics(acc.GetTelegrafMetrics(), func(m telegraf.Metric) bool { return choice.Contains(m.Name(), diff --git a/plugins/inputs/docker_log/docker_log.go b/plugins/inputs/docker_log/docker_log.go index f877961ba2676..622f9924e4236 100644 --- a/plugins/inputs/docker_log/docker_log.go +++ b/plugins/inputs/docker_log/docker_log.go @@ -15,6 +15,7 @@ import ( "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/pkg/stdcopy" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/filter" @@ -307,8 +308,7 @@ func (d *DockerLogs) tailContainerLogs( func parseLine(line []byte) (time.Time, string, error) { parts := bytes.SplitN(line, []byte(" "), 2) - switch len(parts) { - case 1: + if len(parts) == 1 { parts = append(parts, []byte("")) } @@ -421,20 +421,20 @@ func (d *DockerLogs) Stop() { // Following few functions have been inherited from telegraf docker input plugin func (d *DockerLogs) createContainerFilters() error { - filter, err := filter.NewIncludeExcludeFilter(d.ContainerInclude, d.ContainerExclude) + containerFilter, err := filter.NewIncludeExcludeFilter(d.ContainerInclude, d.ContainerExclude) if err != nil { return err } - d.containerFilter = filter + d.containerFilter = containerFilter return nil } func (d *DockerLogs) createLabelFilters() error { - filter, err := filter.NewIncludeExcludeFilter(d.LabelInclude, d.LabelExclude) + labelFilter, err := filter.NewIncludeExcludeFilter(d.LabelInclude, d.LabelExclude) if err != nil { return err } - d.labelFilter = filter + d.labelFilter = labelFilter return nil } @@ -442,11 +442,11 @@ func (d *DockerLogs) createContainerStateFilters() error { if len(d.ContainerStateInclude) == 0 && len(d.ContainerStateExclude) == 0 { d.ContainerStateInclude = []string{"running"} } - filter, err := filter.NewIncludeExcludeFilter(d.ContainerStateInclude, d.ContainerStateExclude) + stateFilter, err := filter.NewIncludeExcludeFilter(d.ContainerStateInclude, d.ContainerStateExclude) if err != nil { return err } - d.stateFilter = filter + d.stateFilter = stateFilter return nil } diff --git a/plugins/inputs/ecs/ecs.go b/plugins/inputs/ecs/ecs.go index d563fef5038d5..f044e8d2cb7fe 100644 --- a/plugins/inputs/ecs/ecs.go +++ b/plugins/inputs/ecs/ecs.go @@ -220,20 +220,20 @@ func mergeTags(a map[string]string, b map[string]string) map[string]string { } func (ecs *Ecs) createContainerNameFilters() error { - filter, err := filter.NewIncludeExcludeFilter(ecs.ContainerNameInclude, ecs.ContainerNameExclude) + containerNameFilter, err := filter.NewIncludeExcludeFilter(ecs.ContainerNameInclude, ecs.ContainerNameExclude) if err != nil { return err } - ecs.containerNameFilter = filter + ecs.containerNameFilter = containerNameFilter return nil } func (ecs *Ecs) createLabelFilters() error { - filter, err := filter.NewIncludeExcludeFilter(ecs.LabelInclude, ecs.LabelExclude) + labelFilter, err := filter.NewIncludeExcludeFilter(ecs.LabelInclude, ecs.LabelExclude) if err != nil { return err } - ecs.labelFilter = filter + ecs.labelFilter = labelFilter return nil } @@ -250,11 +250,11 @@ func (ecs *Ecs) createContainerStatusFilters() error { ecs.ContainerStatusExclude[i] = strings.ToUpper(exclude) } - filter, err := filter.NewIncludeExcludeFilter(ecs.ContainerStatusInclude, ecs.ContainerStatusExclude) + statusFilter, err := filter.NewIncludeExcludeFilter(ecs.ContainerStatusInclude, ecs.ContainerStatusExclude) if err != nil { return err } - ecs.statusFilter = filter + ecs.statusFilter = statusFilter return nil } diff --git a/plugins/inputs/elasticsearch/elasticsearch.go b/plugins/inputs/elasticsearch/elasticsearch.go index aac23d707edba..0bd4ce677cd9e 100644 --- a/plugins/inputs/elasticsearch/elasticsearch.go +++ b/plugins/inputs/elasticsearch/elasticsearch.go @@ -644,7 +644,8 @@ func (e *Elasticsearch) gatherSingleIndexStats(name string, index indexStat, now // determine shard tag and primary/replica designation shardType := "replica" - if flattened.Fields["routing_primary"] == true { + routingPrimary, _ := flattened.Fields["routing_primary"].(bool) + if routingPrimary { shardType = "primary" } delete(flattened.Fields, "routing_primary") diff --git a/plugins/inputs/elasticsearch/elasticsearch_test.go b/plugins/inputs/elasticsearch/elasticsearch_test.go index 1a24d3caaf66e..8248d063b6883 100644 --- a/plugins/inputs/elasticsearch/elasticsearch_test.go +++ b/plugins/inputs/elasticsearch/elasticsearch_test.go @@ -6,9 +6,9 @@ import ( "strings" "testing" - "github.com/influxdata/telegraf/testutil" - "github.com/stretchr/testify/require" + + "github.com/influxdata/telegraf/testutil" ) func defaultTags() map[string]string { @@ -206,8 +206,8 @@ func TestGatherClusterStatsMaster(t *testing.T) { info.masterID = masterID es.serverInfo["http://example.com:9200"] = info - IsMasterResultTokens := strings.Split(string(IsMasterResult), " ") - require.Equal(t, masterID, IsMasterResultTokens[0], "catmaster is incorrect") + isMasterResultTokens := strings.Split(IsMasterResult, " ") + require.Equal(t, masterID, isMasterResultTokens[0], "catmaster is incorrect") // now get node status, which determines whether we're master var acc testutil.Accumulator @@ -244,8 +244,8 @@ func TestGatherClusterStatsNonMaster(t *testing.T) { masterID, err := es.getCatMaster("junk") require.NoError(t, err) - IsNotMasterResultTokens := strings.Split(string(IsNotMasterResult), " ") - require.Equal(t, masterID, IsNotMasterResultTokens[0], "catmaster is incorrect") + isNotMasterResultTokens := strings.Split(IsNotMasterResult, " ") + require.Equal(t, masterID, isNotMasterResultTokens[0], "catmaster is incorrect") // now get node status, which determines whether we're master var acc testutil.Accumulator diff --git a/plugins/inputs/ethtool/ethtool_linux.go b/plugins/inputs/ethtool/ethtool_linux.go index 13dabd2f8a6b6..08e21db50dede 100644 --- a/plugins/inputs/ethtool/ethtool_linux.go +++ b/plugins/inputs/ethtool/ethtool_linux.go @@ -6,15 +6,16 @@ import ( "net" "sync" + "github.com/pkg/errors" + ethtoolLib "github.com/safchain/ethtool" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/filter" "github.com/influxdata/telegraf/plugins/inputs" - "github.com/pkg/errors" - "github.com/safchain/ethtool" ) type CommandEthtool struct { - ethtool *ethtool.Ethtool + ethtool *ethtoolLib.Ethtool } func (e *Ethtool) Gather(acc telegraf.Accumulator) error { @@ -98,7 +99,7 @@ func (c *CommandEthtool) Init() error { return nil } - e, err := ethtool.NewEthtool() + e, err := ethtoolLib.NewEthtool() if err == nil { c.ethtool = e } diff --git a/plugins/inputs/ethtool/ethtool_test.go b/plugins/inputs/ethtool/ethtool_test.go index ac5527733ce73..87bc136d2db11 100644 --- a/plugins/inputs/ethtool/ethtool_test.go +++ b/plugins/inputs/ethtool/ethtool_test.go @@ -6,9 +6,10 @@ import ( "net" "testing" - "github.com/influxdata/telegraf/testutil" "github.com/pkg/errors" "github.com/stretchr/testify/assert" + + "github.com/influxdata/telegraf/testutil" ) var command *Ethtool @@ -31,13 +32,12 @@ func (c *CommandEthtoolMock) Init() error { return nil } -func (c *CommandEthtoolMock) DriverName(intf string) (driverName string, err error) { +func (c *CommandEthtoolMock) DriverName(intf string) (string, error) { i := c.InterfaceMap[intf] if i != nil { - driverName = i.DriverName - return + return i.DriverName, nil } - return driverName, errors.New("interface not found") + return "", errors.New("interface not found") } func (c *CommandEthtoolMock) Interfaces() ([]net.Interface, error) { @@ -66,13 +66,12 @@ func (c *CommandEthtoolMock) Interfaces() ([]net.Interface, error) { return interfaceNames, nil } -func (c *CommandEthtoolMock) Stats(intf string) (stat map[string]uint64, err error) { +func (c *CommandEthtoolMock) Stats(intf string) (map[string]uint64, error) { i := c.InterfaceMap[intf] if i != nil { - stat = i.Stat - return + return i.Stat, nil } - return stat, errors.New("interface not found") + return nil, errors.New("interface not found") } func setup() { diff --git a/plugins/inputs/eventhub_consumer/eventhub_consumer.go b/plugins/inputs/eventhub_consumer/eventhub_consumer.go index 114a6335060ca..064502b0ed831 100644 --- a/plugins/inputs/eventhub_consumer/eventhub_consumer.go +++ b/plugins/inputs/eventhub_consumer/eventhub_consumer.go @@ -6,8 +6,9 @@ import ( "sync" "time" - eventhub "github.com/Azure/azure-event-hubs-go/v3" + eventhubClient "github.com/Azure/azure-event-hubs-go/v3" "github.com/Azure/azure-event-hubs-go/v3/persist" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal" "github.com/influxdata/telegraf/plugins/inputs" @@ -54,7 +55,7 @@ type EventHub struct { Log telegraf.Logger `toml:"-"` // Azure - hub *eventhub.Hub + hub *eventhubClient.Hub cancel context.CancelFunc wg sync.WaitGroup @@ -172,7 +173,7 @@ func (e *EventHub) Init() (err error) { } // Set hub options - hubOpts := []eventhub.HubOption{} + hubOpts := []eventhubClient.HubOption{} if e.PersistenceDir != "" { persister, err := persist.NewFilePersister(e.PersistenceDir) @@ -180,20 +181,20 @@ func (e *EventHub) Init() (err error) { return err } - hubOpts = append(hubOpts, eventhub.HubWithOffsetPersistence(persister)) + hubOpts = append(hubOpts, eventhubClient.HubWithOffsetPersistence(persister)) } if e.UserAgent != "" { - hubOpts = append(hubOpts, eventhub.HubWithUserAgent(e.UserAgent)) + hubOpts = append(hubOpts, eventhubClient.HubWithUserAgent(e.UserAgent)) } else { - hubOpts = append(hubOpts, eventhub.HubWithUserAgent(internal.ProductToken())) + hubOpts = append(hubOpts, eventhubClient.HubWithUserAgent(internal.ProductToken())) } // Create event hub connection if e.ConnectionString != "" { - e.hub, err = eventhub.NewHubFromConnectionString(e.ConnectionString, hubOpts...) + e.hub, err = eventhubClient.NewHubFromConnectionString(e.ConnectionString, hubOpts...) } else { - e.hub, err = eventhub.NewHubFromEnvironment(hubOpts...) + e.hub, err = eventhubClient.NewHubFromEnvironment(hubOpts...) } return err @@ -236,25 +237,25 @@ func (e *EventHub) Start(acc telegraf.Accumulator) error { return nil } -func (e *EventHub) configureReceiver() []eventhub.ReceiveOption { - receiveOpts := []eventhub.ReceiveOption{} +func (e *EventHub) configureReceiver() []eventhubClient.ReceiveOption { + receiveOpts := []eventhubClient.ReceiveOption{} if e.ConsumerGroup != "" { - receiveOpts = append(receiveOpts, eventhub.ReceiveWithConsumerGroup(e.ConsumerGroup)) + receiveOpts = append(receiveOpts, eventhubClient.ReceiveWithConsumerGroup(e.ConsumerGroup)) } if !e.FromTimestamp.IsZero() { - receiveOpts = append(receiveOpts, eventhub.ReceiveFromTimestamp(e.FromTimestamp)) + receiveOpts = append(receiveOpts, eventhubClient.ReceiveFromTimestamp(e.FromTimestamp)) } else if e.Latest { - receiveOpts = append(receiveOpts, eventhub.ReceiveWithLatestOffset()) + receiveOpts = append(receiveOpts, eventhubClient.ReceiveWithLatestOffset()) } if e.PrefetchCount != 0 { - receiveOpts = append(receiveOpts, eventhub.ReceiveWithPrefetchCount(e.PrefetchCount)) + receiveOpts = append(receiveOpts, eventhubClient.ReceiveWithPrefetchCount(e.PrefetchCount)) } if e.Epoch != 0 { - receiveOpts = append(receiveOpts, eventhub.ReceiveWithEpoch(e.Epoch)) + receiveOpts = append(receiveOpts, eventhubClient.ReceiveWithEpoch(e.Epoch)) } return receiveOpts @@ -263,7 +264,7 @@ func (e *EventHub) configureReceiver() []eventhub.ReceiveOption { // OnMessage handles an Event. When this function returns without error the // Event is immediately accepted and the offset is updated. If an error is // returned the Event is marked for redelivery. -func (e *EventHub) onMessage(ctx context.Context, event *eventhub.Event) error { +func (e *EventHub) onMessage(ctx context.Context, event *eventhubClient.Event) error { metrics, err := e.createMetrics(event) if err != nil { return err @@ -345,7 +346,7 @@ func deepCopyMetrics(in []telegraf.Metric) []telegraf.Metric { } // CreateMetrics returns the Metrics from the Event. -func (e *EventHub) createMetrics(event *eventhub.Event) ([]telegraf.Metric, error) { +func (e *EventHub) createMetrics(event *eventhubClient.Event) ([]telegraf.Metric, error) { metrics, err := e.parser.Parse(event.Data) if err != nil { return nil, err diff --git a/plugins/inputs/exec/exec.go b/plugins/inputs/exec/exec.go index afc6beb6a7a80..e8ba23db44522 100644 --- a/plugins/inputs/exec/exec.go +++ b/plugins/inputs/exec/exec.go @@ -4,20 +4,21 @@ import ( "bytes" "fmt" "io" - "os/exec" + osExec "os/exec" "path/filepath" "runtime" "strings" "sync" "time" + "github.com/kballard/go-shellquote" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/internal" "github.com/influxdata/telegraf/plugins/inputs" "github.com/influxdata/telegraf/plugins/parsers" "github.com/influxdata/telegraf/plugins/parsers/nagios" - "github.com/kballard/go-shellquote" ) const sampleConfig = ` @@ -76,7 +77,7 @@ func (c CommandRunner) Run( return nil, nil, fmt.Errorf("exec: unable to parse command, %s", err) } - cmd := exec.Command(splitCmd[0], splitCmd[1:]...) + cmd := osExec.Command(splitCmd[0], splitCmd[1:]...) var ( out bytes.Buffer diff --git a/plugins/inputs/execd/execd_test.go b/plugins/inputs/execd/execd_test.go index 72c84e1d12cc6..a8c8364394480 100644 --- a/plugins/inputs/execd/execd_test.go +++ b/plugins/inputs/execd/execd_test.go @@ -139,8 +139,8 @@ func (tm *TestMetricMaker) LogName() string { return tm.Name() } -func (tm *TestMetricMaker) MakeMetric(metric telegraf.Metric) telegraf.Metric { - return metric +func (tm *TestMetricMaker) MakeMetric(aMetric telegraf.Metric) telegraf.Metric { + return aMetric } func (tm *TestMetricMaker) Log() telegraf.Logger { From 8378a5dbf2a369c368c5f94647254f22229a87cd Mon Sep 17 00:00:00 2001 From: Jack Henschel Date: Mon, 21 Jun 2021 18:50:19 +0300 Subject: [PATCH 02/85] Adjust link to ceph documentation (#9378) (cherry picked from commit 5f6c37bb8630cef888db8c2e76c9c149f6e90035) --- plugins/inputs/ceph/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/ceph/README.md b/plugins/inputs/ceph/README.md index dc58adb0ffe6b..5d5afadc19fad 100644 --- a/plugins/inputs/ceph/README.md +++ b/plugins/inputs/ceph/README.md @@ -2,7 +2,7 @@ Collects performance metrics from the MON and OSD nodes in a Ceph storage cluster. -Ceph has introduced a Telegraf and Influx plugin in the 13.x Mimic release. The Telegraf module sends to a Telegraf configured with a socket_listener. [Learn more in their docs](http://docs.ceph.com/docs/mimic/mgr/telegraf/) +Ceph has introduced a Telegraf and Influx plugin in the 13.x Mimic release. The Telegraf module sends to a Telegraf configured with a socket_listener. [Learn more in their docs](https://docs.ceph.com/en/latest/mgr/telegraf/) *Admin Socket Stats* From 7b380190b1de2f6c96ee4da18030cd666ef0ccd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 21 Jun 2021 18:56:16 +0200 Subject: [PATCH 03/85] kube_inventory: expand tls key/tls certificate documentation (#9357) (cherry picked from commit cf616939f19f738cc97ccb1cea8bbfde2cc79c5f) --- plugins/inputs/kube_inventory/README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/plugins/inputs/kube_inventory/README.md b/plugins/inputs/kube_inventory/README.md index c9d6fb0be467d..7803d4fc4e9eb 100644 --- a/plugins/inputs/kube_inventory/README.md +++ b/plugins/inputs/kube_inventory/README.md @@ -68,8 +68,11 @@ avoid cardinality issues: selector_exclude = ["*"] ## Optional TLS Config + ## Trusted root certificates for server # tls_ca = "/path/to/cafile" + ## Used for TLS client certificate authentication # tls_cert = "/path/to/certfile" + ## Used for TLS client certificate authentication # tls_key = "/path/to/keyfile" ## Use TLS but skip chain & host verification # insecure_skip_verify = false @@ -127,6 +130,26 @@ subjects: namespace: default ``` +## Quickstart in k3s + +When monitoring [k3s](https://k3s.io) server instances one can re-use already generated administration token. +This is less secure than using the more restrictive dedicated telegraf user but more convienient to set up. + +```console +# an empty token will make telegraf use the client cert/key files instead +$ touch /run/telegraf-kubernetes-token +# replace `telegraf` with the user the telegraf process is running as +$ install -o telegraf -m400 /var/lib/rancher/k3s/server/tls/client-admin.crt /run/telegraf-kubernetes-cert +$ install -o telegraf -m400 /var/lib/rancher/k3s/server/tls/client-admin.key /run/telegraf-kubernetes-key +``` + +```toml +[kube_inventory] +bearer_token = "/run/telegraf-kubernetes-token" +tls_cert = "/run/telegraf-kubernetes-cert" +tls_key = "/run/telegraf-kubernetes-key" +``` + ### Metrics: - kubernetes_daemonset From 55b09b26cb1304ad80f94c505ea414b93bede7d7 Mon Sep 17 00:00:00 2001 From: Mya Date: Mon, 21 Jun 2021 11:09:17 -0600 Subject: [PATCH 04/85] gjson dependancy updated to v1.8.0 (#9372) (cherry picked from commit 1453c47f017b26601b475ad42ab7ecd88f0d15d1) --- go.mod | 2 +- go.sum | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index c7d9335f67631..050bb30fea4c5 100644 --- a/go.mod +++ b/go.mod @@ -117,7 +117,7 @@ require ( github.com/stretchr/testify v1.7.0 github.com/tbrandon/mbserver v0.0.0-20170611213546-993e1772cc62 github.com/testcontainers/testcontainers-go v0.11.0 - github.com/tidwall/gjson v1.6.0 + github.com/tidwall/gjson v1.8.0 github.com/tinylib/msgp v1.1.5 github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/vapourismo/knx-go v0.0.0-20201122213738-75fe09ace330 diff --git a/go.sum b/go.sum index 3e850d4b99485..84c5e0316b358 100644 --- a/go.sum +++ b/go.sum @@ -1423,12 +1423,13 @@ github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc/go.mod h1:eyZnKCc955uh98WQvzOm0dgAeLnf2O0Rz0LPoC5ze+0= github.com/testcontainers/testcontainers-go v0.11.0 h1:HO5YOx2DYBHqcg4MzVWPj3FuHAv7USWVu94vCSsgiaM= github.com/testcontainers/testcontainers-go v0.11.0/go.mod h1:HztBCODzuA+YpMXGK8amjO8j50jz2gcT0BOzSKUiYIs= -github.com/tidwall/gjson v1.6.0 h1:9VEQWz6LLMUsUl6PueE49ir4Ka6CzLymOAZDxpFsTDc= -github.com/tidwall/gjson v1.6.0/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= -github.com/tidwall/match v1.0.1 h1:PnKP62LPNxHKTwvHHZZzdOAOCtsJTjo6dZLCwpKm5xc= -github.com/tidwall/match v1.0.1/go.mod h1:LujAq0jyVjBy028G1WhWfIzbpQfMO8bBZ6Tyb0+pL9E= -github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4= +github.com/tidwall/gjson v1.8.0 h1:Qt+orfosKn0rbNTZqHYDqBrmm3UDA4KRkv70fDzG+PQ= +github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= +github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= +github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/tidwall/pretty v1.1.0 h1:K3hMW5epkdAVwibsQEfR/7Zj0Qgt4DxtNumTq/VloO8= +github.com/tidwall/pretty v1.1.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.1.5 h1:2gXmtWueD2HefZHQe1QOy9HVzmFrLOVvsXwXBQ0ayy0= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= From 233c57f88fde9a1031279a45c15744041f55d2fd Mon Sep 17 00:00:00 2001 From: Jarno Huuskonen Date: Tue, 22 Jun 2021 19:41:45 +0300 Subject: [PATCH 05/85] Fix x509_cert input plugin SNI support (#9289) (cherry picked from commit ac9bf5a0ec9d1039bc6f6ffb21906f1fabaffce4) --- plugins/inputs/x509_cert/x509_cert.go | 15 ++++++++++++--- plugins/inputs/x509_cert/x509_cert_test.go | 10 ++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/x509_cert/x509_cert.go b/plugins/inputs/x509_cert/x509_cert.go index 7c1b0657c7e80..fc81ebb717be1 100644 --- a/plugins/inputs/x509_cert/x509_cert.go +++ b/plugins/inputs/x509_cert/x509_cert.go @@ -66,8 +66,7 @@ func (c *X509Cert) SampleConfig() string { func (c *X509Cert) sourcesToURLs() error { for _, source := range c.Sources { if strings.HasPrefix(source, "file://") || - strings.HasPrefix(source, "/") || - strings.Index(source, ":\\") != 1 { + strings.HasPrefix(source, "/") { source = filepath.ToSlash(strings.TrimPrefix(source, "file://")) g, err := globpath.Compile(source) if err != nil { @@ -82,7 +81,6 @@ func (c *X509Cert) sourcesToURLs() error { if err != nil { return fmt.Errorf("failed to parse cert location - %s", err.Error()) } - c.locations = append(c.locations, u) } } @@ -127,6 +125,9 @@ func (c *X509Cert) getCert(u *url.URL, timeout time.Duration) ([]*x509.Certifica conn := tls.Client(ipConn, c.tlsCfg) defer conn.Close() + // reset SNI between requests + defer func() { c.tlsCfg.ServerName = "" }() + hsErr := conn.Handshake() if hsErr != nil { return nil, hsErr @@ -313,6 +314,14 @@ func (c *X509Cert) Init() error { tlsCfg = &tls.Config{} } + if tlsCfg.ServerName != "" && c.ServerName == "" { + // Save SNI from tlsCfg.ServerName to c.ServerName and reset tlsCfg.ServerName. + // We need to reset c.tlsCfg.ServerName for each certificate when there's + // no explicit SNI (c.tlsCfg.ServerName or c.ServerName) otherwise we'll always (re)use + // first uri HostName for all certs (see issue 8914) + c.ServerName = tlsCfg.ServerName + tlsCfg.ServerName = "" + } c.tlsCfg = tlsCfg return nil diff --git a/plugins/inputs/x509_cert/x509_cert_test.go b/plugins/inputs/x509_cert/x509_cert_test.go index 3253c9ac9c7ae..4f09b903b4c24 100644 --- a/plugins/inputs/x509_cert/x509_cert_test.go +++ b/plugins/inputs/x509_cert/x509_cert_test.go @@ -316,6 +316,16 @@ func TestGatherCertMustNotTimeout(t *testing.T) { assert.True(t, acc.HasMeasurement("x509_cert")) } +func TestSourcesToURLs(t *testing.T) { + m := &X509Cert{ + Sources: []string{"https://www.influxdata.com:443", "tcp://influxdata.com:443", "file:///dummy_test_path_file.pem", "/tmp/dummy_test_path_glob*.pem"}, + } + require.NoError(t, m.Init()) + + assert.Equal(t, len(m.globpaths), 2) + assert.Equal(t, len(m.locations), 2) +} + func TestServerName(t *testing.T) { tests := []struct { name string From b3e84c085900edb4fec4cddc5e1cbd020e205dfe Mon Sep 17 00:00:00 2001 From: Mya Date: Tue, 22 Jun 2021 10:48:29 -0600 Subject: [PATCH 06/85] tags no longer required in included_keys (#9406) (cherry picked from commit 8638a417246b0ae34f84ad5ae714ccb813a3a691) --- plugins/parsers/json_v2/parser.go | 2 ++ .../json_v2/testdata/nested_and_nonnested_tags/telegraf.conf | 2 -- plugins/parsers/json_v2/testdata/object/telegraf.conf | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/parsers/json_v2/parser.go b/plugins/parsers/json_v2/parser.go index e586b35ebddc2..d013f6b35e24f 100644 --- a/plugins/parsers/json_v2/parser.go +++ b/plugins/parsers/json_v2/parser.go @@ -484,6 +484,8 @@ func (p *Parser) isIncluded(key string, val gjson.Result) bool { if len(p.currentSettings.IncludedKeys) == 0 { return true } + // automatically adds tags to included_keys so it does NOT have to be repeated in the config + p.currentSettings.IncludedKeys = append(p.currentSettings.IncludedKeys, p.currentSettings.Tags...) for _, i := range p.currentSettings.IncludedKeys { if i == key { return true diff --git a/plugins/parsers/json_v2/testdata/nested_and_nonnested_tags/telegraf.conf b/plugins/parsers/json_v2/testdata/nested_and_nonnested_tags/telegraf.conf index 45692dc5df0e2..e1748b463690b 100644 --- a/plugins/parsers/json_v2/testdata/nested_and_nonnested_tags/telegraf.conf +++ b/plugins/parsers/json_v2/testdata/nested_and_nonnested_tags/telegraf.conf @@ -9,10 +9,8 @@ data_format = "json_v2" disable_prepend_keys = true path = "@this" included_keys = [ - "hostname", "systemVoltage", "systemCurrent", "tables", - "tables_outputname", ] tags = ["hostname", "tables_outputname"] diff --git a/plugins/parsers/json_v2/testdata/object/telegraf.conf b/plugins/parsers/json_v2/testdata/object/telegraf.conf index 6ad244fd71418..50ed245a3cf00 100644 --- a/plugins/parsers/json_v2/testdata/object/telegraf.conf +++ b/plugins/parsers/json_v2/testdata/object/telegraf.conf @@ -6,7 +6,7 @@ [[inputs.file.json_v2.object]] path = "root.station" disable_prepend_keys = true - included_keys = ["name", "etd_destination", "etd_estimate_minutes"] + included_keys = ["etd_estimate_minutes"] tags = ["name", "etd_destination"] [inputs.file.json_v2.object.fields] etd_estimate_minutes = "int" From a21c212e59b2b49025a411a86408f11c807089d4 Mon Sep 17 00:00:00 2001 From: Mya Date: Tue, 22 Jun 2021 10:54:33 -0600 Subject: [PATCH 07/85] Update signalfx to v3.3.0->v3.3.34 (#9375) (cherry picked from commit 812fbd6791c76cbc57ee9c266ef50be47bf450d6) --- go.mod | 2 +- go.sum | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 050bb30fea4c5..784b4e32456fe 100644 --- a/go.mod +++ b/go.mod @@ -110,7 +110,7 @@ require ( github.com/sensu/sensu-go/api/core/v2 v2.6.0 github.com/shirou/gopsutil v3.21.3+incompatible github.com/shopspring/decimal v0.0.0-20200105231215-408a2507e114 // indirect - github.com/signalfx/golib/v3 v3.3.0 + github.com/signalfx/golib/v3 v3.3.34 github.com/sirupsen/logrus v1.7.0 github.com/snowflakedb/gosnowflake v1.5.0 github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 diff --git a/go.sum b/go.sum index 84c5e0316b358..136ef86b709fe 100644 --- a/go.sum +++ b/go.sum @@ -1342,12 +1342,12 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/shurcooL/vfsgen v0.0.0-20181202132449-6a9ea43bcacd/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= github.com/shurcooL/vfsgen v0.0.0-20200627165143-92b8a710ab6c/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw= -github.com/signalfx/com_signalfx_metrics_protobuf v0.0.0-20190222193949-1fb69526e884 h1:KgLGEw137KEUtQnWBGzneCetphBj4+kKHRnhpAkXJC0= -github.com/signalfx/com_signalfx_metrics_protobuf v0.0.0-20190222193949-1fb69526e884/go.mod h1:muYA2clvwCdj7nzAJ5vJIXYpJsUumhAl4Uu1wUNpWzA= +github.com/signalfx/com_signalfx_metrics_protobuf v0.0.2 h1:X886QgwZH5qr9HIQkk3mWcNEhUxx6D8rUZumzLV4Wiw= +github.com/signalfx/com_signalfx_metrics_protobuf v0.0.2/go.mod h1:tCQQqyJAVF1+mxNdqOi18sS/zaSrE6EMyWwRA2QTl70= github.com/signalfx/gohistogram v0.0.0-20160107210732-1ccfd2ff5083 h1:WsShHmu12ZztYPfh9b+I+VjYD1o8iOHhB67WZCMEEE8= github.com/signalfx/gohistogram v0.0.0-20160107210732-1ccfd2ff5083/go.mod h1:adPDS6s7WaajdFBV9mQ7i0dKfQ8xiDnF9ZNETVPpp7c= -github.com/signalfx/golib/v3 v3.3.0 h1:vSXsAb73bdrlnjk5rnZ7y3t09Qzu9qfBEbXdcyBHsmE= -github.com/signalfx/golib/v3 v3.3.0/go.mod h1:GzjWpV0skAXZn7+u9LnkOkiXAx9KKd5XZcd5r+RoF5o= +github.com/signalfx/golib/v3 v3.3.34 h1:s78S24+exS0jH21oeSB1qPeiekIKkeXGv0hg7f67HvU= +github.com/signalfx/golib/v3 v3.3.34/go.mod h1:PB7OovVijH7OGhzMewarEcIZG3eG6akWMDucIb5Jnb4= github.com/signalfx/gomemcache v0.0.0-20180823214636-4f7ef64c72a9/go.mod h1:Ytb8KfCSyuwy/VILnROdgCvbQLA5ch0nkbG7lKT0BXw= github.com/signalfx/sapm-proto v0.4.0 h1:5lQX++6FeIjUZEIcnSgBqhOpmSjMkRBW3y/4ZiKMo5E= github.com/signalfx/sapm-proto v0.4.0/go.mod h1:x3gtwJ1GRejtkghB4nYpwixh2zqJrLbPU959ZNhM0Fk= @@ -1496,6 +1496,7 @@ github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPS github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.etcd.io/etcd v0.5.0-alpha.5.0.20200910180754-dd1b699fc489/go.mod h1:yVHk9ub3CSBatqGNg7GRmsnfLWtoW60w4eDYfh7vHDg= From f710ba9b37e4fabb98851d85c50c9eb948213bdf Mon Sep 17 00:00:00 2001 From: Sven Rebhan <36194019+srebhan@users.noreply.github.com> Date: Tue, 22 Jun 2021 20:45:03 +0200 Subject: [PATCH 08/85] Fix messing up the 'source' tag for https sources. (#9400) (cherry picked from commit d63a7010d965b0ecf16424b4f4b67beb7df167ac) --- plugins/inputs/x509_cert/x509_cert.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/x509_cert/x509_cert.go b/plugins/inputs/x509_cert/x509_cert.go index fc81ebb717be1..4ac115931a26a 100644 --- a/plugins/inputs/x509_cert/x509_cert.go +++ b/plugins/inputs/x509_cert/x509_cert.go @@ -102,14 +102,15 @@ func (c *X509Cert) serverName(u *url.URL) (string, error) { } func (c *X509Cert) getCert(u *url.URL, timeout time.Duration) ([]*x509.Certificate, error) { + protocol := u.Scheme switch u.Scheme { case "https": - u.Scheme = "tcp" + protocol = "tcp" fallthrough case "udp", "udp4", "udp6": fallthrough case "tcp", "tcp4", "tcp6": - ipConn, err := net.DialTimeout(u.Scheme, u.Host, timeout) + ipConn, err := net.DialTimeout(protocol, u.Host, timeout) if err != nil { return nil, err } From 44af73df340c8c9122982b313f625431bd0589d7 Mon Sep 17 00:00:00 2001 From: Mya Date: Tue, 22 Jun 2021 14:56:29 -0600 Subject: [PATCH 09/85] fixing insecure_skip_verify (#9413) (cherry picked from commit 84a37642d53edd9c598ef326655070da5a25b160) --- plugins/outputs/http/http.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/plugins/outputs/http/http.go b/plugins/outputs/http/http.go index 5da273f2d40a6..76d97aa9040bc 100644 --- a/plugins/outputs/http/http.go +++ b/plugins/outputs/http/http.go @@ -13,7 +13,6 @@ import ( "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal" httpconfig "github.com/influxdata/telegraf/plugins/common/http" - "github.com/influxdata/telegraf/plugins/common/tls" "github.com/influxdata/telegraf/plugins/outputs" "github.com/influxdata/telegraf/plugins/serializers" ) @@ -83,7 +82,6 @@ type HTTP struct { Password string `toml:"password"` Headers map[string]string `toml:"headers"` ContentEncoding string `toml:"content_encoding"` - tls.ClientConfig httpconfig.HTTPClientConfig client *http.Client From 00ecaa9a37e6b1f681b0301cacd7cf7702c44226 Mon Sep 17 00:00:00 2001 From: Mya Date: Tue, 22 Jun 2021 14:59:02 -0600 Subject: [PATCH 10/85] added a check for oid and name to prevent empty metrics (#9366) (cherry picked from commit b846c5069dc284104c80791058aa6240117be5bd) --- plugins/inputs/snmp/snmp.go | 6 ++++++ plugins/inputs/snmp/snmp_test.go | 26 +++++++++++++++++++++----- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/plugins/inputs/snmp/snmp.go b/plugins/inputs/snmp/snmp.go index ec881205c6f68..7f2df6b689eac 100644 --- a/plugins/inputs/snmp/snmp.go +++ b/plugins/inputs/snmp/snmp.go @@ -173,6 +173,12 @@ type Table struct { // Init() builds & initializes the nested fields. func (t *Table) Init() error { + //makes sure oid or name is set in config file + //otherwise snmp will produce metrics with an empty name + if t.Oid == "" && t.Name == "" { + return fmt.Errorf("SNMP table in config file is not named. One or both of the oid and name settings must be set") + } + if t.initialized { return nil } diff --git a/plugins/inputs/snmp/snmp_test.go b/plugins/inputs/snmp/snmp_test.go index ef849f07b138c..f447f13c54e67 100644 --- a/plugins/inputs/snmp/snmp_test.go +++ b/plugins/inputs/snmp/snmp_test.go @@ -199,11 +199,12 @@ func TestSnmpInit_noTranslate(t *testing.T) { {Oid: ".1.1.1.3"}, }, Tables: []Table{ - {Fields: []Field{ - {Oid: ".1.1.1.4", Name: "four", IsTag: true}, - {Oid: ".1.1.1.5", Name: "five"}, - {Oid: ".1.1.1.6"}, - }}, + {Name: "testing", + Fields: []Field{ + {Oid: ".1.1.1.4", Name: "four", IsTag: true}, + {Oid: ".1.1.1.5", Name: "five"}, + {Oid: ".1.1.1.6"}, + }}, }, } @@ -235,6 +236,21 @@ func TestSnmpInit_noTranslate(t *testing.T) { assert.Equal(t, false, s.Tables[0].Fields[2].IsTag) } +func TestSnmpInit_noName_noOid(t *testing.T) { + s := &Snmp{ + Tables: []Table{ + {Fields: []Field{ + {Oid: ".1.1.1.4", Name: "four", IsTag: true}, + {Oid: ".1.1.1.5", Name: "five"}, + {Oid: ".1.1.1.6"}, + }}, + }, + } + + err := s.init() + require.Error(t, err) +} + func TestGetSNMPConnection_v2(t *testing.T) { s := &Snmp{ Agents: []string{"1.2.3.4:567", "1.2.3.4", "udp://127.0.0.1"}, From a7e140860f7f90eaae164194810c9ca5d8b52489 Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Tue, 22 Jun 2021 16:40:40 -0500 Subject: [PATCH 11/85] Update couchbase dependencies to v0.1.0 (#9412) (cherry picked from commit 5be079c2723a44d19e9862f8491e5a497ff67d72) --- docs/LICENSE_OF_DEPENDENCIES.md | 2 +- go.mod | 6 +++--- go.sum | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index 9e5e9386c1198..5911ba37a6899 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -53,7 +53,7 @@ following works: - github.com/containerd/containerd [Apache License 2.0](https://github.com/containerd/containerd/blob/master/LICENSE) - github.com/couchbase/go-couchbase [MIT License](https://github.com/couchbase/go-couchbase/blob/master/LICENSE) - github.com/couchbase/gomemcached [MIT License](https://github.com/couchbase/gomemcached/blob/master/LICENSE) -- github.com/couchbase/goutils [COUCHBASE INC. COMMUNITY EDITION LICENSE](https://github.com/couchbase/goutils/blob/master/LICENSE.md) +- github.com/couchbase/goutils [Apache License 2.0](https://github.com/couchbase/goutils/blob/master/LICENSE.md) - github.com/davecgh/go-spew [ISC License](https://github.com/davecgh/go-spew/blob/master/LICENSE) - github.com/denisenkom/go-mssqldb [BSD 3-Clause "New" or "Revised" License](https://github.com/denisenkom/go-mssqldb/blob/master/LICENSE.txt) - github.com/devigned/tab [MIT License](https://github.com/devigned/tab/blob/master/LICENSE) diff --git a/go.mod b/go.mod index 784b4e32456fe..efeb99e4ffb76 100644 --- a/go.mod +++ b/go.mod @@ -38,9 +38,9 @@ require ( github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 github.com/caio/go-tdigest v3.1.0+incompatible github.com/cisco-ie/nx-telemetry-proto v0.0.0-20190531143454-82441e232cf6 - github.com/couchbase/go-couchbase v0.0.0-20180501122049-16db1f1fe037 - github.com/couchbase/gomemcached v0.0.0-20180502221210-0da75df14530 // indirect - github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a // indirect + github.com/couchbase/go-couchbase v0.1.0 + github.com/couchbase/gomemcached v0.1.3 // indirect + github.com/couchbase/goutils v0.1.0 // indirect github.com/denisenkom/go-mssqldb v0.10.0 github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 github.com/dimchansky/utfbom v1.1.1 diff --git a/go.sum b/go.sum index 136ef86b709fe..26f78e4520604 100644 --- a/go.sum +++ b/go.sum @@ -393,12 +393,12 @@ github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+ github.com/coreos/go-systemd/v22 v22.1.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/couchbase/go-couchbase v0.0.0-20180501122049-16db1f1fe037 h1:Dbz60fpCq04vRxVVVJLbQuL0G7pRt0Gyo2BkozFc4SQ= -github.com/couchbase/go-couchbase v0.0.0-20180501122049-16db1f1fe037/go.mod h1:TWI8EKQMs5u5jLKW/tsb9VwauIrMIxQG1r5fMsswK5U= -github.com/couchbase/gomemcached v0.0.0-20180502221210-0da75df14530 h1:F8nmbiuX+gCz9xvWMi6Ak8HQntB4ATFXP46gaxifbp4= -github.com/couchbase/gomemcached v0.0.0-20180502221210-0da75df14530/go.mod h1:srVSlQLB8iXBVXHgnqemxUXqN6FCvClgCMPCsjBDR7c= -github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a h1:Y5XsLCEhtEI8qbD9RP3Qlv5FXdTDHxZM9UPUnMRgBp8= -github.com/couchbase/goutils v0.0.0-20180530154633-e865a1461c8a/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= +github.com/couchbase/go-couchbase v0.1.0 h1:g4bCvDwRL+ZL6HLhYeRlXxEYP31Wpy0VFxnFw6efEp8= +github.com/couchbase/go-couchbase v0.1.0/go.mod h1:+/bddYDxXsf9qt0xpDUtRR47A2GjaXmGGAqQ/k3GJ8A= +github.com/couchbase/gomemcached v0.1.3 h1:HIc5qMYNbuhB7zNaiEtj61DCYkquAwrQlf64q7JzdEY= +github.com/couchbase/gomemcached v0.1.3/go.mod h1:mxliKQxOv84gQ0bJWbI+w9Wxdpt9HjDvgW9MjCym5Vo= +github.com/couchbase/goutils v0.1.0 h1:0WLlKJilu7IBm98T8nS9+J36lBFVLRUSIUtyD/uWpAE= +github.com/couchbase/goutils v0.1.0/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= From 02eafac563f39595ff6573502c627e48dba386c9 Mon Sep 17 00:00:00 2001 From: Mya Date: Tue, 22 Jun 2021 15:45:43 -0600 Subject: [PATCH 12/85] updated jwt to v1.2.2 and updated jwt-go to v3.2.3 (#9373) (cherry picked from commit 3c0f152a7d4d8e96e46aa4309a1d5433836cc607) --- go.mod | 2 ++ go.sum | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index efeb99e4ffb76..b3fe993d82e24 100644 --- a/go.mod +++ b/go.mod @@ -47,6 +47,7 @@ require ( github.com/docker/docker v20.10.6+incompatible github.com/dynatrace-oss/dynatrace-metric-utils-go v0.1.0 github.com/eclipse/paho.mqtt.golang v1.3.0 + github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 github.com/go-logfmt/logfmt v0.5.0 github.com/go-ping/ping v0.0.0-20210201095549-52eed920f98c @@ -93,6 +94,7 @@ require ( github.com/moby/ipvs v1.0.1 github.com/multiplay/go-ts3 v1.0.0 github.com/naoina/go-stringutil v0.1.0 // indirect + github.com/nats-io/jwt v1.2.2 // indirect github.com/nats-io/nats-server/v2 v2.1.4 github.com/nats-io/nats.go v1.10.0 github.com/newrelic/newrelic-telemetry-sdk-go v0.5.1 diff --git a/go.sum b/go.sum index 26f78e4520604..99514d7d03e50 100644 --- a/go.sum +++ b/go.sum @@ -500,8 +500,9 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= -github.com/form3tech-oss/jwt-go v3.2.2+incompatible h1:TcekIExNqud5crz4xD2pavyTgWiPvpYe4Xau31I0PRk= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible h1:7ZaBxOI7TMoYBfyA3cQHErNNyAWIKUMIwqxEtgHOs5c= +github.com/form3tech-oss/jwt-go v3.2.3+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -1118,8 +1119,9 @@ github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+ github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks= github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= -github.com/nats-io/jwt v0.3.2 h1:+RB5hMpXUUA2dfxuhBTEkMOrYmM+gKIZYS1KjSostMI= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= +github.com/nats-io/jwt v1.2.2 h1:w3GMTO969dFg+UOKTmmyuu7IGdusK+7Ytlt//OYH/uU= +github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= github.com/nats-io/nats-server/v2 v2.1.4 h1:BILRnsJ2Yb/fefiFbBWADpViGF69uh4sxe8poVDQ06g= github.com/nats-io/nats-server/v2 v2.1.4/go.mod h1:Jw1Z28soD/QasIA2uWjXyM9El1jly3YwyFOuR8tH1rg= @@ -1128,8 +1130,9 @@ github.com/nats-io/nats.go v1.10.0 h1:L8qnKaofSfNFbXg0C5F71LdjPRnmQwSsA4ukmkt1Tv github.com/nats-io/nats.go v1.10.0/go.mod h1:AjGArbfyR50+afOUotNX2Xs5SYHf+CoOa5HH1eEl2HE= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.4 h1:aEsHIssIk6ETN5m2/MD8Y4B2X7FfXrBAUdkyRvbVYzA= github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.2.0 h1:WXKF7diOaPU9cJdLD7nuzwasQy9vT1tBqzXZZf3AMJM= +github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= From 790d48fcef7c9109eda40d6d701e009e1c5a78dc Mon Sep 17 00:00:00 2001 From: Russ Savage Date: Wed, 23 Jun 2021 09:26:13 -0700 Subject: [PATCH 13/85] chore: readme updates (#9367) (cherry picked from commit 314bc0ff7f9d59a93b1f048662ac3400769fcb85) --- plugins/inputs/aliyuncms/README.md | 2 +- plugins/inputs/cisco_telemetry_mdt/README.md | 2 +- plugins/inputs/dpdk/README.md | 2 +- plugins/inputs/knx_listener/README.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/inputs/aliyuncms/README.md b/plugins/inputs/aliyuncms/README.md index c239baa63e05c..4e351ea6d8b37 100644 --- a/plugins/inputs/aliyuncms/README.md +++ b/plugins/inputs/aliyuncms/README.md @@ -1,4 +1,4 @@ -# Alibaba (aka Aliyun) CloudMonitor Service Statistics Input +# Alibaba (Aliyun) CloudMonitor Service Statistics Input Plugin Here and after we use `Aliyun` instead `Alibaba` as it is default naming across web console and docs. This plugin will pull Metric Statistics from Aliyun CMS. diff --git a/plugins/inputs/cisco_telemetry_mdt/README.md b/plugins/inputs/cisco_telemetry_mdt/README.md index d15f122081d05..f4ca7243b8cde 100644 --- a/plugins/inputs/cisco_telemetry_mdt/README.md +++ b/plugins/inputs/cisco_telemetry_mdt/README.md @@ -1,4 +1,4 @@ -# Cisco model-driven telemetry (MDT) +# Cisco Model-Driven Telemetry (MDT) Input Plugin Cisco model-driven telemetry (MDT) is an input plugin that consumes telemetry data from Cisco IOS XR, IOS XE and NX-OS platforms. It supports TCP & GRPC dialout transports. diff --git a/plugins/inputs/dpdk/README.md b/plugins/inputs/dpdk/README.md index bd98af050427d..00398760d2e9d 100644 --- a/plugins/inputs/dpdk/README.md +++ b/plugins/inputs/dpdk/README.md @@ -1,4 +1,4 @@ -# DPDK Input Plugin +# Data Plane Development Kit (DPDK) Input Plugin The `dpdk` plugin collects metrics exposed by applications built with [Data Plane Development Kit](https://www.dpdk.org/) which is an extensive set of open source libraries designed for accelerating packet processing workloads. diff --git a/plugins/inputs/knx_listener/README.md b/plugins/inputs/knx_listener/README.md index de015ddc2793b..7a06462ffbb3e 100644 --- a/plugins/inputs/knx_listener/README.md +++ b/plugins/inputs/knx_listener/README.md @@ -1,4 +1,4 @@ -# KNX input plugin +# KNX Input Plugin The KNX input plugin that listens for messages on the KNX home-automation bus. This plugin connects to the KNX bus via a KNX-IP interface. From 25dd7ae23164f87444a4ae34f3aed4795c30057f Mon Sep 17 00:00:00 2001 From: Mya Date: Wed, 23 Jun 2021 16:08:28 -0600 Subject: [PATCH 14/85] apimachinary updated to v0.21.1 (#9370) (cherry picked from commit f9fc64efd61e0e72c9c0742af8ede5e2db7cf84d) --- go.mod | 4 ++-- go.sum | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index b3fe993d82e24..9214094f46e36 100644 --- a/go.mod +++ b/go.mod @@ -135,7 +135,7 @@ require ( golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/sync v0.0.0-20201207232520-09787c993a3a - golang.org/x/sys v0.0.0-20210324051608-47abb6519492 + golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 golang.org/x/text v0.3.4 golang.org/x/tools v0.1.0 golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4 @@ -151,7 +151,7 @@ require ( gopkg.in/yaml.v2 v2.4.0 gotest.tools v2.2.0+incompatible k8s.io/api v0.20.4 - k8s.io/apimachinery v0.20.4 + k8s.io/apimachinery v0.21.1 k8s.io/client-go v0.20.4 modernc.org/sqlite v1.10.8 ) diff --git a/go.sum b/go.sum index 99514d7d03e50..5455c207d39d6 100644 --- a/go.sum +++ b/go.sum @@ -535,8 +535,9 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v0.2.0 h1:QvGt2nLcHH0WK9orKa+ppBPAxREcH364nPUedEpK0TY= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc= +github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-ole/go-ole v1.2.4 h1:nNBDSCOigTSiarFpYE9J/KtEA1IOW4CNeqT9TQDqCxI= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= @@ -1083,6 +1084,7 @@ github.com/moby/ipvs v1.0.1 h1:aoZ7fhLTXgDbzVrAnvV+XbKOU8kOET7B3+xULDF/1o0= github.com/moby/ipvs v1.0.1/go.mod h1:2pngiyseZbIKXNv7hsKj3O9UEz30c53MT9005gt2hxQ= github.com/moby/ipvs v1.0.1/go.mod h1:2pngiyseZbIKXNv7hsKj3O9UEz30c53MT9005gt2hxQ= github.com/moby/ipvs v1.0.1/go.mod h1:2pngiyseZbIKXNv7hsKj3O9UEz30c53MT9005gt2hxQ= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/sys/mount v0.2.0 h1:WhCW5B355jtxndN5ovugJlMFJawbUODuW8fSnEH6SSM= github.com/moby/sys/mount v0.2.0 h1:WhCW5B355jtxndN5ovugJlMFJawbUODuW8fSnEH6SSM= github.com/moby/sys/mount v0.2.0/go.mod h1:aAivFE2LB3W4bACsUXChRHQ0qKWsetY4Y9V7sxOougM= @@ -1654,6 +1656,7 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -1771,10 +1774,12 @@ golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492 h1:Paq34FxTluEPvVyayQqMPgHm+vTOrIifmcYxFBx9TLg= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 h1:dXfMednGJh/SUUFjTLsWJz3P+TQt9qnR11GgeI3vWKs= +golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -2057,8 +2062,9 @@ k8s.io/api v0.20.4 h1:xZjKidCirayzX6tHONRQyTNDVIR55TYVqgATqo6ZULY= k8s.io/api v0.20.4/go.mod h1:++lNL1AJMkDymriNniQsWRkMDzRaX2Y/POTUi8yvqYQ= k8s.io/apimachinery v0.18.8/go.mod h1:6sQd+iHEqmOtALqOFjSWp2KZ9F0wlU/nWm0ZgsYWMig= k8s.io/apimachinery v0.20.1/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= -k8s.io/apimachinery v0.20.4 h1:vhxQ0PPUUU2Ns1b9r4/UFp13UPs8cw2iOoTjnY9faa0= k8s.io/apimachinery v0.20.4/go.mod h1:WlLqWAHZGg07AeltaI0MV5uk1Omp8xaN0JGLY6gkRpU= +k8s.io/apimachinery v0.21.1 h1:Q6XuHGlj2xc+hlMCvqyYfbv3H7SRGn2c8NycxJquDVs= +k8s.io/apimachinery v0.21.1/go.mod h1:jbreFvJo3ov9rj7eWT7+sYiRx+qZuCYXwWT1bcDswPY= k8s.io/apiserver v0.20.1/go.mod h1:ro5QHeQkgMS7ZGpvf4tSMx6bBOgPfE+f52KwvXfScaU= k8s.io/client-go v0.18.8/go.mod h1:HqFqMllQ5NnQJNwjro9k5zMyfhZlOwpuTLVrxjkYSxU= k8s.io/client-go v0.20.1/go.mod h1:/zcHdt1TeWSd5HoUe6elJmHSQ6uLLgp4bIJHVEuy+/Y= @@ -2074,10 +2080,12 @@ k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= -k8s.io/klog/v2 v2.4.0 h1:7+X0fUguPyrKEC4WjH8iGDg3laWgMo5tMnRTIGTTxGQ= k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y= +k8s.io/klog/v2 v2.8.0 h1:Q3gmuM9hKEjefWFFYF0Mat+YyFJvsUyYuwyNNJ5C9Ts= +k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E= k8s.io/kube-openapi v0.0.0-20201113171705-d219536bb9fd/go.mod h1:WOJ3KddDSol4tAGcJo0Tvi+dK12EcqSLqcWsryKMpfM= +k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7/go.mod h1:wXW5VT87nVfh/iLV8FpR2uDvrFyomxbtb1KivDbvPTE= k8s.io/kubernetes v1.13.0/go.mod h1:ocZa8+6APFNC2tX1DZASIbocyYT5jHzqFVsY5aoB7Jk= k8s.io/utils v0.0.0-20200324210504-a9aa75ae1b89/go.mod h1:sZAwmy6armz5eXlNoLmJcl4F1QuKu7sr+mFQ0byX7Ew= k8s.io/utils v0.0.0-20200414100711-2df71ebbae66/go.mod h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA= @@ -2119,8 +2127,9 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.14/go.mod h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg= sigs.k8s.io/structured-merge-diff/v3 v3.0.0-20200116222232-67a7b8c61874/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= sigs.k8s.io/structured-merge-diff/v3 v3.0.0/go.mod h1:PlARxl6Hbt/+BC80dRLi1qAmnMqwqDg62YvvVkZjemw= -sigs.k8s.io/structured-merge-diff/v4 v4.0.2 h1:YHQV7Dajm86OuqnIR6zAelnDWBRjo+YhYV9PmGrh1s8= sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.1.0 h1:C4r9BgJ98vrKnnVCjwCSXcWjWe0NKcUQkmzDXZXGwH8= +sigs.k8s.io/structured-merge-diff/v4 v4.1.0/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= From 90f3e3062aaa71b98652ccc655672155b9f6ea98 Mon Sep 17 00:00:00 2001 From: Brian Lamar Date: Thu, 24 Jun 2021 16:43:23 -0400 Subject: [PATCH 15/85] Don't stop parsing after statsd parsing error (#9423) (cherry picked from commit c6c3efdb9716ced6174b0d08cbd161d1b56d5794) --- plugins/inputs/statsd/statsd.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/plugins/inputs/statsd/statsd.go b/plugins/inputs/statsd/statsd.go index 1aded7f9f1894..4416a19f4624e 100644 --- a/plugins/inputs/statsd/statsd.go +++ b/plugins/inputs/statsd/statsd.go @@ -3,7 +3,6 @@ package statsd import ( "bufio" "bytes" - "errors" "fmt" "net" "sort" @@ -18,6 +17,7 @@ import ( "github.com/influxdata/telegraf/plugins/inputs" "github.com/influxdata/telegraf/plugins/parsers/graphite" "github.com/influxdata/telegraf/selfstat" + "github.com/pkg/errors" ) const ( @@ -35,6 +35,8 @@ const ( parserGoRoutines = 5 ) +var errParsing = errors.New("error parsing statsd line") + // Statsd allows the importing of statsd and dogstatsd data. type Statsd struct { // Protocol used on listener - udp or tcp @@ -568,6 +570,10 @@ func (s *Statsd) parser() error { } default: if err := s.parseStatsdLine(line); err != nil { + if errors.Cause(err) == errParsing { + // parsing errors log when the error occurs + continue + } return err } } @@ -605,7 +611,7 @@ func (s *Statsd) parseStatsdLine(line string) error { bits := strings.Split(line, ":") if len(bits) < 2 { s.Log.Errorf("Splitting ':', unable to parse metric: %s", line) - return errors.New("error Parsing statsd line") + return errParsing } // Extract bucket name from individual metric bits @@ -621,7 +627,7 @@ func (s *Statsd) parseStatsdLine(line string) error { pipesplit := strings.Split(bit, "|") if len(pipesplit) < 2 { s.Log.Errorf("Splitting '|', unable to parse metric: %s", line) - return errors.New("error parsing statsd line") + return errParsing } else if len(pipesplit) > 2 { sr := pipesplit[2] @@ -645,14 +651,14 @@ func (s *Statsd) parseStatsdLine(line string) error { m.mtype = pipesplit[1] default: s.Log.Errorf("Metric type %q unsupported", pipesplit[1]) - return errors.New("error parsing statsd line") + return errParsing } // Parse the value if strings.HasPrefix(pipesplit[0], "-") || strings.HasPrefix(pipesplit[0], "+") { if m.mtype != "g" && m.mtype != "c" { s.Log.Errorf("+- values are only supported for gauges & counters, unable to parse metric: %s", line) - return errors.New("error parsing statsd line") + return errParsing } m.additive = true } @@ -662,7 +668,7 @@ func (s *Statsd) parseStatsdLine(line string) error { v, err := strconv.ParseFloat(pipesplit[0], 64) if err != nil { s.Log.Errorf("Parsing value to float64, unable to parse metric: %s", line) - return errors.New("error parsing statsd line") + return errParsing } m.floatvalue = v case "c": @@ -672,7 +678,7 @@ func (s *Statsd) parseStatsdLine(line string) error { v2, err2 := strconv.ParseFloat(pipesplit[0], 64) if err2 != nil { s.Log.Errorf("Parsing value to int64, unable to parse metric: %s", line) - return errors.New("error parsing statsd line") + return errParsing } v = int64(v2) } From 5067d3c28e9cca55df2386a2dfcb79e3e612cb9c Mon Sep 17 00:00:00 2001 From: Sven Rebhan <36194019+srebhan@users.noreply.github.com> Date: Thu, 24 Jun 2021 22:50:24 +0200 Subject: [PATCH 16/85] Exclude read-timeout from being an error (#9429) (cherry picked from commit e4bd01e0c706fedca7e2584322d3e458569f40a4) --- plugins/inputs/dovecot/dovecot.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/dovecot/dovecot.go b/plugins/inputs/dovecot/dovecot.go index ab5067534dea0..fbc3b79058187 100644 --- a/plugins/inputs/dovecot/dovecot.go +++ b/plugins/inputs/dovecot/dovecot.go @@ -93,7 +93,7 @@ func (d *Dovecot) gatherServer(addr string, acc telegraf.Accumulator, qtype stri c, err := net.DialTimeout(proto, addr, defaultTimeout) if err != nil { - return fmt.Errorf("enable to connect to dovecot server '%s': %s", addr, err) + return fmt.Errorf("unable to connect to dovecot server '%s': %s", addr, err) } defer c.Close() @@ -113,7 +113,12 @@ func (d *Dovecot) gatherServer(addr string, acc telegraf.Accumulator, qtype stri } var buf bytes.Buffer if _, err := io.Copy(&buf, c); err != nil { - return fmt.Errorf("copying message failed for dovecot server '%s': %s", addr, err) + // We need to accept the timeout here as reading from the connection will only terminate on EOF + // or on a timeout to happen. As EOF for TCP connections will only be sent on connection closing, + // the only way to get the whole message is to wait for the timeout to happen. + if nerr, ok := err.(net.Error); !ok || !nerr.Timeout() { + return fmt.Errorf("copying message failed for dovecot server '%s': %s", addr, err) + } } var host string From 68299a46f9af824d4b77180ba777b77cf9fae505 Mon Sep 17 00:00:00 2001 From: Mya Date: Mon, 28 Jun 2021 12:50:37 -0600 Subject: [PATCH 17/85] nat-server upgrade to v2.2.6 (#9369) (cherry picked from commit eba6191239626f50e7876a3b9c2432751589aeb1) --- docs/LICENSE_OF_DEPENDENCIES.md | 1 + go.mod | 5 ++-- go.sum | 47 +++++++++++++-------------------- 3 files changed, 21 insertions(+), 32 deletions(-) diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index 5911ba37a6899..aa8d9b857a72b 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -148,6 +148,7 @@ following works: - github.com/mdlayher/netlink [MIT License](https://github.com/mdlayher/netlink/blob/master/LICENSE.md) - github.com/microsoft/ApplicationInsights-Go [MIT License](https://github.com/microsoft/ApplicationInsights-Go/blob/master/LICENSE) - github.com/miekg/dns [BSD 3-Clause Clear License](https://github.com/miekg/dns/blob/master/LICENSE) +- github.com/minio/highwayhash [Apache License 2.0](https://github.com/minio/highwayhash/blob/master/LICENSE) - github.com/mitchellh/go-homedir [MIT License](https://github.com/mitchellh/go-homedir/blob/master/LICENSE) - github.com/mitchellh/mapstructure [MIT License](https://github.com/mitchellh/mapstructure/blob/master/LICENSE) - github.com/moby/ipvs [Apache License 2.0](https://github.com/moby/ipvs/blob/master/LICENSE) diff --git a/go.mod b/go.mod index 9214094f46e36..5b38e53921781 100644 --- a/go.mod +++ b/go.mod @@ -94,9 +94,8 @@ require ( github.com/moby/ipvs v1.0.1 github.com/multiplay/go-ts3 v1.0.0 github.com/naoina/go-stringutil v0.1.0 // indirect - github.com/nats-io/jwt v1.2.2 // indirect - github.com/nats-io/nats-server/v2 v2.1.4 - github.com/nats-io/nats.go v1.10.0 + github.com/nats-io/nats-server/v2 v2.2.6 + github.com/nats-io/nats.go v1.11.0 github.com/newrelic/newrelic-telemetry-sdk-go v0.5.1 github.com/nsqio/go-nsq v1.0.8 github.com/openconfig/gnmi v0.0.0-20180912164834-33a1865c3029 diff --git a/go.sum b/go.sum index 5455c207d39d6..6142e4f95e498 100644 --- a/go.sum +++ b/go.sum @@ -257,8 +257,6 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/bshuster-repo/logrus-logstash-hook v0.4.1/go.mod h1:zsTqEiSzDgAa/8GZR7E1qaXrhYNDKBYy5/dWPTIflbk= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= @@ -266,6 +264,8 @@ github.com/buger/jsonparser v0.0.0-20180808090653-f4dd9f5a6b44/go.mod h1:bbYlZJ7 github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= +github.com/bugsnag/bugsnag-go v0.0.0-20141110184014-b1d153021fcd/go.mod h1:2oa8nejYd4cQ/b0hMIopN0lCRxU0bueqREvZLWFrtK8= +github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= github.com/bugsnag/osext v0.0.0-20130617224835-0dd3f918b21b/go.mod h1:obH5gd0BsqsP2LwDJ9aOkm/6J86V6lyAXCoQWGw3K50= @@ -975,8 +975,9 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.11.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.3 h1:dB4Bn0tN3wdCzQxnS8r06kV74qN/TAfaIS0bVE8h3jc= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.12 h1:famVnQVu7QwryBN4jNseQdUKES71ZAOnB6UQQJPZvqk= +github.com/klauspost/compress v1.11.12/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= @@ -1062,6 +1063,8 @@ github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7 github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721 h1:RlZweED6sbSArvlE924+mUcZuXKLBHA35U7LN621Bws= github.com/mikioh/ipaddr v0.0.0-20190404000644-d465c8ab6721/go.mod h1:Ickgr2WtCLZ2MDGd4Gr0geeCH5HybhRJbonOgQpvSxc= +github.com/minio/highwayhash v1.0.1 h1:dZ6IIu8Z14VlC0VpfKofAhCy74wu/Qb5gcn52yWoz/0= +github.com/minio/highwayhash v1.0.1/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= @@ -1079,10 +1082,6 @@ github.com/mitchellh/mapstructure v1.2.2 h1:dxe5oCinTXiTIcfgmZecdCzPmAJKd46KsCWc github.com/mitchellh/mapstructure v1.2.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A= github.com/moby/ipvs v1.0.1 h1:aoZ7fhLTXgDbzVrAnvV+XbKOU8kOET7B3+xULDF/1o0= -github.com/moby/ipvs v1.0.1 h1:aoZ7fhLTXgDbzVrAnvV+XbKOU8kOET7B3+xULDF/1o0= -github.com/moby/ipvs v1.0.1 h1:aoZ7fhLTXgDbzVrAnvV+XbKOU8kOET7B3+xULDF/1o0= -github.com/moby/ipvs v1.0.1/go.mod h1:2pngiyseZbIKXNv7hsKj3O9UEz30c53MT9005gt2hxQ= -github.com/moby/ipvs v1.0.1/go.mod h1:2pngiyseZbIKXNv7hsKj3O9UEz30c53MT9005gt2hxQ= github.com/moby/ipvs v1.0.1/go.mod h1:2pngiyseZbIKXNv7hsKj3O9UEz30c53MT9005gt2hxQ= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= github.com/moby/sys/mount v0.2.0 h1:WhCW5B355jtxndN5ovugJlMFJawbUODuW8fSnEH6SSM= @@ -1124,17 +1123,20 @@ github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5Vgl github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/jwt v1.2.2 h1:w3GMTO969dFg+UOKTmmyuu7IGdusK+7Ytlt//OYH/uU= github.com/nats-io/jwt v1.2.2/go.mod h1:/xX356yQA6LuXI9xWW7mZNpxgF2mBmGecH+Fj34sP5Q= +github.com/nats-io/jwt/v2 v2.0.2 h1:ejVCLO8gu6/4bOKIHQpmB5UhhUJfAQw55yvLWpfmKjI= +github.com/nats-io/jwt/v2 v2.0.2/go.mod h1:VRP+deawSXyhNjXmxPCHskrR6Mq50BqpEI5SEcNiGlY= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= -github.com/nats-io/nats-server/v2 v2.1.4 h1:BILRnsJ2Yb/fefiFbBWADpViGF69uh4sxe8poVDQ06g= -github.com/nats-io/nats-server/v2 v2.1.4/go.mod h1:Jw1Z28soD/QasIA2uWjXyM9El1jly3YwyFOuR8tH1rg= +github.com/nats-io/nats-server/v2 v2.2.6 h1:FPK9wWx9pagxcw14s8W9rlfzfyHm61uNLnJyybZbn48= +github.com/nats-io/nats-server/v2 v2.2.6/go.mod h1:sEnFaxqe09cDmfMgACxZbziXnhQFhwk+aKkZjBBRYrI= github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= -github.com/nats-io/nats.go v1.10.0 h1:L8qnKaofSfNFbXg0C5F71LdjPRnmQwSsA4ukmkt1TvY= -github.com/nats-io/nats.go v1.10.0/go.mod h1:AjGArbfyR50+afOUotNX2Xs5SYHf+CoOa5HH1eEl2HE= +github.com/nats-io/nats.go v1.11.0 h1:L263PZkrmkRJRJT2YHU8GwWWvEvmr9/LUKuJTXsF32k= +github.com/nats-io/nats.go v1.11.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= -github.com/nats-io/nkeys v0.1.4/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= -github.com/nats-io/nkeys v0.2.0 h1:WXKF7diOaPU9cJdLD7nuzwasQy9vT1tBqzXZZf3AMJM= github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.2.0/go.mod h1:XdZpAbhgyyODYqjTawOnIOI7VlbKSarI9Gfy1tqEu/s= +github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= +github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= github.com/ncw/swift v1.0.47/go.mod h1:23YIA4yWVnGwv2dQlN4bB7egfYX6YLn0Yo/S6zZO/ZM= @@ -1363,13 +1365,6 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= @@ -1391,8 +1386,6 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU github.com/spf13/cobra v0.0.2-0.20171109065643-2da4a54c5cee/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1-0.20171106142849-4c012f6dcd95/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= @@ -1458,10 +1451,6 @@ github.com/vaughan0/go-ini v0.0.0-20130923145212-a98ad7ee00ec/go.mod h1:owBmyHYM github.com/vektah/gqlparser v1.1.2/go.mod h1:1ycwN7Ij5njmMkPPAOaRFY4rET2Enx7IkVv3vaXspKw= github.com/vishvananda/netlink v0.0.0-20181108222139-023a6dafdcdf/go.mod h1:+SR5DhBJrl6ZM7CoCKvpw5BKroDKQ+PJqOg65H/2ktk= github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0= -github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0= -github.com/vishvananda/netlink v1.1.0 h1:1iyaYNBLmP6L0220aDnYQpo1QEV4t4hJ+xEEhhJH8j0= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= -github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= github.com/vishvananda/netns v0.0.0-20180720170159-13995c7128cc/go.mod h1:ZjcWmFBXmLKZu9Nxj3WKYEafiSqer2rnvPr0en9UNpI= github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df h1:OviZH7qLw/7ZovXvuNyL3XQl8UFofeikI1NW1Gypu7k= @@ -1565,6 +1554,7 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1686,6 +1676,7 @@ golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190209173611-3b5209105503/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1766,8 +1757,6 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201202213521-69691e467435/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1795,6 +1784,7 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e h1:EHBhcS0mlXEAVwNyO2dLfjToGsyY4j24pTs2ScHnX7s= golang.org/x/time v0.0.0-20200630173020-3af7569d3a1e/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1952,7 +1942,6 @@ google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKa google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.30.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM8pak= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.37.0 h1:uSZWeQJX5j11bIQ4AJoj+McDBo29cY1MCoC1wO3ts+c= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= From b0d54e0163a81c3e2b24c8f256e13ebec3b8b153 Mon Sep 17 00:00:00 2001 From: Sven Rebhan <36194019+srebhan@users.noreply.github.com> Date: Tue, 29 Jun 2021 23:01:46 +0200 Subject: [PATCH 18/85] Fix RabbitMQ regression in #9383 (#9443) (cherry picked from commit e2ab2188db035617150885ffc860393ea59703e8) --- plugins/inputs/rabbitmq/README.md | 6 + plugins/inputs/rabbitmq/rabbitmq.go | 198 +++-- plugins/inputs/rabbitmq/rabbitmq_test.go | 768 ++++++++++++++---- .../testdata/{ => set1}/exchanges.json | 0 .../testdata/{ => set1}/federation-links.json | 0 .../rabbitmq/testdata/{ => set1}/memory.json | 0 .../rabbitmq/testdata/{ => set1}/nodes.json | 0 .../testdata/{ => set1}/overview.json | 0 .../rabbitmq/testdata/{ => set1}/queues.json | 0 .../rabbitmq/testdata/set2/exchanges.json | 104 +++ .../testdata/set2/federation-links.json | 1 + .../inputs/rabbitmq/testdata/set2/memory.json | 31 + .../inputs/rabbitmq/testdata/set2/nodes.json | 417 ++++++++++ .../rabbitmq/testdata/set2/overview.json | 1 + .../inputs/rabbitmq/testdata/set2/queues.json | 356 ++++++++ 15 files changed, 1675 insertions(+), 207 deletions(-) rename plugins/inputs/rabbitmq/testdata/{ => set1}/exchanges.json (100%) rename plugins/inputs/rabbitmq/testdata/{ => set1}/federation-links.json (100%) rename plugins/inputs/rabbitmq/testdata/{ => set1}/memory.json (100%) rename plugins/inputs/rabbitmq/testdata/{ => set1}/nodes.json (100%) rename plugins/inputs/rabbitmq/testdata/{ => set1}/overview.json (100%) rename plugins/inputs/rabbitmq/testdata/{ => set1}/queues.json (100%) create mode 100644 plugins/inputs/rabbitmq/testdata/set2/exchanges.json create mode 100644 plugins/inputs/rabbitmq/testdata/set2/federation-links.json create mode 100644 plugins/inputs/rabbitmq/testdata/set2/memory.json create mode 100644 plugins/inputs/rabbitmq/testdata/set2/nodes.json create mode 100644 plugins/inputs/rabbitmq/testdata/set2/overview.json create mode 100644 plugins/inputs/rabbitmq/testdata/set2/queues.json diff --git a/plugins/inputs/rabbitmq/README.md b/plugins/inputs/rabbitmq/README.md index 1274b4ee230f8..5f106642adeb6 100644 --- a/plugins/inputs/rabbitmq/README.md +++ b/plugins/inputs/rabbitmq/README.md @@ -48,6 +48,12 @@ For additional details reference the [RabbitMQ Management HTTP Stats][management ## specified, metrics for all exchanges are gathered. # exchanges = ["telegraf"] + ## Metrics to include and exclude. Globs accepted. + ## Note that an empty array for both will include all metrics + ## Currently the following metrics are supported: "exchange", "federation", "node", "overview", "queue" + # metric_include = [] + # metric_exclude = [] + ## Queues to include and exclude. Globs accepted. ## Note that an empty array for both will include all queues # queue_name_include = [] diff --git a/plugins/inputs/rabbitmq/rabbitmq.go b/plugins/inputs/rabbitmq/rabbitmq.go index fd39bd090dbc5..13be5f63b1619 100644 --- a/plugins/inputs/rabbitmq/rabbitmq.go +++ b/plugins/inputs/rabbitmq/rabbitmq.go @@ -3,6 +3,7 @@ package rabbitmq import ( "encoding/json" "fmt" + "io/ioutil" "net/http" "strconv" "sync" @@ -47,15 +48,18 @@ type RabbitMQ struct { Queues []string `toml:"queues"` Exchanges []string `toml:"exchanges"` + MetricInclude []string `toml:"metric_include"` + MetricExclude []string `toml:"metric_exclude"` QueueInclude []string `toml:"queue_name_include"` QueueExclude []string `toml:"queue_name_exclude"` FederationUpstreamInclude []string `toml:"federation_upstream_include"` FederationUpstreamExclude []string `toml:"federation_upstream_exclude"` - Client *http.Client `toml:"-"` + Log telegraf.Logger `toml:"-"` - filterCreated bool + client *http.Client excludeEveryQueue bool + metricFilter filter.Filter queueFilter filter.Filter upstreamFilter filter.Filter } @@ -163,11 +167,11 @@ type Node struct { GcNumDetails Details `json:"gc_num_details"` GcBytesReclaimed int64 `json:"gc_bytes_reclaimed"` GcBytesReclaimedDetails Details `json:"gc_bytes_reclaimed_details"` - IoReadAvgTime int64 `json:"io_read_avg_time"` + IoReadAvgTime float64 `json:"io_read_avg_time"` IoReadAvgTimeDetails Details `json:"io_read_avg_time_details"` IoReadBytes int64 `json:"io_read_bytes"` IoReadBytesDetails Details `json:"io_read_bytes_details"` - IoWriteAvgTime int64 `json:"io_write_avg_time"` + IoWriteAvgTime float64 `json:"io_write_avg_time"` IoWriteAvgTimeDetails Details `json:"io_write_avg_time_details"` IoWriteBytes int64 `json:"io_write_bytes"` IoWriteBytesDetails Details `json:"io_write_bytes_details"` @@ -226,32 +230,44 @@ type MemoryResponse struct { // Memory details type Memory struct { - ConnectionReaders int64 `json:"connection_readers"` - ConnectionWriters int64 `json:"connection_writers"` - ConnectionChannels int64 `json:"connection_channels"` - ConnectionOther int64 `json:"connection_other"` - QueueProcs int64 `json:"queue_procs"` - QueueSlaveProcs int64 `json:"queue_slave_procs"` - Plugins int64 `json:"plugins"` - OtherProc int64 `json:"other_proc"` - Metrics int64 `json:"metrics"` - MgmtDb int64 `json:"mgmt_db"` - Mnesia int64 `json:"mnesia"` - OtherEts int64 `json:"other_ets"` - Binary int64 `json:"binary"` - MsgIndex int64 `json:"msg_index"` - Code int64 `json:"code"` - Atom int64 `json:"atom"` - OtherSystem int64 `json:"other_system"` - AllocatedUnused int64 `json:"allocated_unused"` - ReservedUnallocated int64 `json:"reserved_unallocated"` - Total int64 `json:"total"` + ConnectionReaders int64 `json:"connection_readers"` + ConnectionWriters int64 `json:"connection_writers"` + ConnectionChannels int64 `json:"connection_channels"` + ConnectionOther int64 `json:"connection_other"` + QueueProcs int64 `json:"queue_procs"` + QueueSlaveProcs int64 `json:"queue_slave_procs"` + Plugins int64 `json:"plugins"` + OtherProc int64 `json:"other_proc"` + Metrics int64 `json:"metrics"` + MgmtDb int64 `json:"mgmt_db"` + Mnesia int64 `json:"mnesia"` + OtherEts int64 `json:"other_ets"` + Binary int64 `json:"binary"` + MsgIndex int64 `json:"msg_index"` + Code int64 `json:"code"` + Atom int64 `json:"atom"` + OtherSystem int64 `json:"other_system"` + AllocatedUnused int64 `json:"allocated_unused"` + ReservedUnallocated int64 `json:"reserved_unallocated"` + Total interface{} `json:"total"` +} + +// Error response +type ErrorResponse struct { + Error string `json:"error"` + Reason string `json:"reason"` } // gatherFunc ... type gatherFunc func(r *RabbitMQ, acc telegraf.Accumulator) -var gatherFunctions = []gatherFunc{gatherOverview, gatherNodes, gatherQueues, gatherExchanges, gatherFederationLinks} +var gatherFunctions = map[string]gatherFunc{ + "exchange": gatherExchanges, + "federation": gatherFederationLinks, + "node": gatherNodes, + "overview": gatherOverview, + "queue": gatherQueues, +} var sampleConfig = ` ## Management Plugin url. (default: http://localhost:15672) @@ -291,6 +307,12 @@ var sampleConfig = ` ## specified, metrics for all exchanges are gathered. # exchanges = ["telegraf"] + ## Metrics to include and exclude. Globs accepted. + ## Note that an empty array for both will include all metrics + ## Currently the following metrics are supported: "exchange", "federation", "node", "overview", "queue" + # metric_include = [] + # metric_exclude = [] + ## Queues to include and exclude. Globs accepted. ## Note that an empty array for both will include all queues queue_name_include = [] @@ -323,39 +345,47 @@ func (r *RabbitMQ) Description() string { return "Reads metrics from RabbitMQ servers via the Management Plugin" } -// Gather ... -func (r *RabbitMQ) Gather(acc telegraf.Accumulator) error { - if r.Client == nil { - tlsCfg, err := r.ClientConfig.TLSConfig() - if err != nil { - return err - } - tr := &http.Transport{ - ResponseHeaderTimeout: time.Duration(r.ResponseHeaderTimeout), - TLSClientConfig: tlsCfg, - } - r.Client = &http.Client{ - Transport: tr, - Timeout: time.Duration(r.ClientTimeout), - } +func (r *RabbitMQ) Init() error { + var err error + + // Create gather filters + if err := r.createQueueFilter(); err != nil { + return err + } + if err := r.createUpstreamFilter(); err != nil { + return err } - // Create gather filters if not already created - if !r.filterCreated { - err := r.createQueueFilter() - if err != nil { - return err - } - err = r.createUpstreamFilter() - if err != nil { - return err - } - r.filterCreated = true + // Create a filter for the metrics + if r.metricFilter, err = filter.NewIncludeExcludeFilter(r.MetricInclude, r.MetricExclude); err != nil { + return err } + tlsCfg, err := r.ClientConfig.TLSConfig() + if err != nil { + return err + } + tr := &http.Transport{ + ResponseHeaderTimeout: time.Duration(r.ResponseHeaderTimeout), + TLSClientConfig: tlsCfg, + } + r.client = &http.Client{ + Transport: tr, + Timeout: time.Duration(r.ClientTimeout), + } + + return nil +} + +// Gather ... +func (r *RabbitMQ) Gather(acc telegraf.Accumulator) error { var wg sync.WaitGroup - wg.Add(len(gatherFunctions)) - for _, f := range gatherFunctions { + for name, f := range gatherFunctions { + // Query only metrics that are supported + if !r.metricFilter.Match(name) { + continue + } + wg.Add(1) go func(gf gatherFunc) { defer wg.Done() gf(r, acc) @@ -366,15 +396,16 @@ func (r *RabbitMQ) Gather(acc telegraf.Accumulator) error { return nil } -func (r *RabbitMQ) requestJSON(u string, target interface{}) error { +func (r *RabbitMQ) requestEndpoint(u string) ([]byte, error) { if r.URL == "" { r.URL = DefaultURL } - u = fmt.Sprintf("%s%s", r.URL, u) + endpoint := r.URL + u + r.Log.Debugf("Requesting %q...", endpoint) - req, err := http.NewRequest("GET", u, nil) + req, err := http.NewRequest("GET", endpoint, nil) if err != nil { - return err + return nil, err } username := r.Username @@ -389,14 +420,39 @@ func (r *RabbitMQ) requestJSON(u string, target interface{}) error { req.SetBasicAuth(username, password) - resp, err := r.Client.Do(req) + resp, err := r.client.Do(req) + if err != nil { + return nil, err + } + defer resp.Body.Close() + + r.Log.Debugf("HTTP status code: %v %v", resp.StatusCode, http.StatusText(resp.StatusCode)) + if resp.StatusCode < 200 || resp.StatusCode > 299 { + return nil, fmt.Errorf("getting %q failed: %v %v", u, resp.StatusCode, http.StatusText(resp.StatusCode)) + } + + return ioutil.ReadAll(resp.Body) +} + +func (r *RabbitMQ) requestJSON(u string, target interface{}) error { + buf, err := r.requestEndpoint(u) if err != nil { return err } + if err := json.Unmarshal(buf, target); err != nil { + if _, ok := err.(*json.UnmarshalTypeError); ok { + // Try to get the error reason from the response + var errResponse ErrorResponse + if json.Unmarshal(buf, &errResponse) == nil && errResponse.Error != "" { + // Return the error reason in the response + return fmt.Errorf("error response trying to get %q: %q (reason: %q)", u, errResponse.Error, errResponse.Reason) + } + } - defer resp.Body.Close() + return fmt.Errorf("decoding answer from %q failed: %v", u, err) + } - return json.NewDecoder(resp.Body).Decode(target) + return nil } func gatherOverview(r *RabbitMQ, acc telegraf.Accumulator) { @@ -533,7 +589,27 @@ func gatherNodes(r *RabbitMQ, acc telegraf.Accumulator) { fields["mem_other_system"] = memory.Memory.OtherSystem fields["mem_allocated_unused"] = memory.Memory.AllocatedUnused fields["mem_reserved_unallocated"] = memory.Memory.ReservedUnallocated - fields["mem_total"] = memory.Memory.Total + switch v := memory.Memory.Total.(type) { + case float64: + fields["mem_total"] = int64(v) + case map[string]interface{}: + var foundEstimator bool + for _, estimator := range []string{"rss", "allocated", "erlang"} { + if x, found := v[estimator]; found { + if total, ok := x.(float64); ok { + fields["mem_total"] = int64(total) + foundEstimator = true + break + } + acc.AddError(fmt.Errorf("unknown type %T for %q total memory", x, estimator)) + } + } + if !foundEstimator { + acc.AddError(fmt.Errorf("no known memory estimation in %v", v)) + } + default: + acc.AddError(fmt.Errorf("unknown type %T for total memory", memory.Memory.Total)) + } } acc.AddFields("rabbitmq_node", fields, tags) diff --git a/plugins/inputs/rabbitmq/rabbitmq_test.go b/plugins/inputs/rabbitmq/rabbitmq_test.go index b65585b8f0a57..830819b0528e4 100644 --- a/plugins/inputs/rabbitmq/rabbitmq_test.go +++ b/plugins/inputs/rabbitmq/rabbitmq_test.go @@ -1,36 +1,40 @@ package rabbitmq import ( + "fmt" + "io/ioutil" "net/http" "net/http/httptest" - "testing" + "time" - "io/ioutil" + "testing" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/testutil" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) -func TestRabbitMQGeneratesMetrics(t *testing.T) { +func TestRabbitMQGeneratesMetricsSet1(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { var jsonFilePath string switch r.URL.Path { case "/api/overview": - jsonFilePath = "testdata/overview.json" + jsonFilePath = "testdata/set1/overview.json" case "/api/nodes": - jsonFilePath = "testdata/nodes.json" + jsonFilePath = "testdata/set1/nodes.json" case "/api/queues": - jsonFilePath = "testdata/queues.json" + jsonFilePath = "testdata/set1/queues.json" case "/api/exchanges": - jsonFilePath = "testdata/exchanges.json" + jsonFilePath = "testdata/set1/exchanges.json" case "/api/federation-links": - jsonFilePath = "testdata/federation-links.json" + jsonFilePath = "testdata/set1/federation-links.json" case "/api/nodes/rabbit@vagrant-ubuntu-trusty-64/memory": - jsonFilePath = "testdata/memory.json" + jsonFilePath = "testdata/set1/memory.json" default: - require.Fail(t, "Cannot handle request") + http.Error(w, fmt.Sprintf("unknown path %q", r.URL.Path), http.StatusNotFound) + return } data, err := ioutil.ReadFile(jsonFilePath) @@ -41,155 +45,627 @@ func TestRabbitMQGeneratesMetrics(t *testing.T) { })) defer ts.Close() - r := &RabbitMQ{ + // Define test cases + expected := []telegraf.Metric{ + testutil.MustMetric("rabbitmq_overview", + map[string]string{ + "url": ts.URL, + }, + map[string]interface{}{ + "messages": int64(5), + "messages_ready": int64(32), + "messages_unacked": int64(27), + "messages_acked": int64(5246), + "messages_delivered": int64(5234), + "messages_delivered_get": int64(3333), + "messages_published": int64(5258), + "channels": int64(44), + "connections": int64(44), + "consumers": int64(65), + "exchanges": int64(43), + "queues": int64(62), + "clustering_listeners": int64(2), + "amqp_listeners": int64(2), + "return_unroutable": int64(10), + "return_unroutable_rate": float64(3.3), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_queue", + map[string]string{ + "auto_delete": "false", + "durable": "false", + "node": "rabbit@rmqlocal-0.rmqlocal.ankorabbitstatefulset3.svc.cluster.local", + "queue": "reply_a716f0523cd44941ad2ea6ce4a3869c3", + "url": ts.URL, + "vhost": "sorandomsorandom", + }, + map[string]interface{}{ + "consumers": int64(3), + "consumer_utilisation": float64(1.0), + "memory": int64(143776), + "message_bytes": int64(3), + "message_bytes_ready": int64(4), + "message_bytes_unacked": int64(5), + "message_bytes_ram": int64(6), + "message_bytes_persist": int64(7), + "messages": int64(44), + "messages_ready": int64(32), + "messages_unack": int64(44), + "messages_ack": int64(3457), + "messages_ack_rate": float64(9.9), + "messages_deliver": int64(22222), + "messages_deliver_rate": float64(333.4), + "messages_deliver_get": int64(3457), + "messages_deliver_get_rate": float64(0.2), + "messages_publish": int64(3457), + "messages_publish_rate": float64(11.2), + "messages_redeliver": int64(33), + "messages_redeliver_rate": float64(2.5), + "idle_since": "2015-11-01 8:22:14", + "slave_nodes": int64(1), + "synchronised_slave_nodes": int64(1), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_node", + map[string]string{ + "node": "rabbit@vagrant-ubuntu-trusty-64", + "url": ts.URL, + }, + map[string]interface{}{ + "disk_free": int64(3776), + "disk_free_limit": int64(50000000), + "disk_free_alarm": int64(0), + "fd_total": int64(1024), + "fd_used": int64(63), + "mem_limit": int64(2503), + "mem_used": int64(159707080), + "mem_alarm": int64(1), + "proc_total": int64(1048576), + "proc_used": int64(783), + "run_queue": int64(0), + "sockets_total": int64(829), + "sockets_used": int64(45), + "uptime": int64(7464827), + "running": int64(1), + "mnesia_disk_tx_count": int64(16), + "mnesia_ram_tx_count": int64(296), + "mnesia_disk_tx_count_rate": float64(1.1), + "mnesia_ram_tx_count_rate": float64(2.2), + "gc_num": int64(57280132), + "gc_bytes_reclaimed": int64(2533), + "gc_num_rate": float64(274.2), + "gc_bytes_reclaimed_rate": float64(16490856.3), + "io_read_avg_time": float64(983.0), + "io_read_avg_time_rate": float64(88.77), + "io_read_bytes": int64(1111), + "io_read_bytes_rate": float64(99.99), + "io_write_avg_time": float64(134.0), + "io_write_avg_time_rate": float64(4.32), + "io_write_bytes": int64(823), + "io_write_bytes_rate": float64(32.8), + "mem_connection_readers": int64(1234), + "mem_connection_writers": int64(5678), + "mem_connection_channels": int64(1133), + "mem_connection_other": int64(2840), + "mem_queue_procs": int64(2840), + "mem_queue_slave_procs": int64(0), + "mem_plugins": int64(1755976), + "mem_other_proc": int64(23056584), + "mem_metrics": int64(196536), + "mem_mgmt_db": int64(491272), + "mem_mnesia": int64(115600), + "mem_other_ets": int64(2121872), + "mem_binary": int64(418848), + "mem_msg_index": int64(42848), + "mem_code": int64(25179322), + "mem_atom": int64(1041593), + "mem_other_system": int64(14741981), + "mem_allocated_unused": int64(38208528), + "mem_reserved_unallocated": int64(0), + "mem_total": int64(83025920), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "true", + "durable": "false", + "exchange": "reply_a716f0523cd44941ad2ea6ce4a3869c3", + "internal": "false", + "type": "direct", + "url": ts.URL, + "vhost": "sorandomsorandom", + }, + map[string]interface{}{ + "messages_publish_in": int64(3678), + "messages_publish_in_rate": float64(3.2), + "messages_publish_out": int64(3677), + "messages_publish_out_rate": float64(5.1), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_federation", + map[string]string{ + "queue": "exampleLocalQueue", + "type": "queue", + "upstream": "ExampleFederationUpstream", + "upstream_queue": "exampleUpstreamQueue", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "acks_uncommitted": int64(1), + "consumers": int64(2), + "messages_unacknowledged": int64(3), + "messages_uncommitted": int64(4), + "messages_unconfirmed": int64(5), + "messages_confirm": int64(67), + "messages_publish": int64(890), + "messages_return_unroutable": int64(1), + }, + time.Unix(0, 0), + ), + } + + // Run the test + plugin := &RabbitMQ{ URL: ts.URL, + Log: testutil.Logger{}, } + require.NoError(t, plugin.Init()) acc := &testutil.Accumulator{} + require.NoError(t, plugin.Gather(acc)) - err := acc.GatherError(r.Gather) - require.NoError(t, err) - - overviewMetrics := map[string]interface{}{ - "messages": 5, - "messages_ready": 32, - "messages_unacked": 27, - "messages_acked": 5246, - "messages_delivered": 5234, - "messages_delivered_get": 3333, - "messages_published": 5258, - "channels": 44, - "connections": 44, - "consumers": 65, - "exchanges": 43, - "queues": 62, - "clustering_listeners": 2, - "amqp_listeners": 2, - "return_unroutable": 10, - "return_unroutable_rate": 3.3, - } - compareMetrics(t, overviewMetrics, acc, "rabbitmq_overview") - - queuesMetrics := map[string]interface{}{ - "consumers": 3, - "consumer_utilisation": 1.0, - "memory": 143776, - "message_bytes": 3, - "message_bytes_ready": 4, - "message_bytes_unacked": 5, - "message_bytes_ram": 6, - "message_bytes_persist": 7, - "messages": 44, - "messages_ready": 32, - "messages_unack": 44, - "messages_ack": 3457, - "messages_ack_rate": 9.9, - "messages_deliver": 22222, - "messages_deliver_rate": 333.4, - "messages_deliver_get": 3457, - "messages_deliver_get_rate": 0.2, - "messages_publish": 3457, - "messages_publish_rate": 11.2, - "messages_redeliver": 33, - "messages_redeliver_rate": 2.5, - "idle_since": "2015-11-01 8:22:14", - "slave_nodes": 1, - "synchronised_slave_nodes": 1, + acc.Wait(len(expected)) + require.Len(t, acc.Errors, 0) + + testutil.RequireMetricsEqual(t, expected, acc.GetTelegrafMetrics(), testutil.IgnoreTime(), testutil.SortMetrics()) +} + +func TestRabbitMQGeneratesMetricsSet2(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + var jsonFilePath string + + switch r.URL.Path { + case "/api/overview": + jsonFilePath = "testdata/set2/overview.json" + case "/api/nodes": + jsonFilePath = "testdata/set2/nodes.json" + case "/api/queues": + jsonFilePath = "testdata/set2/queues.json" + case "/api/exchanges": + jsonFilePath = "testdata/set2/exchanges.json" + case "/api/federation-links": + jsonFilePath = "testdata/set2/federation-links.json" + case "/api/nodes/rabbit@rmqserver/memory": + jsonFilePath = "testdata/set2/memory.json" + default: + http.Error(w, fmt.Sprintf("unknown path %q", r.URL.Path), http.StatusNotFound) + return + } + + data, err := ioutil.ReadFile(jsonFilePath) + require.NoErrorf(t, err, "could not read from data file %s", jsonFilePath) + + _, err = w.Write(data) + require.NoError(t, err) + })) + defer ts.Close() + + // Define test cases + expected := []telegraf.Metric{ + testutil.MustMetric("rabbitmq_overview", + map[string]string{ + "url": ts.URL, + }, + map[string]interface{}{ + "messages": int64(30), + "messages_ready": int64(30), + "messages_unacked": int64(0), + "messages_acked": int64(3736443), + "messages_delivered": int64(3736446), + "messages_delivered_get": int64(3736446), + "messages_published": int64(770025), + "channels": int64(43), + "connections": int64(43), + "consumers": int64(37), + "exchanges": int64(8), + "queues": int64(34), + "clustering_listeners": int64(1), + "amqp_listeners": int64(2), + "return_unroutable": int64(0), + "return_unroutable_rate": float64(0.0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_queue", + map[string]string{ + "auto_delete": "false", + "durable": "false", + "node": "rabbit@rmqserver", + "queue": "39fd2caf-63e5-41e3-c15a-ba8fa11434b2", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "consumers": int64(1), + "consumer_utilisation": float64(1.0), + "memory": int64(15840), + "message_bytes": int64(0), + "message_bytes_ready": int64(0), + "message_bytes_unacked": int64(0), + "message_bytes_ram": int64(0), + "message_bytes_persist": int64(0), + "messages": int64(0), + "messages_ready": int64(0), + "messages_unack": int64(0), + "messages_ack": int64(180), + "messages_ack_rate": float64(0.0), + "messages_deliver": int64(180), + "messages_deliver_rate": float64(0.0), + "messages_deliver_get": int64(180), + "messages_deliver_get_rate": float64(0.0), + "messages_publish": int64(180), + "messages_publish_rate": float64(0.0), + "messages_redeliver": int64(0), + "messages_redeliver_rate": float64(0.0), + "idle_since": "2021-06-28 15:54:14", + "slave_nodes": int64(0), + "synchronised_slave_nodes": int64(0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_queue", + map[string]string{ + "auto_delete": "false", + "durable": "false", + "node": "rabbit@rmqserver", + "queue": "39fd2cb4-aa2d-c08b-457a-62d0893523a1", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "consumers": int64(1), + "consumer_utilisation": float64(1.0), + "memory": int64(15600), + "message_bytes": int64(0), + "message_bytes_ready": int64(0), + "message_bytes_unacked": int64(0), + "message_bytes_ram": int64(0), + "message_bytes_persist": int64(0), + "messages": int64(0), + "messages_ready": int64(0), + "messages_unack": int64(0), + "messages_ack": int64(177), + "messages_ack_rate": float64(0.0), + "messages_deliver": int64(177), + "messages_deliver_rate": float64(0.0), + "messages_deliver_get": int64(177), + "messages_deliver_get_rate": float64(0.0), + "messages_publish": int64(177), + "messages_publish_rate": float64(0.0), + "messages_redeliver": int64(0), + "messages_redeliver_rate": float64(0.0), + "idle_since": "2021-06-28 15:54:14", + "slave_nodes": int64(0), + "synchronised_slave_nodes": int64(0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_queue", + map[string]string{ + "auto_delete": "false", + "durable": "false", + "node": "rabbit@rmqserver", + "queue": "39fd2cb5-3820-e01b-6e20-ba29d5553fc3", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "consumers": int64(1), + "consumer_utilisation": float64(1.0), + "memory": int64(15584), + "message_bytes": int64(0), + "message_bytes_ready": int64(0), + "message_bytes_unacked": int64(0), + "message_bytes_ram": int64(0), + "message_bytes_persist": int64(0), + "messages": int64(0), + "messages_ready": int64(0), + "messages_unack": int64(0), + "messages_ack": int64(175), + "messages_ack_rate": float64(0.0), + "messages_deliver": int64(175), + "messages_deliver_rate": float64(0.0), + "messages_deliver_get": int64(175), + "messages_deliver_get_rate": float64(0.0), + "messages_publish": int64(175), + "messages_publish_rate": float64(0.0), + "messages_redeliver": int64(0), + "messages_redeliver_rate": float64(0.0), + "idle_since": "2021-06-28 15:54:15", + "slave_nodes": int64(0), + "synchronised_slave_nodes": int64(0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_node", + map[string]string{ + "node": "rabbit@rmqserver", + "url": ts.URL, + }, + map[string]interface{}{ + "disk_free": int64(25086496768), + "disk_free_limit": int64(50000000), + "disk_free_alarm": int64(0), + "fd_total": int64(65536), + "fd_used": int64(78), + "mem_limit": int64(1717546188), + "mem_used": int64(387645440), + "mem_alarm": int64(0), + "proc_total": int64(1048576), + "proc_used": int64(1128), + "run_queue": int64(1), + "sockets_total": int64(58893), + "sockets_used": int64(43), + "uptime": int64(4150152129), + "running": int64(1), + "mnesia_disk_tx_count": int64(103), + "mnesia_ram_tx_count": int64(2257), + "mnesia_disk_tx_count_rate": float64(0.0), + "mnesia_ram_tx_count_rate": float64(0.0), + "gc_num": int64(329526389), + "gc_bytes_reclaimed": int64(13660012170840), + "gc_num_rate": float64(125.2), + "gc_bytes_reclaimed_rate": float64(6583379.2), + "io_read_avg_time": float64(0.0), + "io_read_avg_time_rate": float64(0.0), + "io_read_bytes": int64(1), + "io_read_bytes_rate": float64(0.0), + "io_write_avg_time": float64(0.0), + "io_write_avg_time_rate": float64(0.0), + "io_write_bytes": int64(193066), + "io_write_bytes_rate": float64(0.0), + "mem_connection_readers": int64(1246768), + "mem_connection_writers": int64(72108), + "mem_connection_channels": int64(308588), + "mem_connection_other": int64(4883596), + "mem_queue_procs": int64(780996), + "mem_queue_slave_procs": int64(0), + "mem_plugins": int64(11932828), + "mem_other_proc": int64(39203520), + "mem_metrics": int64(626932), + "mem_mgmt_db": int64(3341264), + "mem_mnesia": int64(396016), + "mem_other_ets": int64(3771384), + "mem_binary": int64(209324208), + "mem_msg_index": int64(32648), + "mem_code": int64(32810827), + "mem_atom": int64(1458513), + "mem_other_system": int64(14284124), + "mem_allocated_unused": int64(61026048), + "mem_reserved_unallocated": int64(0), + "mem_total": int64(385548288), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "false", + "durable": "true", + "exchange": "", + "internal": "false", + "type": "direct", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "messages_publish_in": int64(284725), + "messages_publish_in_rate": float64(0.0), + "messages_publish_out": int64(284572), + "messages_publish_out_rate": float64(0.0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "false", + "durable": "true", + "exchange": "amq.direct", + "internal": "false", + "type": "direct", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "messages_publish_in": int64(0), + "messages_publish_in_rate": float64(0.0), + "messages_publish_out": int64(0), + "messages_publish_out_rate": float64(0.0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "false", + "durable": "true", + "exchange": "amq.fanout", + "internal": "false", + "type": "fanout", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "messages_publish_in": int64(0), + "messages_publish_in_rate": float64(0.0), + "messages_publish_out": int64(0), + "messages_publish_out_rate": float64(0.0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "false", + "durable": "true", + "exchange": "amq.headers", + "internal": "false", + "type": "headers", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "messages_publish_in": int64(0), + "messages_publish_in_rate": float64(0.0), + "messages_publish_out": int64(0), + "messages_publish_out_rate": float64(0.0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "false", + "durable": "true", + "exchange": "amq.match", + "internal": "false", + "type": "headers", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "messages_publish_in": int64(0), + "messages_publish_in_rate": float64(0.0), + "messages_publish_out": int64(0), + "messages_publish_out_rate": float64(0.0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "false", + "durable": "true", + "exchange": "amq.rabbitmq.trace", + "internal": "true", + "type": "topic", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "messages_publish_in": int64(0), + "messages_publish_in_rate": float64(0.0), + "messages_publish_out": int64(0), + "messages_publish_out_rate": float64(0.0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "false", + "durable": "true", + "exchange": "amq.topic", + "internal": "false", + "type": "topic", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "messages_publish_in": int64(0), + "messages_publish_in_rate": float64(0.0), + "messages_publish_out": int64(0), + "messages_publish_out_rate": float64(0.0), + }, + time.Unix(0, 0), + ), + testutil.MustMetric("rabbitmq_exchange", + map[string]string{ + "auto_delete": "true", + "durable": "false", + "exchange": "Exchange", + "internal": "false", + "type": "topic", + "url": ts.URL, + "vhost": "/", + }, + map[string]interface{}{ + "messages_publish_in": int64(18006), + "messages_publish_in_rate": float64(0.0), + "messages_publish_out": int64(60798), + "messages_publish_out_rate": float64(0.0), + }, + time.Unix(0, 0), + ), } - compareMetrics(t, queuesMetrics, acc, "rabbitmq_queue") - - nodeMetrics := map[string]interface{}{ - "disk_free": 3776, - "disk_free_limit": 50000000, - "disk_free_alarm": 0, - "fd_total": 1024, - "fd_used": 63, - "mem_limit": 2503, - "mem_used": 159707080, - "mem_alarm": 1, - "proc_total": 1048576, - "proc_used": 783, - "run_queue": 0, - "sockets_total": 829, - "sockets_used": 45, - "uptime": 7464827, - "running": 1, - "mnesia_disk_tx_count": 16, - "mnesia_ram_tx_count": 296, - "mnesia_disk_tx_count_rate": 1.1, - "mnesia_ram_tx_count_rate": 2.2, - "gc_num": 57280132, - "gc_bytes_reclaimed": 2533, - "gc_num_rate": 274.2, - "gc_bytes_reclaimed_rate": 16490856.3, - "io_read_avg_time": 983, - "io_read_avg_time_rate": 88.77, - "io_read_bytes": 1111, - "io_read_bytes_rate": 99.99, - "io_write_avg_time": 134, - "io_write_avg_time_rate": 4.32, - "io_write_bytes": 823, - "io_write_bytes_rate": 32.8, - "mem_connection_readers": 1234, - "mem_connection_writers": 5678, - "mem_connection_channels": 1133, - "mem_connection_other": 2840, - "mem_queue_procs": 2840, - "mem_queue_slave_procs": 0, - "mem_plugins": 1755976, - "mem_other_proc": 23056584, - "mem_metrics": 196536, - "mem_mgmt_db": 491272, - "mem_mnesia": 115600, - "mem_other_ets": 2121872, - "mem_binary": 418848, - "mem_msg_index": 42848, - "mem_code": 25179322, - "mem_atom": 1041593, - "mem_other_system": 14741981, - "mem_allocated_unused": 38208528, - "mem_reserved_unallocated": 0, - "mem_total": 83025920, + expectedErrors := []error{ + fmt.Errorf("error response trying to get \"/api/federation-links\": \"Object Not Found\" (reason: \"Not Found\")"), } - compareMetrics(t, nodeMetrics, acc, "rabbitmq_node") - exchangeMetrics := map[string]interface{}{ - "messages_publish_in": 3678, - "messages_publish_in_rate": 3.2, - "messages_publish_out": 3677, - "messages_publish_out_rate": 5.1, - } - compareMetrics(t, exchangeMetrics, acc, "rabbitmq_exchange") - - federationLinkMetrics := map[string]interface{}{ - "acks_uncommitted": 1, - "consumers": 2, - "messages_unacknowledged": 3, - "messages_uncommitted": 4, - "messages_unconfirmed": 5, - "messages_confirm": 67, - "messages_publish": 890, - "messages_return_unroutable": 1, + // Run the test + plugin := &RabbitMQ{ + URL: ts.URL, + Log: testutil.Logger{}, } - compareMetrics(t, federationLinkMetrics, acc, "rabbitmq_federation") + require.NoError(t, plugin.Init()) + + acc := &testutil.Accumulator{} + require.NoError(t, plugin.Gather(acc)) + + acc.Wait(len(expected)) + require.Len(t, acc.Errors, len(expectedErrors)) + require.ElementsMatch(t, expectedErrors, acc.Errors) + + testutil.RequireMetricsEqual(t, expected, acc.GetTelegrafMetrics(), testutil.IgnoreTime(), testutil.SortMetrics()) } -func compareMetrics(t *testing.T, expectedMetrics map[string]interface{}, - accumulator *testutil.Accumulator, measurementKey string) { - measurement, exist := accumulator.Get(measurementKey) +func TestRabbitMQMetricFilerts(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + http.Error(w, fmt.Sprintf("unknown path %q", r.URL.Path), http.StatusNotFound) + })) + defer ts.Close() - assert.True(t, exist, "There is measurement %s", measurementKey) - assert.Equal(t, len(expectedMetrics), len(measurement.Fields)) + metricErrors := map[string]error{ + "exchange": fmt.Errorf("getting \"/api/exchanges\" failed: 404 Not Found"), + "federation": fmt.Errorf("getting \"/api/federation-links\" failed: 404 Not Found"), + "node": fmt.Errorf("getting \"/api/nodes\" failed: 404 Not Found"), + "overview": fmt.Errorf("getting \"/api/overview\" failed: 404 Not Found"), + "queue": fmt.Errorf("getting \"/api/queues\" failed: 404 Not Found"), + } - for metricName, metricValue := range expectedMetrics { - actualMetricValue := measurement.Fields[metricName] + // Include test + for name, expected := range metricErrors { + plugin := &RabbitMQ{ + URL: ts.URL, + Log: testutil.Logger{}, + MetricInclude: []string{name}, + } + require.NoError(t, plugin.Init()) + + acc := &testutil.Accumulator{} + require.NoError(t, plugin.Gather(acc)) + require.Len(t, acc.Errors, 1) + require.ElementsMatch(t, []error{expected}, acc.Errors) + } - if accumulator.HasStringField(measurementKey, metricName) { - assert.Equal(t, metricValue, actualMetricValue, - "Metric name: %s", metricName) - } else { - assert.InDelta(t, metricValue, actualMetricValue, 0e5, - "Metric name: %s", metricName) + // Exclude test + for name := range metricErrors { + // Exclude the current metric error from the list of expected errors + var expected []error + for n, e := range metricErrors { + if n != name { + expected = append(expected, e) + } } + plugin := &RabbitMQ{ + URL: ts.URL, + Log: testutil.Logger{}, + MetricExclude: []string{name}, + } + require.NoError(t, plugin.Init()) + + acc := &testutil.Accumulator{} + require.NoError(t, plugin.Gather(acc)) + require.Len(t, acc.Errors, len(expected)) + require.ElementsMatch(t, expected, acc.Errors) } } diff --git a/plugins/inputs/rabbitmq/testdata/exchanges.json b/plugins/inputs/rabbitmq/testdata/set1/exchanges.json similarity index 100% rename from plugins/inputs/rabbitmq/testdata/exchanges.json rename to plugins/inputs/rabbitmq/testdata/set1/exchanges.json diff --git a/plugins/inputs/rabbitmq/testdata/federation-links.json b/plugins/inputs/rabbitmq/testdata/set1/federation-links.json similarity index 100% rename from plugins/inputs/rabbitmq/testdata/federation-links.json rename to plugins/inputs/rabbitmq/testdata/set1/federation-links.json diff --git a/plugins/inputs/rabbitmq/testdata/memory.json b/plugins/inputs/rabbitmq/testdata/set1/memory.json similarity index 100% rename from plugins/inputs/rabbitmq/testdata/memory.json rename to plugins/inputs/rabbitmq/testdata/set1/memory.json diff --git a/plugins/inputs/rabbitmq/testdata/nodes.json b/plugins/inputs/rabbitmq/testdata/set1/nodes.json similarity index 100% rename from plugins/inputs/rabbitmq/testdata/nodes.json rename to plugins/inputs/rabbitmq/testdata/set1/nodes.json diff --git a/plugins/inputs/rabbitmq/testdata/overview.json b/plugins/inputs/rabbitmq/testdata/set1/overview.json similarity index 100% rename from plugins/inputs/rabbitmq/testdata/overview.json rename to plugins/inputs/rabbitmq/testdata/set1/overview.json diff --git a/plugins/inputs/rabbitmq/testdata/queues.json b/plugins/inputs/rabbitmq/testdata/set1/queues.json similarity index 100% rename from plugins/inputs/rabbitmq/testdata/queues.json rename to plugins/inputs/rabbitmq/testdata/set1/queues.json diff --git a/plugins/inputs/rabbitmq/testdata/set2/exchanges.json b/plugins/inputs/rabbitmq/testdata/set2/exchanges.json new file mode 100644 index 0000000000000..df47fe44bbd7f --- /dev/null +++ b/plugins/inputs/rabbitmq/testdata/set2/exchanges.json @@ -0,0 +1,104 @@ +[ + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "internal": false, + "message_stats": { + "publish_in": 284725, + "publish_in_details": { + "rate": 0 + }, + "publish_out": 284572, + "publish_out_details": { + "rate": 0 + } + }, + "name": "", + "type": "direct", + "user_who_performed_action": "rmq-internal", + "vhost": "/" + }, + { + "arguments": { + "x-expires": 300000 + }, + "auto_delete": true, + "durable": false, + "internal": false, + "message_stats": { + "publish_in": 18006, + "publish_in_details": { + "rate": 0 + }, + "publish_out": 60798, + "publish_out_details": { + "rate": 0 + } + }, + "name": "Exchange", + "type": "topic", + "user_who_performed_action": "user", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "internal": false, + "name": "amq.direct", + "type": "direct", + "user_who_performed_action": "rmq-internal", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "internal": false, + "name": "amq.fanout", + "type": "fanout", + "user_who_performed_action": "rmq-internal", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "internal": false, + "name": "amq.headers", + "type": "headers", + "user_who_performed_action": "rmq-internal", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "internal": false, + "name": "amq.match", + "type": "headers", + "user_who_performed_action": "rmq-internal", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "internal": true, + "name": "amq.rabbitmq.trace", + "type": "topic", + "user_who_performed_action": "rmq-internal", + "vhost": "/" + }, + { + "arguments": {}, + "auto_delete": false, + "durable": true, + "internal": false, + "name": "amq.topic", + "type": "topic", + "user_who_performed_action": "rmq-internal", + "vhost": "/" + } +] diff --git a/plugins/inputs/rabbitmq/testdata/set2/federation-links.json b/plugins/inputs/rabbitmq/testdata/set2/federation-links.json new file mode 100644 index 0000000000000..0d121cb2f3e64 --- /dev/null +++ b/plugins/inputs/rabbitmq/testdata/set2/federation-links.json @@ -0,0 +1 @@ +{"error":"Object Not Found","reason":"Not Found"} diff --git a/plugins/inputs/rabbitmq/testdata/set2/memory.json b/plugins/inputs/rabbitmq/testdata/set2/memory.json new file mode 100644 index 0000000000000..d18558ae21e5a --- /dev/null +++ b/plugins/inputs/rabbitmq/testdata/set2/memory.json @@ -0,0 +1,31 @@ +{ + "memory": { + "connection_readers": 1246768, + "connection_writers": 72108, + "connection_channels": 308588, + "connection_other": 4883596, + "queue_procs": 780996, + "queue_slave_procs": 0, + "quorum_queue_procs": 0, + "plugins": 11932828, + "other_proc": 39203520, + "metrics": 626932, + "mgmt_db": 3341264, + "mnesia": 396016, + "quorum_ets": 47920, + "other_ets": 3771384, + "binary": 209324208, + "msg_index": 32648, + "code": 32810827, + "atom": 1458513, + "other_system": 14284124, + "allocated_unused": 61026048, + "reserved_unallocated": 0, + "strategy": "rss", + "total": { + "erlang": 324522240, + "rss": 385548288, + "allocated": 385548288 + } + } +} diff --git a/plugins/inputs/rabbitmq/testdata/set2/nodes.json b/plugins/inputs/rabbitmq/testdata/set2/nodes.json new file mode 100644 index 0000000000000..6dcfb0d514efd --- /dev/null +++ b/plugins/inputs/rabbitmq/testdata/set2/nodes.json @@ -0,0 +1,417 @@ +[ + { + "partitions": [], + "os_pid": "8268", + "fd_total": 65536, + "sockets_total": 58893, + "mem_limit": 1717546188, + "mem_alarm": false, + "disk_free_limit": 50000000, + "disk_free_alarm": false, + "proc_total": 1048576, + "rates_mode": "basic", + "uptime": 4150152129, + "run_queue": 1, + "processors": 4, + "exchange_types": [ + { + "name": "topic", + "description": "AMQP topic exchange, as per the AMQP specification", + "enabled": true + }, + { + "name": "fanout", + "description": "AMQP fanout exchange, as per the AMQP specification", + "enabled": true + }, + { + "name": "direct", + "description": "AMQP direct exchange, as per the AMQP specification", + "enabled": true + }, + { + "name": "headers", + "description": "AMQP headers exchange, as per the AMQP specification", + "enabled": true + } + ], + "auth_mechanisms": [ + { + "name": "PLAIN", + "description": "SASL PLAIN authentication mechanism", + "enabled": true + }, + { + "name": "AMQPLAIN", + "description": "QPid AMQPLAIN mechanism", + "enabled": true + }, + { + "name": "RABBIT-CR-DEMO", + "description": "RabbitMQ Demo challenge-response authentication mechanism", + "enabled": false + } + ], + "applications": [ + { + "name": "amqp_client", + "description": "RabbitMQ AMQP Client", + "version": "3.8.14" + }, + { + "name": "asn1", + "description": "The Erlang ASN1 compiler version 5.0.14", + "version": "5.0.14" + }, + { + "name": "aten", + "description": "Erlang node failure detector", + "version": "0.5.5" + }, + { + "name": "compiler", + "description": "ERTS CXC 138 10", + "version": "7.6.6" + }, + { + "name": "cowboy", + "description": "Small, fast, modern HTTP server.", + "version": "2.8.0" + }, + { + "name": "cowlib", + "description": "Support library for manipulating Web protocols.", + "version": "2.9.1" + }, + { + "name": "credentials_obfuscation", + "description": "Helper library that obfuscates sensitive values in process state", + "version": "2.4.0" + }, + { + "name": "crypto", + "description": "CRYPTO", + "version": "4.8.3" + }, + { + "name": "cuttlefish", + "description": "cuttlefish configuration abstraction", + "version": "2.6.0" + }, + { + "name": "gen_batch_server", + "description": "Generic batching server", + "version": "0.8.4" + }, + { + "name": "goldrush", + "description": "Erlang event stream processor", + "version": "0.1.9" + }, + { + "name": "inets", + "description": "INETS CXC 138 49", + "version": "7.3.2" + }, + { + "name": "jsx", + "description": "a streaming, evented json parsing toolkit", + "version": "2.11.0" + }, + { + "name": "kernel", + "description": "ERTS CXC 138 10", + "version": "7.2.1" + }, + { + "name": "lager", + "description": "Erlang logging framework", + "version": "3.8.2" + }, + { + "name": "mnesia", + "description": "MNESIA CXC 138 12", + "version": "4.18.1" + }, + { + "name": "observer_cli", + "description": "Visualize Erlang Nodes On The Command Line", + "version": "1.6.1" + }, + { + "name": "os_mon", + "description": "CPO CXC 138 46", + "version": "2.6.1" + }, + { + "name": "public_key", + "description": "Public key infrastructure", + "version": "1.9.2" + }, + { + "name": "ra", + "description": "Raft library", + "version": "1.1.8" + }, + { + "name": "rabbit", + "description": "RabbitMQ", + "version": "3.8.14" + }, + { + "name": "rabbit_common", + "description": "Modules shared by rabbitmq-server and rabbitmq-erlang-client", + "version": "3.8.14" + }, + { + "name": "rabbitmq_management", + "description": "RabbitMQ Management Console", + "version": "3.8.14" + }, + { + "name": "rabbitmq_management_agent", + "description": "RabbitMQ Management Agent", + "version": "3.8.14" + }, + { + "name": "rabbitmq_prelaunch", + "description": "RabbitMQ prelaunch setup", + "version": "3.8.14" + }, + { + "name": "rabbitmq_web_dispatch", + "description": "RabbitMQ Web Dispatcher", + "version": "3.8.14" + }, + { + "name": "ranch", + "description": "Socket acceptor pool for TCP protocols.", + "version": "1.7.1" + }, + { + "name": "recon", + "description": "Diagnostic tools for production use", + "version": "2.5.1" + }, + { + "name": "sasl", + "description": "SASL CXC 138 11", + "version": "4.0.1" + }, + { + "name": "ssl", + "description": "Erlang/OTP SSL application", + "version": "10.2.4" + }, + { + "name": "stdlib", + "description": "ERTS CXC 138 10", + "version": "3.14" + }, + { + "name": "stdout_formatter", + "description": "Tools to format paragraphs, lists and tables as plain text", + "version": "0.2.4" + }, + { + "name": "syntax_tools", + "description": "Syntax tools", + "version": "2.4" + }, + { + "name": "sysmon_handler", + "description": "Rate-limiting system_monitor event handler", + "version": "1.3.0" + }, + { + "name": "tools", + "description": "DEVTOOLS CXC 138 16", + "version": "3.4.3" + }, + { + "name": "xmerl", + "description": "XML parser", + "version": "1.3.26" + } + ], + "contexts": [ + { + "description": "RabbitMQ Management", + "path": "/", + "cowboy_opts": "[{sendfile,false}]", + "port": "15672" + } + ], + "log_files": [ + "c:/Users/user/AppData/Roaming/RabbitMQ/log/rabbit@rmqserver.log", + "c:/Users/user/AppData/Roaming/RabbitMQ/log/rabbit@rmqserver_upgrade.log" + ], + "db_dir": "c:/Users/user/AppData/Roaming/RabbitMQ/db/rabbit@rmqserver-mnesia", + "config_files": [ + "c:/Users/user/AppData/Roaming/RabbitMQ/advanced.config" + ], + "net_ticktime": 60, + "enabled_plugins": [ + "rabbitmq_management" + ], + "mem_calculation_strategy": "rss", + "ra_open_file_metrics": { + "ra_log_wal": 1, + "ra_log_segment_writer": 0 + }, + "name": "rabbit@rmqserver", + "type": "disc", + "running": true, + "mem_used": 387645440, + "mem_used_details": { + "rate": 419430.4 + }, + "fd_used": 78, + "fd_used_details": { + "rate": 0 + }, + "sockets_used": 43, + "sockets_used_details": { + "rate": 0 + }, + "proc_used": 1128, + "proc_used_details": { + "rate": 0 + }, + "disk_free": 25086496768, + "disk_free_details": { + "rate": -118784 + }, + "gc_num": 329526389, + "gc_num_details": { + "rate": 125.2 + }, + "gc_bytes_reclaimed": 13660012170840, + "gc_bytes_reclaimed_details": { + "rate": 6583379.2 + }, + "context_switches": 974149754, + "context_switches_details": { + "rate": 270 + }, + "io_read_count": 1, + "io_read_count_details": { + "rate": 0 + }, + "io_read_bytes": 1, + "io_read_bytes_details": { + "rate": 0 + }, + "io_read_avg_time": 0, + "io_read_avg_time_details": { + "rate": 0 + }, + "io_write_count": 45, + "io_write_count_details": { + "rate": 0 + }, + "io_write_bytes": 193066, + "io_write_bytes_details": { + "rate": 0 + }, + "io_write_avg_time": 0, + "io_write_avg_time_details": { + "rate": 0 + }, + "io_sync_count": 45, + "io_sync_count_details": { + "rate": 0 + }, + "io_sync_avg_time": 0, + "io_sync_avg_time_details": { + "rate": 0 + }, + "io_seek_count": 31, + "io_seek_count_details": { + "rate": 0 + }, + "io_seek_avg_time": 0, + "io_seek_avg_time_details": { + "rate": 0 + }, + "io_reopen_count": 0, + "io_reopen_count_details": { + "rate": 0 + }, + "mnesia_ram_tx_count": 2257, + "mnesia_ram_tx_count_details": { + "rate": 0 + }, + "mnesia_disk_tx_count": 103, + "mnesia_disk_tx_count_details": { + "rate": 0 + }, + "msg_store_read_count": 0, + "msg_store_read_count_details": { + "rate": 0 + }, + "msg_store_write_count": 1, + "msg_store_write_count_details": { + "rate": 0 + }, + "queue_index_journal_write_count": 165, + "queue_index_journal_write_count_details": { + "rate": 0 + }, + "queue_index_write_count": 0, + "queue_index_write_count_details": { + "rate": 0 + }, + "queue_index_read_count": 0, + "queue_index_read_count_details": { + "rate": 0 + }, + "io_file_handle_open_attempt_count": 882, + "io_file_handle_open_attempt_count_details": { + "rate": 0 + }, + "io_file_handle_open_attempt_avg_time": 0.05442176870748299, + "io_file_handle_open_attempt_avg_time_details": { + "rate": 0 + }, + "connection_created": 2310, + "connection_created_details": { + "rate": 0 + }, + "connection_closed": 2268, + "connection_closed_details": { + "rate": 0 + }, + "channel_created": 2310, + "channel_created_details": { + "rate": 0 + }, + "channel_closed": 2267, + "channel_closed_details": { + "rate": 0 + }, + "queue_declared": 144281, + "queue_declared_details": { + "rate": 0 + }, + "queue_created": 663, + "queue_created_details": { + "rate": 0 + }, + "queue_deleted": 629, + "queue_deleted_details": { + "rate": 0 + }, + "cluster_links": [], + "metrics_gc_queue_length": { + "connection_closed": 0, + "channel_closed": 0, + "consumer_deleted": 0, + "exchange_deleted": 0, + "queue_deleted": 0, + "vhost_deleted": 0, + "node_node_deleted": 0, + "channel_consumer_deleted": 0 + } + } +] diff --git a/plugins/inputs/rabbitmq/testdata/set2/overview.json b/plugins/inputs/rabbitmq/testdata/set2/overview.json new file mode 100644 index 0000000000000..51977d61cbcae --- /dev/null +++ b/plugins/inputs/rabbitmq/testdata/set2/overview.json @@ -0,0 +1 @@ +{"management_version":"3.8.14","rates_mode":"basic","sample_retention_policies":{"global":[600,3600,28800,86400],"basic":[600,3600],"detailed":[600]},"exchange_types":[{"name":"direct","description":"AMQP direct exchange, as per the AMQP specification","enabled":true},{"name":"fanout","description":"AMQP fanout exchange, as per the AMQP specification","enabled":true},{"name":"headers","description":"AMQP headers exchange, as per the AMQP specification","enabled":true},{"name":"topic","description":"AMQP topic exchange, as per the AMQP specification","enabled":true}],"product_version":"3.8.14","product_name":"RabbitMQ","rabbitmq_version":"3.8.14","cluster_name":"rabbit@rmqserver","erlang_version":"23.2.7","erlang_full_version":"Erlang/OTP 23 [erts-11.1.8] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1]","disable_stats":false,"enable_queue_totals":false,"message_stats":{"ack":3736443,"ack_details":{"rate":0.0},"confirm":0,"confirm_details":{"rate":0.0},"deliver":3736446,"deliver_details":{"rate":0.0},"deliver_get":3736446,"deliver_get_details":{"rate":0.0},"deliver_no_ack":0,"deliver_no_ack_details":{"rate":0.0},"disk_reads":0,"disk_reads_details":{"rate":0.0},"disk_writes":55,"disk_writes_details":{"rate":0.0},"drop_unroutable":0,"drop_unroutable_details":{"rate":0.0},"get":0,"get_details":{"rate":0.0},"get_empty":0,"get_empty_details":{"rate":0.0},"get_no_ack":0,"get_no_ack_details":{"rate":0.0},"publish":770025,"publish_details":{"rate":0.0},"redeliver":1,"redeliver_details":{"rate":0.0},"return_unroutable":0,"return_unroutable_details":{"rate":0.0}},"churn_rates":{"channel_closed":2267,"channel_closed_details":{"rate":0.0},"channel_created":2310,"channel_created_details":{"rate":0.0},"connection_closed":2268,"connection_closed_details":{"rate":0.0},"connection_created":2310,"connection_created_details":{"rate":0.0},"queue_created":663,"queue_created_details":{"rate":0.0},"queue_declared":144281,"queue_declared_details":{"rate":0.0},"queue_deleted":629,"queue_deleted_details":{"rate":0.0}},"queue_totals":{"messages":30,"messages_details":{"rate":0.0},"messages_ready":30,"messages_ready_details":{"rate":0.0},"messages_unacknowledged":0,"messages_unacknowledged_details":{"rate":0.0}},"object_totals":{"channels":43,"connections":43,"consumers":37,"exchanges":8,"queues":34},"statistics_db_event_queue":0,"node":"rabbit@rmqserver","listeners":[{"node":"rabbit@rmqserver","protocol":"amqp","ip_address":"0.0.0.0","port":5672,"socket_opts":{"backlog":128,"nodelay":true,"linger":[true,0],"exit_on_close":false}},{"node":"rabbit@rmqserver","protocol":"amqp","ip_address":"::","port":5672,"socket_opts":{"backlog":128,"nodelay":true,"linger":[true,0],"exit_on_close":false}},{"node":"rabbit@rmqserver","protocol":"amqp/ssl","ip_address":"0.0.0.0","port":5671,"socket_opts":{"backlog":128,"nodelay":true,"linger":[true,0],"exit_on_close":false,"versions":["tlsv1.3","tlsv1.2","tlsv1.1","tlsv1"],"cacertfile":"C:\\ProgramData\\Chain.pem","certfile":"C:\\ProgramData\\server.crt","keyfile":"C:\\ProgramData\\server.key","verify":"verify_peer","depth":3,"fail_if_no_peer_cert":false}},{"node":"rabbit@rmqserver","protocol":"amqp/ssl","ip_address":"::","port":5671,"socket_opts":{"backlog":128,"nodelay":true,"linger":[true,0],"exit_on_close":false,"versions":["tlsv1.3","tlsv1.2","tlsv1.1","tlsv1"],"cacertfile":"C:\\ProgramData\\Chain.pem","certfile":"C:\\ProgramData\\server.crt","keyfile":"C:\\ProgramData\\server.key","verify":"verify_peer","depth":3,"fail_if_no_peer_cert":false}},{"node":"rabbit@rmqserver","protocol":"clustering","ip_address":"::","port":25672,"socket_opts":[]},{"node":"rabbit@rmqserver","protocol":"http","ip_address":"0.0.0.0","port":15672,"socket_opts":{"cowboy_opts":{"sendfile":false},"port":15672}},{"node":"rabbit@rmqserver","protocol":"http","ip_address":"::","port":15672,"socket_opts":{"cowboy_opts":{"sendfile":false},"port":15672}}],"contexts":[{"ssl_opts":[],"node":"rabbit@rmqserver","description":"RabbitMQ Management","path":"/","cowboy_opts":"[{sendfile,false}]","port":"15672"}]} diff --git a/plugins/inputs/rabbitmq/testdata/set2/queues.json b/plugins/inputs/rabbitmq/testdata/set2/queues.json new file mode 100644 index 0000000000000..6d8c2a831158a --- /dev/null +++ b/plugins/inputs/rabbitmq/testdata/set2/queues.json @@ -0,0 +1,356 @@ +[ + { + "arguments": { + "x-expires": 300000 + }, + "auto_delete": false, + "backing_queue_status": { + "avg_ack_egress_rate": 0, + "avg_ack_ingress_rate": 0, + "avg_egress_rate": 0, + "avg_ingress_rate": 0, + "delta": [ + "delta", + "undefined", + 0, + 0, + "undefined" + ], + "len": 0, + "mode": "default", + "next_seq_id": 180, + "q1": 0, + "q2": 0, + "q3": 0, + "q4": 0, + "target_ram_count": "infinity" + }, + "consumer_capacity": 1, + "consumer_utilisation": 1, + "consumers": 1, + "durable": false, + "effective_policy_definition": {}, + "exclusive": false, + "exclusive_consumer_tag": null, + "garbage_collection": { + "fullsweep_after": 65535, + "max_heap_size": 0, + "min_bin_vheap_size": 46422, + "min_heap_size": 233, + "minor_gcs": 16174 + }, + "head_message_timestamp": null, + "idle_since": "2021-06-28 15:54:14", + "memory": 15840, + "message_bytes": 0, + "message_bytes_paged_out": 0, + "message_bytes_persistent": 0, + "message_bytes_ram": 0, + "message_bytes_ready": 0, + "message_bytes_unacknowledged": 0, + "message_stats": { + "ack": 180, + "ack_details": { + "rate": 0 + }, + "deliver": 180, + "deliver_details": { + "rate": 0 + }, + "deliver_get": 180, + "deliver_get_details": { + "rate": 0 + }, + "deliver_no_ack": 0, + "deliver_no_ack_details": { + "rate": 0 + }, + "get": 0, + "get_details": { + "rate": 0 + }, + "get_empty": 0, + "get_empty_details": { + "rate": 0 + }, + "get_no_ack": 0, + "get_no_ack_details": { + "rate": 0 + }, + "publish": 180, + "publish_details": { + "rate": 0 + }, + "redeliver": 0, + "redeliver_details": { + "rate": 0 + } + }, + "messages": 0, + "messages_details": { + "rate": 0 + }, + "messages_paged_out": 0, + "messages_persistent": 0, + "messages_ram": 0, + "messages_ready": 0, + "messages_ready_details": { + "rate": 0 + }, + "messages_ready_ram": 0, + "messages_unacknowledged": 0, + "messages_unacknowledged_details": { + "rate": 0 + }, + "messages_unacknowledged_ram": 0, + "name": "39fd2caf-63e5-41e3-c15a-ba8fa11434b2", + "node": "rabbit@rmqserver", + "operator_policy": null, + "policy": null, + "recoverable_slaves": null, + "reductions": 11766294, + "reductions_details": { + "rate": 0 + }, + "single_active_consumer_tag": null, + "state": "running", + "type": "classic", + "vhost": "/" + }, + { + "arguments": { + "x-expires": 300000 + }, + "auto_delete": false, + "backing_queue_status": { + "avg_ack_egress_rate": 0, + "avg_ack_ingress_rate": 0, + "avg_egress_rate": 0, + "avg_ingress_rate": 0, + "delta": [ + "delta", + "undefined", + 0, + 0, + "undefined" + ], + "len": 0, + "mode": "default", + "next_seq_id": 177, + "q1": 0, + "q2": 0, + "q3": 0, + "q4": 0, + "target_ram_count": "infinity" + }, + "consumer_capacity": 1, + "consumer_utilisation": 1, + "consumers": 1, + "durable": false, + "effective_policy_definition": {}, + "exclusive": false, + "exclusive_consumer_tag": null, + "garbage_collection": { + "fullsweep_after": 65535, + "max_heap_size": 0, + "min_bin_vheap_size": 46422, + "min_heap_size": 233, + "minor_gcs": 16205 + }, + "head_message_timestamp": null, + "idle_since": "2021-06-28 15:54:14", + "memory": 15600, + "message_bytes": 0, + "message_bytes_paged_out": 0, + "message_bytes_persistent": 0, + "message_bytes_ram": 0, + "message_bytes_ready": 0, + "message_bytes_unacknowledged": 0, + "message_stats": { + "ack": 177, + "ack_details": { + "rate": 0 + }, + "deliver": 177, + "deliver_details": { + "rate": 0 + }, + "deliver_get": 177, + "deliver_get_details": { + "rate": 0 + }, + "deliver_no_ack": 0, + "deliver_no_ack_details": { + "rate": 0 + }, + "get": 0, + "get_details": { + "rate": 0 + }, + "get_empty": 0, + "get_empty_details": { + "rate": 0 + }, + "get_no_ack": 0, + "get_no_ack_details": { + "rate": 0 + }, + "publish": 177, + "publish_details": { + "rate": 0 + }, + "redeliver": 0, + "redeliver_details": { + "rate": 0 + } + }, + "messages": 0, + "messages_details": { + "rate": 0 + }, + "messages_paged_out": 0, + "messages_persistent": 0, + "messages_ram": 0, + "messages_ready": 0, + "messages_ready_details": { + "rate": 0 + }, + "messages_ready_ram": 0, + "messages_unacknowledged": 0, + "messages_unacknowledged_details": { + "rate": 0 + }, + "messages_unacknowledged_ram": 0, + "name": "39fd2cb4-aa2d-c08b-457a-62d0893523a1", + "node": "rabbit@rmqserver", + "operator_policy": null, + "policy": null, + "recoverable_slaves": null, + "reductions": 11706656, + "reductions_details": { + "rate": 0 + }, + "single_active_consumer_tag": null, + "state": "running", + "type": "classic", + "vhost": "/" + }, + { + "arguments": { + "x-expires": 300000 + }, + "auto_delete": false, + "backing_queue_status": { + "avg_ack_egress_rate": 0, + "avg_ack_ingress_rate": 0, + "avg_egress_rate": 0, + "avg_ingress_rate": 0, + "delta": [ + "delta", + "undefined", + 0, + 0, + "undefined" + ], + "len": 0, + "mode": "default", + "next_seq_id": 175, + "q1": 0, + "q2": 0, + "q3": 0, + "q4": 0, + "target_ram_count": "infinity" + }, + "consumer_capacity": 1, + "consumer_utilisation": 1, + "consumers": 1, + "durable": false, + "effective_policy_definition": {}, + "exclusive": false, + "exclusive_consumer_tag": null, + "garbage_collection": { + "fullsweep_after": 65535, + "max_heap_size": 0, + "min_bin_vheap_size": 46422, + "min_heap_size": 233, + "minor_gcs": 16183 + }, + "head_message_timestamp": null, + "idle_since": "2021-06-28 15:54:15", + "memory": 15584, + "message_bytes": 0, + "message_bytes_paged_out": 0, + "message_bytes_persistent": 0, + "message_bytes_ram": 0, + "message_bytes_ready": 0, + "message_bytes_unacknowledged": 0, + "message_stats": { + "ack": 175, + "ack_details": { + "rate": 0 + }, + "deliver": 175, + "deliver_details": { + "rate": 0 + }, + "deliver_get": 175, + "deliver_get_details": { + "rate": 0 + }, + "deliver_no_ack": 0, + "deliver_no_ack_details": { + "rate": 0 + }, + "get": 0, + "get_details": { + "rate": 0 + }, + "get_empty": 0, + "get_empty_details": { + "rate": 0 + }, + "get_no_ack": 0, + "get_no_ack_details": { + "rate": 0 + }, + "publish": 175, + "publish_details": { + "rate": 0 + }, + "redeliver": 0, + "redeliver_details": { + "rate": 0 + } + }, + "messages": 0, + "messages_details": { + "rate": 0 + }, + "messages_paged_out": 0, + "messages_persistent": 0, + "messages_ram": 0, + "messages_ready": 0, + "messages_ready_details": { + "rate": 0 + }, + "messages_ready_ram": 0, + "messages_unacknowledged": 0, + "messages_unacknowledged_details": { + "rate": 0 + }, + "messages_unacknowledged_ram": 0, + "name": "39fd2cb5-3820-e01b-6e20-ba29d5553fc3", + "node": "rabbit@rmqserver", + "operator_policy": null, + "policy": null, + "recoverable_slaves": null, + "reductions": 11649471, + "reductions_details": { + "rate": 0 + }, + "single_active_consumer_tag": null, + "state": "running", + "type": "classic", + "vhost": "/" + } +] From 76e6eabd21f17ca7c13d5a28209f1f29b1fce111 Mon Sep 17 00:00:00 2001 From: Mya Date: Tue, 29 Jun 2021 15:07:05 -0600 Subject: [PATCH 19/85] updated gopsutil to use a specific commit (#9446) (cherry picked from commit 1a0e937d8a39fd093a50cea88daee7c88839b6c1) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 5b38e53921781..aece5288d276a 100644 --- a/go.mod +++ b/go.mod @@ -109,7 +109,7 @@ require ( github.com/riemann/riemann-go-client v0.5.0 github.com/safchain/ethtool v0.0.0-20200218184317-f459e2d13664 github.com/sensu/sensu-go/api/core/v2 v2.6.0 - github.com/shirou/gopsutil v3.21.3+incompatible + github.com/shirou/gopsutil v3.21.6-0.20210624221800-cb512c850043+incompatible github.com/shopspring/decimal v0.0.0-20200105231215-408a2507e114 // indirect github.com/signalfx/golib/v3 v3.3.34 github.com/sirupsen/logrus v1.7.0 diff --git a/go.sum b/go.sum index 6142e4f95e498..8802a978a1ff2 100644 --- a/go.sum +++ b/go.sum @@ -1339,8 +1339,8 @@ github.com/sensu/sensu-go/api/core/v2 v2.6.0 h1:hEKPHFZZNDuWTlKr7Kgm2yog65ZdkBUq github.com/sensu/sensu-go/api/core/v2 v2.6.0/go.mod h1:97IK4ZQuvVjWvvoLkp+NgrD6ot30WDRz3LEbFUc/N34= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v2.18.10+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= -github.com/shirou/gopsutil v3.21.3+incompatible h1:uenXGGa8ESCQq+dbgtl916dmg6PSAz2cXov0uORQ9v8= -github.com/shirou/gopsutil v3.21.3+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil v3.21.6-0.20210624221800-cb512c850043+incompatible h1:Rucj22V2P6ktUBqN5auqjyxRHLXqNX6CteXBXifRrgY= +github.com/shirou/gopsutil v3.21.6-0.20210624221800-cb512c850043+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4= github.com/shopspring/decimal v0.0.0-20200105231215-408a2507e114 h1:Pm6R878vxWWWR+Sa3ppsLce/Zq+JNTs6aVvRu13jv9A= From c0365e69b784ff217fceb89668e8a069c95b64d8 Mon Sep 17 00:00:00 2001 From: Gabi Davar Date: Thu, 1 Jul 2021 17:59:44 +0300 Subject: [PATCH 20/85] add OpenTelemetry entry (#9464) (cherry picked from commit 138c204388819c47c031511012ced2b9624c5e8f) --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b579cdd811cf8..5180d0d822817 100644 --- a/README.md +++ b/README.md @@ -291,6 +291,7 @@ For documentation on the latest development code see the [documentation index][d * [openldap](./plugins/inputs/openldap) * [openntpd](./plugins/inputs/openntpd) * [opensmtpd](./plugins/inputs/opensmtpd) +* [opentelemetry](./plugins/inputs/opentelemetry) * [openweathermap](./plugins/inputs/openweathermap) * [pf](./plugins/inputs/pf) * [pgbouncer](./plugins/inputs/pgbouncer) From 6056217dcfaa5459a17be726fe105a7130e630c1 Mon Sep 17 00:00:00 2001 From: Niek Bruins Date: Thu, 1 Jul 2021 22:42:48 +0200 Subject: [PATCH 21/85] Fix nil pointer error in knx_listener (#9444) (cherry picked from commit 9b22161d922940af03be95d7b16ff51490d3320b) --- plugins/inputs/knx_listener/knx_listener.go | 8 +- .../inputs/knx_listener/knx_listener_test.go | 91 +++++++++++++++---- 2 files changed, 78 insertions(+), 21 deletions(-) diff --git a/plugins/inputs/knx_listener/knx_listener.go b/plugins/inputs/knx_listener/knx_listener.go index 3bb93fbb2dde3..98f19e922f7ad 100644 --- a/plugins/inputs/knx_listener/knx_listener.go +++ b/plugins/inputs/knx_listener/knx_listener.go @@ -148,9 +148,11 @@ func (kl *KNXListener) listen() { // Match GA to DataPointType and measurement name ga := msg.Destination.String() target, ok := kl.gaTargetMap[ga] - if !ok && !kl.gaLogbook[ga] { - kl.Log.Infof("Ignoring message %+v for unknown GA %q", msg, ga) - kl.gaLogbook[ga] = true + if !ok { + if !kl.gaLogbook[ga] { + kl.Log.Infof("Ignoring message %+v for unknown GA %q", msg, ga) + kl.gaLogbook[ga] = true + } continue } diff --git a/plugins/inputs/knx_listener/knx_listener_test.go b/plugins/inputs/knx_listener/knx_listener_test.go index 973605886e3b6..b0502fbbc8e95 100644 --- a/plugins/inputs/knx_listener/knx_listener_test.go +++ b/plugins/inputs/knx_listener/knx_listener_test.go @@ -38,13 +38,31 @@ func setValue(data dpt.DatapointValue, value interface{}) error { return nil } +type TestMessage struct { + address string + dpt string + value interface{} +} + +func ProduceKnxEvent(t *testing.T, address string, datapoint string, value interface{}) *knx.GroupEvent { + addr, err := cemi.NewGroupAddrString(address) + require.NoError(t, err) + + data, ok := dpt.Produce(datapoint) + require.True(t, ok) + err = setValue(data, value) + require.NoError(t, err) + + return &knx.GroupEvent{ + Command: knx.GroupWrite, + Destination: addr, + Data: data.Pack(), + } +} + func TestRegularReceives_DPT(t *testing.T) { // Define the test-cases - var testcases = []struct { - address string - dpt string - value interface{} - }{ + var testcases = []TestMessage{ {"1/0/1", "1.001", true}, {"1/0/2", "1.002", false}, {"1/0/3", "1.003", true}, @@ -95,19 +113,8 @@ func TestRegularReceives_DPT(t *testing.T) { // Send the defined test data for _, testcase := range testcases { - addr, err := cemi.NewGroupAddrString(testcase.address) - require.NoError(t, err) - - data, ok := dpt.Produce(testcase.dpt) - require.True(t, ok) - err = setValue(data, testcase.value) - require.NoError(t, err) - - client.Send(knx.GroupEvent{ - Command: knx.GroupWrite, - Destination: addr, - Data: data.Pack(), - }) + event := ProduceKnxEvent(t, testcase.address, testcase.dpt, testcase.value) + client.Send(*event) } // Give the accumulator some time to collect the data @@ -133,3 +140,51 @@ func TestRegularReceives_DPT(t *testing.T) { assert.True(t, !tstart.After(m.Time)) } } + +func TestRegularReceives_MultipleMessages(t *testing.T) { + listener := KNXListener{ + ServiceType: "dummy", + Measurements: []Measurement{ + {"temperature", "1.001", []string{"1/1/1"}}, + }, + Log: testutil.Logger{Name: "knx_listener"}, + } + + acc := &testutil.Accumulator{} + + // Setup the listener to test + err := listener.Start(acc) + require.NoError(t, err) + client := listener.client.(*KNXDummyInterface) + + testMessages := []TestMessage{ + {"1/1/1", "1.001", true}, + {"1/1/1", "1.001", false}, + {"1/1/2", "1.001", false}, + {"1/1/2", "1.001", true}, + } + + for _, testcase := range testMessages { + event := ProduceKnxEvent(t, testcase.address, testcase.dpt, testcase.value) + client.Send(*event) + } + + // Give the accumulator some time to collect the data + acc.Wait(2) + + // Stop the listener + listener.Stop() + + // Check if we got what we expected + require.Len(t, acc.Metrics, 2) + + assert.Equal(t, "temperature", acc.Metrics[0].Measurement) + assert.Equal(t, "1/1/1", acc.Metrics[0].Tags["groupaddress"]) + assert.Len(t, acc.Metrics[0].Fields, 1) + assert.Equal(t, true, acc.Metrics[0].Fields["value"]) + + assert.Equal(t, "temperature", acc.Metrics[1].Measurement) + assert.Equal(t, "1/1/1", acc.Metrics[1].Tags["groupaddress"]) + assert.Len(t, acc.Metrics[1].Fields, 1) + assert.Equal(t, false, acc.Metrics[1].Fields["value"]) +} From bf1d1917d9bb2ea40514ba69c86831bb6991dd03 Mon Sep 17 00:00:00 2001 From: Alexander Krantz Date: Thu, 1 Jul 2021 13:50:35 -0700 Subject: [PATCH 22/85] Fix Couchbase regression (#9448) (cherry picked from commit e0ac5078bba56e5d451039f95914c94fa8d1ab9d) --- plugins/inputs/couchbase/couchbase.go | 436 +++++++++++---------- plugins/inputs/couchbase/couchbase_test.go | 71 ++-- 2 files changed, 267 insertions(+), 240 deletions(-) diff --git a/plugins/inputs/couchbase/couchbase.go b/plugins/inputs/couchbase/couchbase.go index e89393ee82316..b62a7e970305d 100644 --- a/plugins/inputs/couchbase/couchbase.go +++ b/plugins/inputs/couchbase/couchbase.go @@ -128,220 +128,220 @@ func (cb *Couchbase) gatherDetailedBucketStats(server, bucket string, fields map // Use length of any set of metrics, they will all be the same length. lastEntry := len(extendedBucketStats.Op.Samples.CouchTotalDiskSize) - 1 - cb.addBucketField(fields, "couch_total_disk_size", extendedBucketStats.Op.Samples.CouchTotalDiskSize[lastEntry]) - cb.addBucketField(fields, "couch_docs_fragmentation", extendedBucketStats.Op.Samples.CouchDocsFragmentation[lastEntry]) - cb.addBucketField(fields, "couch_views_fragmentation", extendedBucketStats.Op.Samples.CouchViewsFragmentation[lastEntry]) - cb.addBucketField(fields, "hit_ratio", extendedBucketStats.Op.Samples.HitRatio[lastEntry]) - cb.addBucketField(fields, "ep_cache_miss_rate", extendedBucketStats.Op.Samples.EpCacheMissRate[lastEntry]) - cb.addBucketField(fields, "ep_resident_items_rate", extendedBucketStats.Op.Samples.EpResidentItemsRate[lastEntry]) - cb.addBucketField(fields, "vb_avg_active_queue_age", extendedBucketStats.Op.Samples.VbAvgActiveQueueAge[lastEntry]) - cb.addBucketField(fields, "vb_avg_replica_queue_age", extendedBucketStats.Op.Samples.VbAvgReplicaQueueAge[lastEntry]) - cb.addBucketField(fields, "vb_avg_pending_queue_age", extendedBucketStats.Op.Samples.VbAvgPendingQueueAge[lastEntry]) - cb.addBucketField(fields, "vb_avg_total_queue_age", extendedBucketStats.Op.Samples.VbAvgTotalQueueAge[lastEntry]) - cb.addBucketField(fields, "vb_active_resident_items_ratio", extendedBucketStats.Op.Samples.VbActiveResidentItemsRatio[lastEntry]) - cb.addBucketField(fields, "vb_replica_resident_items_ratio", extendedBucketStats.Op.Samples.VbReplicaResidentItemsRatio[lastEntry]) - cb.addBucketField(fields, "vb_pending_resident_items_ratio", extendedBucketStats.Op.Samples.VbPendingResidentItemsRatio[lastEntry]) - cb.addBucketField(fields, "avg_disk_update_time", extendedBucketStats.Op.Samples.AvgDiskUpdateTime[lastEntry]) - cb.addBucketField(fields, "avg_disk_commit_time", extendedBucketStats.Op.Samples.AvgDiskCommitTime[lastEntry]) - cb.addBucketField(fields, "avg_bg_wait_time", extendedBucketStats.Op.Samples.AvgBgWaitTime[lastEntry]) - cb.addBucketField(fields, "avg_active_timestamp_drift", extendedBucketStats.Op.Samples.AvgActiveTimestampDrift[lastEntry]) - cb.addBucketField(fields, "avg_replica_timestamp_drift", extendedBucketStats.Op.Samples.AvgReplicaTimestampDrift[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views+indexes_count", extendedBucketStats.Op.Samples.EpDcpViewsIndexesCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views+indexes_items_remaining", extendedBucketStats.Op.Samples.EpDcpViewsIndexesItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views+indexes_producer_count", extendedBucketStats.Op.Samples.EpDcpViewsIndexesProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views+indexes_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpViewsIndexesTotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views+indexes_items_sent", extendedBucketStats.Op.Samples.EpDcpViewsIndexesItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views+indexes_total_bytes", extendedBucketStats.Op.Samples.EpDcpViewsIndexesTotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views+indexes_backoff", extendedBucketStats.Op.Samples.EpDcpViewsIndexesBackoff[lastEntry]) - cb.addBucketField(fields, "bg_wait_count", extendedBucketStats.Op.Samples.BgWaitCount[lastEntry]) - cb.addBucketField(fields, "bg_wait_total", extendedBucketStats.Op.Samples.BgWaitTotal[lastEntry]) - cb.addBucketField(fields, "bytes_read", extendedBucketStats.Op.Samples.BytesRead[lastEntry]) - cb.addBucketField(fields, "bytes_written", extendedBucketStats.Op.Samples.BytesWritten[lastEntry]) - cb.addBucketField(fields, "cas_badval", extendedBucketStats.Op.Samples.CasBadval[lastEntry]) - cb.addBucketField(fields, "cas_hits", extendedBucketStats.Op.Samples.CasHits[lastEntry]) - cb.addBucketField(fields, "cas_misses", extendedBucketStats.Op.Samples.CasMisses[lastEntry]) - cb.addBucketField(fields, "cmd_get", extendedBucketStats.Op.Samples.CmdGet[lastEntry]) - cb.addBucketField(fields, "cmd_lookup", extendedBucketStats.Op.Samples.CmdLookup[lastEntry]) - cb.addBucketField(fields, "cmd_set", extendedBucketStats.Op.Samples.CmdSet[lastEntry]) - cb.addBucketField(fields, "couch_docs_actual_disk_size", extendedBucketStats.Op.Samples.CouchDocsActualDiskSize[lastEntry]) - cb.addBucketField(fields, "couch_docs_data_size", extendedBucketStats.Op.Samples.CouchDocsDataSize[lastEntry]) - cb.addBucketField(fields, "couch_docs_disk_size", extendedBucketStats.Op.Samples.CouchDocsDiskSize[lastEntry]) - cb.addBucketField(fields, "couch_spatial_data_size", extendedBucketStats.Op.Samples.CouchSpatialDataSize[lastEntry]) - cb.addBucketField(fields, "couch_spatial_disk_size", extendedBucketStats.Op.Samples.CouchSpatialDiskSize[lastEntry]) - cb.addBucketField(fields, "couch_spatial_ops", extendedBucketStats.Op.Samples.CouchSpatialOps[lastEntry]) - cb.addBucketField(fields, "couch_views_actual_disk_size", extendedBucketStats.Op.Samples.CouchViewsActualDiskSize[lastEntry]) - cb.addBucketField(fields, "couch_views_data_size", extendedBucketStats.Op.Samples.CouchViewsDataSize[lastEntry]) - cb.addBucketField(fields, "couch_views_disk_size", extendedBucketStats.Op.Samples.CouchViewsDiskSize[lastEntry]) - cb.addBucketField(fields, "couch_views_ops", extendedBucketStats.Op.Samples.CouchViewsOps[lastEntry]) - cb.addBucketField(fields, "curr_connections", extendedBucketStats.Op.Samples.CurrConnections[lastEntry]) - cb.addBucketField(fields, "curr_items", extendedBucketStats.Op.Samples.CurrItems[lastEntry]) - cb.addBucketField(fields, "curr_items_tot", extendedBucketStats.Op.Samples.CurrItemsTot[lastEntry]) - cb.addBucketField(fields, "decr_hits", extendedBucketStats.Op.Samples.DecrHits[lastEntry]) - cb.addBucketField(fields, "decr_misses", extendedBucketStats.Op.Samples.DecrMisses[lastEntry]) - cb.addBucketField(fields, "delete_hits", extendedBucketStats.Op.Samples.DeleteHits[lastEntry]) - cb.addBucketField(fields, "delete_misses", extendedBucketStats.Op.Samples.DeleteMisses[lastEntry]) - cb.addBucketField(fields, "disk_commit_count", extendedBucketStats.Op.Samples.DiskCommitCount[lastEntry]) - cb.addBucketField(fields, "disk_commit_total", extendedBucketStats.Op.Samples.DiskCommitTotal[lastEntry]) - cb.addBucketField(fields, "disk_update_count", extendedBucketStats.Op.Samples.DiskUpdateCount[lastEntry]) - cb.addBucketField(fields, "disk_update_total", extendedBucketStats.Op.Samples.DiskUpdateTotal[lastEntry]) - cb.addBucketField(fields, "disk_write_queue", extendedBucketStats.Op.Samples.DiskWriteQueue[lastEntry]) - cb.addBucketField(fields, "ep_active_ahead_exceptions", extendedBucketStats.Op.Samples.EpActiveAheadExceptions[lastEntry]) - cb.addBucketField(fields, "ep_active_hlc_drift", extendedBucketStats.Op.Samples.EpActiveHlcDrift[lastEntry]) - cb.addBucketField(fields, "ep_active_hlc_drift_count", extendedBucketStats.Op.Samples.EpActiveHlcDriftCount[lastEntry]) - cb.addBucketField(fields, "ep_bg_fetched", extendedBucketStats.Op.Samples.EpBgFetched[lastEntry]) - cb.addBucketField(fields, "ep_clock_cas_drift_threshold_exceeded", extendedBucketStats.Op.Samples.EpClockCasDriftThresholdExceeded[lastEntry]) - cb.addBucketField(fields, "ep_data_read_failed", extendedBucketStats.Op.Samples.EpDataReadFailed[lastEntry]) - cb.addBucketField(fields, "ep_data_write_failed", extendedBucketStats.Op.Samples.EpDataWriteFailed[lastEntry]) - cb.addBucketField(fields, "ep_dcp_2i_backoff", extendedBucketStats.Op.Samples.EpDcp2IBackoff[lastEntry]) - cb.addBucketField(fields, "ep_dcp_2i_count", extendedBucketStats.Op.Samples.EpDcp2ICount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_2i_items_remaining", extendedBucketStats.Op.Samples.EpDcp2IItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_2i_items_sent", extendedBucketStats.Op.Samples.EpDcp2IItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_2i_producer_count", extendedBucketStats.Op.Samples.EpDcp2IProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_2i_total_backlog_size", extendedBucketStats.Op.Samples.EpDcp2ITotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_2i_total_bytes", extendedBucketStats.Op.Samples.EpDcp2ITotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_dcp_cbas_backoff", extendedBucketStats.Op.Samples.EpDcpCbasBackoff[lastEntry]) - cb.addBucketField(fields, "ep_dcp_cbas_count", extendedBucketStats.Op.Samples.EpDcpCbasCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_cbas_items_remaining", extendedBucketStats.Op.Samples.EpDcpCbasItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_cbas_items_sent", extendedBucketStats.Op.Samples.EpDcpCbasItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_cbas_producer_count", extendedBucketStats.Op.Samples.EpDcpCbasProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_cbas_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpCbasTotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_cbas_total_bytes", extendedBucketStats.Op.Samples.EpDcpCbasTotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_dcp_eventing_backoff", extendedBucketStats.Op.Samples.EpDcpEventingBackoff[lastEntry]) - cb.addBucketField(fields, "ep_dcp_eventing_count", extendedBucketStats.Op.Samples.EpDcpEventingCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_eventing_items_remaining", extendedBucketStats.Op.Samples.EpDcpEventingItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_eventing_items_sent", extendedBucketStats.Op.Samples.EpDcpEventingItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_eventing_producer_count", extendedBucketStats.Op.Samples.EpDcpEventingProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_eventing_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpEventingTotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_eventing_total_bytes", extendedBucketStats.Op.Samples.EpDcpEventingTotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_dcp_fts_backoff", extendedBucketStats.Op.Samples.EpDcpFtsBackoff[lastEntry]) - cb.addBucketField(fields, "ep_dcp_fts_count", extendedBucketStats.Op.Samples.EpDcpFtsCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_fts_items_remaining", extendedBucketStats.Op.Samples.EpDcpFtsItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_fts_items_sent", extendedBucketStats.Op.Samples.EpDcpFtsItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_fts_producer_count", extendedBucketStats.Op.Samples.EpDcpFtsProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_fts_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpFtsTotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_fts_total_bytes", extendedBucketStats.Op.Samples.EpDcpFtsTotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_dcp_other_backoff", extendedBucketStats.Op.Samples.EpDcpOtherBackoff[lastEntry]) - cb.addBucketField(fields, "ep_dcp_other_count", extendedBucketStats.Op.Samples.EpDcpOtherCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_other_items_remaining", extendedBucketStats.Op.Samples.EpDcpOtherItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_other_items_sent", extendedBucketStats.Op.Samples.EpDcpOtherItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_other_producer_count", extendedBucketStats.Op.Samples.EpDcpOtherProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_other_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpOtherTotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_other_total_bytes", extendedBucketStats.Op.Samples.EpDcpOtherTotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_dcp_replica_backoff", extendedBucketStats.Op.Samples.EpDcpReplicaBackoff[lastEntry]) - cb.addBucketField(fields, "ep_dcp_replica_count", extendedBucketStats.Op.Samples.EpDcpReplicaCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_replica_items_remaining", extendedBucketStats.Op.Samples.EpDcpReplicaItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_replica_items_sent", extendedBucketStats.Op.Samples.EpDcpReplicaItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_replica_producer_count", extendedBucketStats.Op.Samples.EpDcpReplicaProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_replica_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpReplicaTotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_replica_total_bytes", extendedBucketStats.Op.Samples.EpDcpReplicaTotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views_backoff", extendedBucketStats.Op.Samples.EpDcpViewsBackoff[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views_count", extendedBucketStats.Op.Samples.EpDcpViewsCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views_items_remaining", extendedBucketStats.Op.Samples.EpDcpViewsItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views_items_sent", extendedBucketStats.Op.Samples.EpDcpViewsItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views_producer_count", extendedBucketStats.Op.Samples.EpDcpViewsProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpViewsTotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_views_total_bytes", extendedBucketStats.Op.Samples.EpDcpViewsTotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_dcp_xdcr_backoff", extendedBucketStats.Op.Samples.EpDcpXdcrBackoff[lastEntry]) - cb.addBucketField(fields, "ep_dcp_xdcr_count", extendedBucketStats.Op.Samples.EpDcpXdcrCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_xdcr_items_remaining", extendedBucketStats.Op.Samples.EpDcpXdcrItemsRemaining[lastEntry]) - cb.addBucketField(fields, "ep_dcp_xdcr_items_sent", extendedBucketStats.Op.Samples.EpDcpXdcrItemsSent[lastEntry]) - cb.addBucketField(fields, "ep_dcp_xdcr_producer_count", extendedBucketStats.Op.Samples.EpDcpXdcrProducerCount[lastEntry]) - cb.addBucketField(fields, "ep_dcp_xdcr_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpXdcrTotalBacklogSize[lastEntry]) - cb.addBucketField(fields, "ep_dcp_xdcr_total_bytes", extendedBucketStats.Op.Samples.EpDcpXdcrTotalBytes[lastEntry]) - cb.addBucketField(fields, "ep_diskqueue_drain", extendedBucketStats.Op.Samples.EpDiskqueueDrain[lastEntry]) - cb.addBucketField(fields, "ep_diskqueue_fill", extendedBucketStats.Op.Samples.EpDiskqueueFill[lastEntry]) - cb.addBucketField(fields, "ep_diskqueue_items", extendedBucketStats.Op.Samples.EpDiskqueueItems[lastEntry]) - cb.addBucketField(fields, "ep_flusher_todo", extendedBucketStats.Op.Samples.EpFlusherTodo[lastEntry]) - cb.addBucketField(fields, "ep_item_commit_failed", extendedBucketStats.Op.Samples.EpItemCommitFailed[lastEntry]) - cb.addBucketField(fields, "ep_kv_size", extendedBucketStats.Op.Samples.EpKvSize[lastEntry]) - cb.addBucketField(fields, "ep_max_size", extendedBucketStats.Op.Samples.EpMaxSize[lastEntry]) - cb.addBucketField(fields, "ep_mem_high_wat", extendedBucketStats.Op.Samples.EpMemHighWat[lastEntry]) - cb.addBucketField(fields, "ep_mem_low_wat", extendedBucketStats.Op.Samples.EpMemLowWat[lastEntry]) - cb.addBucketField(fields, "ep_meta_data_memory", extendedBucketStats.Op.Samples.EpMetaDataMemory[lastEntry]) - cb.addBucketField(fields, "ep_num_non_resident", extendedBucketStats.Op.Samples.EpNumNonResident[lastEntry]) - cb.addBucketField(fields, "ep_num_ops_del_meta", extendedBucketStats.Op.Samples.EpNumOpsDelMeta[lastEntry]) - cb.addBucketField(fields, "ep_num_ops_del_ret_meta", extendedBucketStats.Op.Samples.EpNumOpsDelRetMeta[lastEntry]) - cb.addBucketField(fields, "ep_num_ops_get_meta", extendedBucketStats.Op.Samples.EpNumOpsGetMeta[lastEntry]) - cb.addBucketField(fields, "ep_num_ops_set_meta", extendedBucketStats.Op.Samples.EpNumOpsSetMeta[lastEntry]) - cb.addBucketField(fields, "ep_num_ops_set_ret_meta", extendedBucketStats.Op.Samples.EpNumOpsSetRetMeta[lastEntry]) - cb.addBucketField(fields, "ep_num_value_ejects", extendedBucketStats.Op.Samples.EpNumValueEjects[lastEntry]) - cb.addBucketField(fields, "ep_oom_errors", extendedBucketStats.Op.Samples.EpOomErrors[lastEntry]) - cb.addBucketField(fields, "ep_ops_create", extendedBucketStats.Op.Samples.EpOpsCreate[lastEntry]) - cb.addBucketField(fields, "ep_ops_update", extendedBucketStats.Op.Samples.EpOpsUpdate[lastEntry]) - cb.addBucketField(fields, "ep_overhead", extendedBucketStats.Op.Samples.EpOverhead[lastEntry]) - cb.addBucketField(fields, "ep_queue_size", extendedBucketStats.Op.Samples.EpQueueSize[lastEntry]) - cb.addBucketField(fields, "ep_replica_ahead_exceptions", extendedBucketStats.Op.Samples.EpReplicaAheadExceptions[lastEntry]) - cb.addBucketField(fields, "ep_replica_hlc_drift", extendedBucketStats.Op.Samples.EpReplicaHlcDrift[lastEntry]) - cb.addBucketField(fields, "ep_replica_hlc_drift_count", extendedBucketStats.Op.Samples.EpReplicaHlcDriftCount[lastEntry]) - cb.addBucketField(fields, "ep_tmp_oom_errors", extendedBucketStats.Op.Samples.EpTmpOomErrors[lastEntry]) - cb.addBucketField(fields, "ep_vb_total", extendedBucketStats.Op.Samples.EpVbTotal[lastEntry]) - cb.addBucketField(fields, "evictions", extendedBucketStats.Op.Samples.Evictions[lastEntry]) - cb.addBucketField(fields, "get_hits", extendedBucketStats.Op.Samples.GetHits[lastEntry]) - cb.addBucketField(fields, "get_misses", extendedBucketStats.Op.Samples.GetMisses[lastEntry]) - cb.addBucketField(fields, "incr_hits", extendedBucketStats.Op.Samples.IncrHits[lastEntry]) - cb.addBucketField(fields, "incr_misses", extendedBucketStats.Op.Samples.IncrMisses[lastEntry]) - cb.addBucketField(fields, "misses", extendedBucketStats.Op.Samples.Misses[lastEntry]) - cb.addBucketField(fields, "ops", extendedBucketStats.Op.Samples.Ops[lastEntry]) - cb.addBucketField(fields, "timestamp", extendedBucketStats.Op.Samples.Timestamp[lastEntry]) - cb.addBucketField(fields, "vb_active_eject", extendedBucketStats.Op.Samples.VbActiveEject[lastEntry]) - cb.addBucketField(fields, "vb_active_itm_memory", extendedBucketStats.Op.Samples.VbActiveItmMemory[lastEntry]) - cb.addBucketField(fields, "vb_active_meta_data_memory", extendedBucketStats.Op.Samples.VbActiveMetaDataMemory[lastEntry]) - cb.addBucketField(fields, "vb_active_num", extendedBucketStats.Op.Samples.VbActiveNum[lastEntry]) - cb.addBucketField(fields, "vb_active_num_non_resident", extendedBucketStats.Op.Samples.VbActiveNumNonResident[lastEntry]) - cb.addBucketField(fields, "vb_active_ops_create", extendedBucketStats.Op.Samples.VbActiveOpsCreate[lastEntry]) - cb.addBucketField(fields, "vb_active_ops_update", extendedBucketStats.Op.Samples.VbActiveOpsUpdate[lastEntry]) - cb.addBucketField(fields, "vb_active_queue_age", extendedBucketStats.Op.Samples.VbActiveQueueAge[lastEntry]) - cb.addBucketField(fields, "vb_active_queue_drain", extendedBucketStats.Op.Samples.VbActiveQueueDrain[lastEntry]) - cb.addBucketField(fields, "vb_active_queue_fill", extendedBucketStats.Op.Samples.VbActiveQueueFill[lastEntry]) - cb.addBucketField(fields, "vb_active_queue_size", extendedBucketStats.Op.Samples.VbActiveQueueSize[lastEntry]) - cb.addBucketField(fields, "vb_active_sync_write_aborted_count", extendedBucketStats.Op.Samples.VbActiveSyncWriteAbortedCount[lastEntry]) - cb.addBucketField(fields, "vb_active_sync_write_accepted_count", extendedBucketStats.Op.Samples.VbActiveSyncWriteAcceptedCount[lastEntry]) - cb.addBucketField(fields, "vb_active_sync_write_committed_count", extendedBucketStats.Op.Samples.VbActiveSyncWriteCommittedCount[lastEntry]) - cb.addBucketField(fields, "vb_pending_curr_items", extendedBucketStats.Op.Samples.VbPendingCurrItems[lastEntry]) - cb.addBucketField(fields, "vb_pending_eject", extendedBucketStats.Op.Samples.VbPendingEject[lastEntry]) - cb.addBucketField(fields, "vb_pending_itm_memory", extendedBucketStats.Op.Samples.VbPendingItmMemory[lastEntry]) - cb.addBucketField(fields, "vb_pending_meta_data_memory", extendedBucketStats.Op.Samples.VbPendingMetaDataMemory[lastEntry]) - cb.addBucketField(fields, "vb_pending_num", extendedBucketStats.Op.Samples.VbPendingNum[lastEntry]) - cb.addBucketField(fields, "vb_pending_num_non_resident", extendedBucketStats.Op.Samples.VbPendingNumNonResident[lastEntry]) - cb.addBucketField(fields, "vb_pending_ops_create", extendedBucketStats.Op.Samples.VbPendingOpsCreate[lastEntry]) - cb.addBucketField(fields, "vb_pending_ops_update", extendedBucketStats.Op.Samples.VbPendingOpsUpdate[lastEntry]) - cb.addBucketField(fields, "vb_pending_queue_age", extendedBucketStats.Op.Samples.VbPendingQueueAge[lastEntry]) - cb.addBucketField(fields, "vb_pending_queue_drain", extendedBucketStats.Op.Samples.VbPendingQueueDrain[lastEntry]) - cb.addBucketField(fields, "vb_pending_queue_fill", extendedBucketStats.Op.Samples.VbPendingQueueFill[lastEntry]) - cb.addBucketField(fields, "vb_pending_queue_size", extendedBucketStats.Op.Samples.VbPendingQueueSize[lastEntry]) - cb.addBucketField(fields, "vb_replica_curr_items", extendedBucketStats.Op.Samples.VbReplicaCurrItems[lastEntry]) - cb.addBucketField(fields, "vb_replica_eject", extendedBucketStats.Op.Samples.VbReplicaEject[lastEntry]) - cb.addBucketField(fields, "vb_replica_itm_memory", extendedBucketStats.Op.Samples.VbReplicaItmMemory[lastEntry]) - cb.addBucketField(fields, "vb_replica_meta_data_memory", extendedBucketStats.Op.Samples.VbReplicaMetaDataMemory[lastEntry]) - cb.addBucketField(fields, "vb_replica_num", extendedBucketStats.Op.Samples.VbReplicaNum[lastEntry]) - cb.addBucketField(fields, "vb_replica_num_non_resident", extendedBucketStats.Op.Samples.VbReplicaNumNonResident[lastEntry]) - cb.addBucketField(fields, "vb_replica_ops_create", extendedBucketStats.Op.Samples.VbReplicaOpsCreate[lastEntry]) - cb.addBucketField(fields, "vb_replica_ops_update", extendedBucketStats.Op.Samples.VbReplicaOpsUpdate[lastEntry]) - cb.addBucketField(fields, "vb_replica_queue_age", extendedBucketStats.Op.Samples.VbReplicaQueueAge[lastEntry]) - cb.addBucketField(fields, "vb_replica_queue_drain", extendedBucketStats.Op.Samples.VbReplicaQueueDrain[lastEntry]) - cb.addBucketField(fields, "vb_replica_queue_fill", extendedBucketStats.Op.Samples.VbReplicaQueueFill[lastEntry]) - cb.addBucketField(fields, "vb_replica_queue_size", extendedBucketStats.Op.Samples.VbReplicaQueueSize[lastEntry]) - cb.addBucketField(fields, "vb_total_queue_age", extendedBucketStats.Op.Samples.VbTotalQueueAge[lastEntry]) - cb.addBucketField(fields, "xdc_ops", extendedBucketStats.Op.Samples.XdcOps[lastEntry]) - cb.addBucketField(fields, "allocstall", extendedBucketStats.Op.Samples.Allocstall[lastEntry]) - cb.addBucketField(fields, "cpu_cores_available", extendedBucketStats.Op.Samples.CPUCoresAvailable[lastEntry]) - cb.addBucketField(fields, "cpu_irq_rate", extendedBucketStats.Op.Samples.CPUIrqRate[lastEntry]) - cb.addBucketField(fields, "cpu_stolen_rate", extendedBucketStats.Op.Samples.CPUStolenRate[lastEntry]) - cb.addBucketField(fields, "cpu_sys_rate", extendedBucketStats.Op.Samples.CPUSysRate[lastEntry]) - cb.addBucketField(fields, "cpu_user_rate", extendedBucketStats.Op.Samples.CPUUserRate[lastEntry]) - cb.addBucketField(fields, "cpu_utilization_rate", extendedBucketStats.Op.Samples.CPUUtilizationRate[lastEntry]) - cb.addBucketField(fields, "hibernated_requests", extendedBucketStats.Op.Samples.HibernatedRequests[lastEntry]) - cb.addBucketField(fields, "hibernated_waked", extendedBucketStats.Op.Samples.HibernatedWaked[lastEntry]) - cb.addBucketField(fields, "mem_actual_free", extendedBucketStats.Op.Samples.MemActualFree[lastEntry]) - cb.addBucketField(fields, "mem_actual_used", extendedBucketStats.Op.Samples.MemActualUsed[lastEntry]) - cb.addBucketField(fields, "mem_free", extendedBucketStats.Op.Samples.MemFree[lastEntry]) - cb.addBucketField(fields, "mem_limit", extendedBucketStats.Op.Samples.MemLimit[lastEntry]) - cb.addBucketField(fields, "mem_total", extendedBucketStats.Op.Samples.MemTotal[lastEntry]) - cb.addBucketField(fields, "mem_used_sys", extendedBucketStats.Op.Samples.MemUsedSys[lastEntry]) - cb.addBucketField(fields, "odp_report_failed", extendedBucketStats.Op.Samples.OdpReportFailed[lastEntry]) - cb.addBucketField(fields, "rest_requests", extendedBucketStats.Op.Samples.RestRequests[lastEntry]) - cb.addBucketField(fields, "swap_total", extendedBucketStats.Op.Samples.SwapTotal[lastEntry]) - cb.addBucketField(fields, "swap_used", extendedBucketStats.Op.Samples.SwapUsed[lastEntry]) + cb.addBucketFieldChecked(fields, "couch_total_disk_size", extendedBucketStats.Op.Samples.CouchTotalDiskSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_docs_fragmentation", extendedBucketStats.Op.Samples.CouchDocsFragmentation, lastEntry) + cb.addBucketFieldChecked(fields, "couch_views_fragmentation", extendedBucketStats.Op.Samples.CouchViewsFragmentation, lastEntry) + cb.addBucketFieldChecked(fields, "hit_ratio", extendedBucketStats.Op.Samples.HitRatio, lastEntry) + cb.addBucketFieldChecked(fields, "ep_cache_miss_rate", extendedBucketStats.Op.Samples.EpCacheMissRate, lastEntry) + cb.addBucketFieldChecked(fields, "ep_resident_items_rate", extendedBucketStats.Op.Samples.EpResidentItemsRate, lastEntry) + cb.addBucketFieldChecked(fields, "vb_avg_active_queue_age", extendedBucketStats.Op.Samples.VbAvgActiveQueueAge, lastEntry) + cb.addBucketFieldChecked(fields, "vb_avg_replica_queue_age", extendedBucketStats.Op.Samples.VbAvgReplicaQueueAge, lastEntry) + cb.addBucketFieldChecked(fields, "vb_avg_pending_queue_age", extendedBucketStats.Op.Samples.VbAvgPendingQueueAge, lastEntry) + cb.addBucketFieldChecked(fields, "vb_avg_total_queue_age", extendedBucketStats.Op.Samples.VbAvgTotalQueueAge, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_resident_items_ratio", extendedBucketStats.Op.Samples.VbActiveResidentItemsRatio, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_resident_items_ratio", extendedBucketStats.Op.Samples.VbReplicaResidentItemsRatio, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_resident_items_ratio", extendedBucketStats.Op.Samples.VbPendingResidentItemsRatio, lastEntry) + cb.addBucketFieldChecked(fields, "avg_disk_update_time", extendedBucketStats.Op.Samples.AvgDiskUpdateTime, lastEntry) + cb.addBucketFieldChecked(fields, "avg_disk_commit_time", extendedBucketStats.Op.Samples.AvgDiskCommitTime, lastEntry) + cb.addBucketFieldChecked(fields, "avg_bg_wait_time", extendedBucketStats.Op.Samples.AvgBgWaitTime, lastEntry) + cb.addBucketFieldChecked(fields, "avg_active_timestamp_drift", extendedBucketStats.Op.Samples.AvgActiveTimestampDrift, lastEntry) + cb.addBucketFieldChecked(fields, "avg_replica_timestamp_drift", extendedBucketStats.Op.Samples.AvgReplicaTimestampDrift, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views+indexes_count", extendedBucketStats.Op.Samples.EpDcpViewsIndexesCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views+indexes_items_remaining", extendedBucketStats.Op.Samples.EpDcpViewsIndexesItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views+indexes_producer_count", extendedBucketStats.Op.Samples.EpDcpViewsIndexesProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views+indexes_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpViewsIndexesTotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views+indexes_items_sent", extendedBucketStats.Op.Samples.EpDcpViewsIndexesItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views+indexes_total_bytes", extendedBucketStats.Op.Samples.EpDcpViewsIndexesTotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views+indexes_backoff", extendedBucketStats.Op.Samples.EpDcpViewsIndexesBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "bg_wait_count", extendedBucketStats.Op.Samples.BgWaitCount, lastEntry) + cb.addBucketFieldChecked(fields, "bg_wait_total", extendedBucketStats.Op.Samples.BgWaitTotal, lastEntry) + cb.addBucketFieldChecked(fields, "bytes_read", extendedBucketStats.Op.Samples.BytesRead, lastEntry) + cb.addBucketFieldChecked(fields, "bytes_written", extendedBucketStats.Op.Samples.BytesWritten, lastEntry) + cb.addBucketFieldChecked(fields, "cas_badval", extendedBucketStats.Op.Samples.CasBadval, lastEntry) + cb.addBucketFieldChecked(fields, "cas_hits", extendedBucketStats.Op.Samples.CasHits, lastEntry) + cb.addBucketFieldChecked(fields, "cas_misses", extendedBucketStats.Op.Samples.CasMisses, lastEntry) + cb.addBucketFieldChecked(fields, "cmd_get", extendedBucketStats.Op.Samples.CmdGet, lastEntry) + cb.addBucketFieldChecked(fields, "cmd_lookup", extendedBucketStats.Op.Samples.CmdLookup, lastEntry) + cb.addBucketFieldChecked(fields, "cmd_set", extendedBucketStats.Op.Samples.CmdSet, lastEntry) + cb.addBucketFieldChecked(fields, "couch_docs_actual_disk_size", extendedBucketStats.Op.Samples.CouchDocsActualDiskSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_docs_data_size", extendedBucketStats.Op.Samples.CouchDocsDataSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_docs_disk_size", extendedBucketStats.Op.Samples.CouchDocsDiskSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_spatial_data_size", extendedBucketStats.Op.Samples.CouchSpatialDataSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_spatial_disk_size", extendedBucketStats.Op.Samples.CouchSpatialDiskSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_spatial_ops", extendedBucketStats.Op.Samples.CouchSpatialOps, lastEntry) + cb.addBucketFieldChecked(fields, "couch_views_actual_disk_size", extendedBucketStats.Op.Samples.CouchViewsActualDiskSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_views_data_size", extendedBucketStats.Op.Samples.CouchViewsDataSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_views_disk_size", extendedBucketStats.Op.Samples.CouchViewsDiskSize, lastEntry) + cb.addBucketFieldChecked(fields, "couch_views_ops", extendedBucketStats.Op.Samples.CouchViewsOps, lastEntry) + cb.addBucketFieldChecked(fields, "curr_connections", extendedBucketStats.Op.Samples.CurrConnections, lastEntry) + cb.addBucketFieldChecked(fields, "curr_items", extendedBucketStats.Op.Samples.CurrItems, lastEntry) + cb.addBucketFieldChecked(fields, "curr_items_tot", extendedBucketStats.Op.Samples.CurrItemsTot, lastEntry) + cb.addBucketFieldChecked(fields, "decr_hits", extendedBucketStats.Op.Samples.DecrHits, lastEntry) + cb.addBucketFieldChecked(fields, "decr_misses", extendedBucketStats.Op.Samples.DecrMisses, lastEntry) + cb.addBucketFieldChecked(fields, "delete_hits", extendedBucketStats.Op.Samples.DeleteHits, lastEntry) + cb.addBucketFieldChecked(fields, "delete_misses", extendedBucketStats.Op.Samples.DeleteMisses, lastEntry) + cb.addBucketFieldChecked(fields, "disk_commit_count", extendedBucketStats.Op.Samples.DiskCommitCount, lastEntry) + cb.addBucketFieldChecked(fields, "disk_commit_total", extendedBucketStats.Op.Samples.DiskCommitTotal, lastEntry) + cb.addBucketFieldChecked(fields, "disk_update_count", extendedBucketStats.Op.Samples.DiskUpdateCount, lastEntry) + cb.addBucketFieldChecked(fields, "disk_update_total", extendedBucketStats.Op.Samples.DiskUpdateTotal, lastEntry) + cb.addBucketFieldChecked(fields, "disk_write_queue", extendedBucketStats.Op.Samples.DiskWriteQueue, lastEntry) + cb.addBucketFieldChecked(fields, "ep_active_ahead_exceptions", extendedBucketStats.Op.Samples.EpActiveAheadExceptions, lastEntry) + cb.addBucketFieldChecked(fields, "ep_active_hlc_drift", extendedBucketStats.Op.Samples.EpActiveHlcDrift, lastEntry) + cb.addBucketFieldChecked(fields, "ep_active_hlc_drift_count", extendedBucketStats.Op.Samples.EpActiveHlcDriftCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_bg_fetched", extendedBucketStats.Op.Samples.EpBgFetched, lastEntry) + cb.addBucketFieldChecked(fields, "ep_clock_cas_drift_threshold_exceeded", extendedBucketStats.Op.Samples.EpClockCasDriftThresholdExceeded, lastEntry) + cb.addBucketFieldChecked(fields, "ep_data_read_failed", extendedBucketStats.Op.Samples.EpDataReadFailed, lastEntry) + cb.addBucketFieldChecked(fields, "ep_data_write_failed", extendedBucketStats.Op.Samples.EpDataWriteFailed, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_2i_backoff", extendedBucketStats.Op.Samples.EpDcp2IBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_2i_count", extendedBucketStats.Op.Samples.EpDcp2ICount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_2i_items_remaining", extendedBucketStats.Op.Samples.EpDcp2IItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_2i_items_sent", extendedBucketStats.Op.Samples.EpDcp2IItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_2i_producer_count", extendedBucketStats.Op.Samples.EpDcp2IProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_2i_total_backlog_size", extendedBucketStats.Op.Samples.EpDcp2ITotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_2i_total_bytes", extendedBucketStats.Op.Samples.EpDcp2ITotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_cbas_backoff", extendedBucketStats.Op.Samples.EpDcpCbasBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_cbas_count", extendedBucketStats.Op.Samples.EpDcpCbasCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_cbas_items_remaining", extendedBucketStats.Op.Samples.EpDcpCbasItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_cbas_items_sent", extendedBucketStats.Op.Samples.EpDcpCbasItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_cbas_producer_count", extendedBucketStats.Op.Samples.EpDcpCbasProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_cbas_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpCbasTotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_cbas_total_bytes", extendedBucketStats.Op.Samples.EpDcpCbasTotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_eventing_backoff", extendedBucketStats.Op.Samples.EpDcpEventingBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_eventing_count", extendedBucketStats.Op.Samples.EpDcpEventingCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_eventing_items_remaining", extendedBucketStats.Op.Samples.EpDcpEventingItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_eventing_items_sent", extendedBucketStats.Op.Samples.EpDcpEventingItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_eventing_producer_count", extendedBucketStats.Op.Samples.EpDcpEventingProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_eventing_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpEventingTotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_eventing_total_bytes", extendedBucketStats.Op.Samples.EpDcpEventingTotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_fts_backoff", extendedBucketStats.Op.Samples.EpDcpFtsBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_fts_count", extendedBucketStats.Op.Samples.EpDcpFtsCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_fts_items_remaining", extendedBucketStats.Op.Samples.EpDcpFtsItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_fts_items_sent", extendedBucketStats.Op.Samples.EpDcpFtsItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_fts_producer_count", extendedBucketStats.Op.Samples.EpDcpFtsProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_fts_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpFtsTotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_fts_total_bytes", extendedBucketStats.Op.Samples.EpDcpFtsTotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_other_backoff", extendedBucketStats.Op.Samples.EpDcpOtherBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_other_count", extendedBucketStats.Op.Samples.EpDcpOtherCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_other_items_remaining", extendedBucketStats.Op.Samples.EpDcpOtherItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_other_items_sent", extendedBucketStats.Op.Samples.EpDcpOtherItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_other_producer_count", extendedBucketStats.Op.Samples.EpDcpOtherProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_other_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpOtherTotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_other_total_bytes", extendedBucketStats.Op.Samples.EpDcpOtherTotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_replica_backoff", extendedBucketStats.Op.Samples.EpDcpReplicaBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_replica_count", extendedBucketStats.Op.Samples.EpDcpReplicaCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_replica_items_remaining", extendedBucketStats.Op.Samples.EpDcpReplicaItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_replica_items_sent", extendedBucketStats.Op.Samples.EpDcpReplicaItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_replica_producer_count", extendedBucketStats.Op.Samples.EpDcpReplicaProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_replica_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpReplicaTotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_replica_total_bytes", extendedBucketStats.Op.Samples.EpDcpReplicaTotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views_backoff", extendedBucketStats.Op.Samples.EpDcpViewsBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views_count", extendedBucketStats.Op.Samples.EpDcpViewsCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views_items_remaining", extendedBucketStats.Op.Samples.EpDcpViewsItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views_items_sent", extendedBucketStats.Op.Samples.EpDcpViewsItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views_producer_count", extendedBucketStats.Op.Samples.EpDcpViewsProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpViewsTotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_views_total_bytes", extendedBucketStats.Op.Samples.EpDcpViewsTotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_xdcr_backoff", extendedBucketStats.Op.Samples.EpDcpXdcrBackoff, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_xdcr_count", extendedBucketStats.Op.Samples.EpDcpXdcrCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_xdcr_items_remaining", extendedBucketStats.Op.Samples.EpDcpXdcrItemsRemaining, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_xdcr_items_sent", extendedBucketStats.Op.Samples.EpDcpXdcrItemsSent, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_xdcr_producer_count", extendedBucketStats.Op.Samples.EpDcpXdcrProducerCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_xdcr_total_backlog_size", extendedBucketStats.Op.Samples.EpDcpXdcrTotalBacklogSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_dcp_xdcr_total_bytes", extendedBucketStats.Op.Samples.EpDcpXdcrTotalBytes, lastEntry) + cb.addBucketFieldChecked(fields, "ep_diskqueue_drain", extendedBucketStats.Op.Samples.EpDiskqueueDrain, lastEntry) + cb.addBucketFieldChecked(fields, "ep_diskqueue_fill", extendedBucketStats.Op.Samples.EpDiskqueueFill, lastEntry) + cb.addBucketFieldChecked(fields, "ep_diskqueue_items", extendedBucketStats.Op.Samples.EpDiskqueueItems, lastEntry) + cb.addBucketFieldChecked(fields, "ep_flusher_todo", extendedBucketStats.Op.Samples.EpFlusherTodo, lastEntry) + cb.addBucketFieldChecked(fields, "ep_item_commit_failed", extendedBucketStats.Op.Samples.EpItemCommitFailed, lastEntry) + cb.addBucketFieldChecked(fields, "ep_kv_size", extendedBucketStats.Op.Samples.EpKvSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_max_size", extendedBucketStats.Op.Samples.EpMaxSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_mem_high_wat", extendedBucketStats.Op.Samples.EpMemHighWat, lastEntry) + cb.addBucketFieldChecked(fields, "ep_mem_low_wat", extendedBucketStats.Op.Samples.EpMemLowWat, lastEntry) + cb.addBucketFieldChecked(fields, "ep_meta_data_memory", extendedBucketStats.Op.Samples.EpMetaDataMemory, lastEntry) + cb.addBucketFieldChecked(fields, "ep_num_non_resident", extendedBucketStats.Op.Samples.EpNumNonResident, lastEntry) + cb.addBucketFieldChecked(fields, "ep_num_ops_del_meta", extendedBucketStats.Op.Samples.EpNumOpsDelMeta, lastEntry) + cb.addBucketFieldChecked(fields, "ep_num_ops_del_ret_meta", extendedBucketStats.Op.Samples.EpNumOpsDelRetMeta, lastEntry) + cb.addBucketFieldChecked(fields, "ep_num_ops_get_meta", extendedBucketStats.Op.Samples.EpNumOpsGetMeta, lastEntry) + cb.addBucketFieldChecked(fields, "ep_num_ops_set_meta", extendedBucketStats.Op.Samples.EpNumOpsSetMeta, lastEntry) + cb.addBucketFieldChecked(fields, "ep_num_ops_set_ret_meta", extendedBucketStats.Op.Samples.EpNumOpsSetRetMeta, lastEntry) + cb.addBucketFieldChecked(fields, "ep_num_value_ejects", extendedBucketStats.Op.Samples.EpNumValueEjects, lastEntry) + cb.addBucketFieldChecked(fields, "ep_oom_errors", extendedBucketStats.Op.Samples.EpOomErrors, lastEntry) + cb.addBucketFieldChecked(fields, "ep_ops_create", extendedBucketStats.Op.Samples.EpOpsCreate, lastEntry) + cb.addBucketFieldChecked(fields, "ep_ops_update", extendedBucketStats.Op.Samples.EpOpsUpdate, lastEntry) + cb.addBucketFieldChecked(fields, "ep_overhead", extendedBucketStats.Op.Samples.EpOverhead, lastEntry) + cb.addBucketFieldChecked(fields, "ep_queue_size", extendedBucketStats.Op.Samples.EpQueueSize, lastEntry) + cb.addBucketFieldChecked(fields, "ep_replica_ahead_exceptions", extendedBucketStats.Op.Samples.EpReplicaAheadExceptions, lastEntry) + cb.addBucketFieldChecked(fields, "ep_replica_hlc_drift", extendedBucketStats.Op.Samples.EpReplicaHlcDrift, lastEntry) + cb.addBucketFieldChecked(fields, "ep_replica_hlc_drift_count", extendedBucketStats.Op.Samples.EpReplicaHlcDriftCount, lastEntry) + cb.addBucketFieldChecked(fields, "ep_tmp_oom_errors", extendedBucketStats.Op.Samples.EpTmpOomErrors, lastEntry) + cb.addBucketFieldChecked(fields, "ep_vb_total", extendedBucketStats.Op.Samples.EpVbTotal, lastEntry) + cb.addBucketFieldChecked(fields, "evictions", extendedBucketStats.Op.Samples.Evictions, lastEntry) + cb.addBucketFieldChecked(fields, "get_hits", extendedBucketStats.Op.Samples.GetHits, lastEntry) + cb.addBucketFieldChecked(fields, "get_misses", extendedBucketStats.Op.Samples.GetMisses, lastEntry) + cb.addBucketFieldChecked(fields, "incr_hits", extendedBucketStats.Op.Samples.IncrHits, lastEntry) + cb.addBucketFieldChecked(fields, "incr_misses", extendedBucketStats.Op.Samples.IncrMisses, lastEntry) + cb.addBucketFieldChecked(fields, "misses", extendedBucketStats.Op.Samples.Misses, lastEntry) + cb.addBucketFieldChecked(fields, "ops", extendedBucketStats.Op.Samples.Ops, lastEntry) + cb.addBucketFieldChecked(fields, "timestamp", extendedBucketStats.Op.Samples.Timestamp, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_eject", extendedBucketStats.Op.Samples.VbActiveEject, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_itm_memory", extendedBucketStats.Op.Samples.VbActiveItmMemory, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_meta_data_memory", extendedBucketStats.Op.Samples.VbActiveMetaDataMemory, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_num", extendedBucketStats.Op.Samples.VbActiveNum, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_num_non_resident", extendedBucketStats.Op.Samples.VbActiveNumNonResident, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_ops_create", extendedBucketStats.Op.Samples.VbActiveOpsCreate, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_ops_update", extendedBucketStats.Op.Samples.VbActiveOpsUpdate, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_queue_age", extendedBucketStats.Op.Samples.VbActiveQueueAge, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_queue_drain", extendedBucketStats.Op.Samples.VbActiveQueueDrain, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_queue_fill", extendedBucketStats.Op.Samples.VbActiveQueueFill, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_queue_size", extendedBucketStats.Op.Samples.VbActiveQueueSize, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_sync_write_aborted_count", extendedBucketStats.Op.Samples.VbActiveSyncWriteAbortedCount, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_sync_write_accepted_count", extendedBucketStats.Op.Samples.VbActiveSyncWriteAcceptedCount, lastEntry) + cb.addBucketFieldChecked(fields, "vb_active_sync_write_committed_count", extendedBucketStats.Op.Samples.VbActiveSyncWriteCommittedCount, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_curr_items", extendedBucketStats.Op.Samples.VbPendingCurrItems, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_eject", extendedBucketStats.Op.Samples.VbPendingEject, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_itm_memory", extendedBucketStats.Op.Samples.VbPendingItmMemory, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_meta_data_memory", extendedBucketStats.Op.Samples.VbPendingMetaDataMemory, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_num", extendedBucketStats.Op.Samples.VbPendingNum, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_num_non_resident", extendedBucketStats.Op.Samples.VbPendingNumNonResident, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_ops_create", extendedBucketStats.Op.Samples.VbPendingOpsCreate, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_ops_update", extendedBucketStats.Op.Samples.VbPendingOpsUpdate, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_queue_age", extendedBucketStats.Op.Samples.VbPendingQueueAge, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_queue_drain", extendedBucketStats.Op.Samples.VbPendingQueueDrain, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_queue_fill", extendedBucketStats.Op.Samples.VbPendingQueueFill, lastEntry) + cb.addBucketFieldChecked(fields, "vb_pending_queue_size", extendedBucketStats.Op.Samples.VbPendingQueueSize, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_curr_items", extendedBucketStats.Op.Samples.VbReplicaCurrItems, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_eject", extendedBucketStats.Op.Samples.VbReplicaEject, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_itm_memory", extendedBucketStats.Op.Samples.VbReplicaItmMemory, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_meta_data_memory", extendedBucketStats.Op.Samples.VbReplicaMetaDataMemory, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_num", extendedBucketStats.Op.Samples.VbReplicaNum, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_num_non_resident", extendedBucketStats.Op.Samples.VbReplicaNumNonResident, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_ops_create", extendedBucketStats.Op.Samples.VbReplicaOpsCreate, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_ops_update", extendedBucketStats.Op.Samples.VbReplicaOpsUpdate, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_queue_age", extendedBucketStats.Op.Samples.VbReplicaQueueAge, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_queue_drain", extendedBucketStats.Op.Samples.VbReplicaQueueDrain, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_queue_fill", extendedBucketStats.Op.Samples.VbReplicaQueueFill, lastEntry) + cb.addBucketFieldChecked(fields, "vb_replica_queue_size", extendedBucketStats.Op.Samples.VbReplicaQueueSize, lastEntry) + cb.addBucketFieldChecked(fields, "vb_total_queue_age", extendedBucketStats.Op.Samples.VbTotalQueueAge, lastEntry) + cb.addBucketFieldChecked(fields, "xdc_ops", extendedBucketStats.Op.Samples.XdcOps, lastEntry) + cb.addBucketFieldChecked(fields, "allocstall", extendedBucketStats.Op.Samples.Allocstall, lastEntry) + cb.addBucketFieldChecked(fields, "cpu_cores_available", extendedBucketStats.Op.Samples.CPUCoresAvailable, lastEntry) + cb.addBucketFieldChecked(fields, "cpu_irq_rate", extendedBucketStats.Op.Samples.CPUIrqRate, lastEntry) + cb.addBucketFieldChecked(fields, "cpu_stolen_rate", extendedBucketStats.Op.Samples.CPUStolenRate, lastEntry) + cb.addBucketFieldChecked(fields, "cpu_sys_rate", extendedBucketStats.Op.Samples.CPUSysRate, lastEntry) + cb.addBucketFieldChecked(fields, "cpu_user_rate", extendedBucketStats.Op.Samples.CPUUserRate, lastEntry) + cb.addBucketFieldChecked(fields, "cpu_utilization_rate", extendedBucketStats.Op.Samples.CPUUtilizationRate, lastEntry) + cb.addBucketFieldChecked(fields, "hibernated_requests", extendedBucketStats.Op.Samples.HibernatedRequests, lastEntry) + cb.addBucketFieldChecked(fields, "hibernated_waked", extendedBucketStats.Op.Samples.HibernatedWaked, lastEntry) + cb.addBucketFieldChecked(fields, "mem_actual_free", extendedBucketStats.Op.Samples.MemActualFree, lastEntry) + cb.addBucketFieldChecked(fields, "mem_actual_used", extendedBucketStats.Op.Samples.MemActualUsed, lastEntry) + cb.addBucketFieldChecked(fields, "mem_free", extendedBucketStats.Op.Samples.MemFree, lastEntry) + cb.addBucketFieldChecked(fields, "mem_limit", extendedBucketStats.Op.Samples.MemLimit, lastEntry) + cb.addBucketFieldChecked(fields, "mem_total", extendedBucketStats.Op.Samples.MemTotal, lastEntry) + cb.addBucketFieldChecked(fields, "mem_used_sys", extendedBucketStats.Op.Samples.MemUsedSys, lastEntry) + cb.addBucketFieldChecked(fields, "odp_report_failed", extendedBucketStats.Op.Samples.OdpReportFailed, lastEntry) + cb.addBucketFieldChecked(fields, "rest_requests", extendedBucketStats.Op.Samples.RestRequests, lastEntry) + cb.addBucketFieldChecked(fields, "swap_total", extendedBucketStats.Op.Samples.SwapTotal, lastEntry) + cb.addBucketFieldChecked(fields, "swap_used", extendedBucketStats.Op.Samples.SwapUsed, lastEntry) return nil } @@ -354,6 +354,14 @@ func (cb *Couchbase) addBucketField(fields map[string]interface{}, fieldKey stri fields[fieldKey] = value } +func (cb *Couchbase) addBucketFieldChecked(fields map[string]interface{}, fieldKey string, values []float64, index int) { + if values == nil { + return + } + + cb.addBucketField(fields, fieldKey, values[index]) +} + func (cb *Couchbase) queryDetailedBucketStats(server, bucket string, bucketStats *BucketStats) error { // Set up an HTTP request to get the complete set of bucket stats. req, err := http.NewRequest("GET", server+"/pools/default/buckets/"+bucket+"/stats?", nil) diff --git a/plugins/inputs/couchbase/couchbase_test.go b/plugins/inputs/couchbase/couchbase_test.go index 3b927e8c4f8e9..d8f6aa3ac3ad1 100644 --- a/plugins/inputs/couchbase/couchbase_test.go +++ b/plugins/inputs/couchbase/couchbase_test.go @@ -89,34 +89,52 @@ func TestSanitizeURI(t *testing.T) { func TestGatherDetailedBucketMetrics(t *testing.T) { bucket := "Ducks" - fakeServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if r.URL.Path == "/pools/default/buckets/"+bucket+"/stats" { - _, _ = w.Write([]byte(bucketStatsResponse)) - } else { - w.WriteHeader(http.StatusNotFound) - } - })) - - var err error - var cb Couchbase - cb.BucketStatsIncluded = []string{"couch_total_disk_size"} - err = cb.Init() - require.NoError(t, err) - var acc testutil.Accumulator - bucketStats := &BucketStats{} - if err := json.Unmarshal([]byte(bucketStatsResponse), bucketStats); err != nil { - t.Fatal("parse bucketResponse", err) + tests := []struct { + name string + response string + }{ + { + name: "with all fields", + response: bucketStatsResponse, + }, + { + name: "missing fields", + response: bucketStatsResponseWithMissing, + }, } - fields := make(map[string]interface{}) - err = cb.gatherDetailedBucketStats(fakeServer.URL, bucket, fields) - require.NoError(t, err) - - acc.AddFields("couchbase_bucket", fields, nil) - - // Ensure we gathered only one metric (the one that we configured). - require.Equal(t, len(acc.Metrics), 1) - require.Equal(t, len(acc.Metrics[0].Fields), 1) + for _, test := range tests { + t.Run(test.name, func(t *testing.T) { + fakeServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path == "/pools/default/buckets/"+bucket+"/stats" { + _, _ = w.Write([]byte(test.response)) + } else { + w.WriteHeader(http.StatusNotFound) + } + })) + + var err error + var cb Couchbase + cb.BucketStatsIncluded = []string{"couch_total_disk_size"} + err = cb.Init() + require.NoError(t, err) + var acc testutil.Accumulator + bucketStats := &BucketStats{} + if err := json.Unmarshal([]byte(test.response), bucketStats); err != nil { + t.Fatal("parse bucketResponse", err) + } + + fields := make(map[string]interface{}) + err = cb.gatherDetailedBucketStats(fakeServer.URL, bucket, fields) + require.NoError(t, err) + + acc.AddFields("couchbase_bucket", fields, nil) + + // Ensure we gathered only one metric (the one that we configured). + require.Equal(t, len(acc.Metrics), 1) + require.Equal(t, len(acc.Metrics[0].Fields), 1) + }) + } } // From `/pools/default` on a real cluster @@ -126,3 +144,4 @@ const poolsDefaultResponse string = `{"storageTotals":{"ram":{"total":4509725982 const bucketResponse string = `{"blastro-df": {"name":"blastro-df","bucketType":"membase","authType":"sasl","saslPassword":"","proxyPort":0,"replicaIndex":false,"uri":"/pools/default/buckets/blastro-df?bucket_uuid=2e6b9dc4c278300ce3a4f27ad540323f","streamingUri":"/pools/default/bucketsStreaming/blastro-df?bucket_uuid=2e6b9dc4c278300ce3a4f27ad540323f","localRandomKeyUri":"/pools/default/buckets/blastro-df/localRandomKey","controllers":{"compactAll":"/pools/default/buckets/blastro-df/controller/compactBucket","compactDB":"/pools/default/buckets/default/controller/compactDatabases","purgeDeletes":"/pools/default/buckets/blastro-df/controller/unsafePurgeBucket","startRecovery":"/pools/default/buckets/blastro-df/controller/startRecovery"},"nodes":[{"couchApiBase":"http://172.16.8.148:8092/blastro-df%2B2e6b9dc4c278300ce3a4f27ad540323f","systemStats":{"cpu_utilization_rate":18.39557399723375,"swap_total":0,"swap_used":0,"mem_total":64424656896,"mem_free":23791935488},"interestingStats":{"cmd_get":10.98901098901099,"couch_docs_actual_disk_size":79525832077,"couch_docs_data_size":38633186946,"couch_views_actual_disk_size":0,"couch_views_data_size":0,"curr_items":139229304,"curr_items_tot":278470058,"ep_bg_fetched":0,"get_hits":5.994005994005994,"mem_used":36284362960,"ops":1275.724275724276,"vb_replica_curr_items":139240754},"uptime":"343968","memoryTotal":64424656896,"memoryFree":23791935488,"mcdMemoryReserved":49152,"mcdMemoryAllocated":49152,"replication":1,"clusterMembership":"active","recoveryType":"none","status":"healthy","otpNode":"ns_1@172.16.8.148","hostname":"172.16.8.148:8091","clusterCompatibility":196608,"version":"3.0.1-1444-rel-community","os":"x86_64-unknown-linux-gnu","ports":{"proxy":11211,"direct":11210}},{"couchApiBase":"http://172.16.8.127:8092/blastro-df%2B2e6b9dc4c278300ce3a4f27ad540323f","systemStats":{"cpu_utilization_rate":21.97183098591549,"swap_total":0,"swap_used":0,"mem_total":64424656896,"mem_free":23533023232},"interestingStats":{"cmd_get":39.96003996003996,"couch_docs_actual_disk_size":63322357663,"couch_docs_data_size":38603481061,"couch_views_actual_disk_size":0,"couch_views_data_size":0,"curr_items":139262616,"curr_items_tot":278508069,"ep_bg_fetched":0.999000999000999,"get_hits":30.96903096903097,"mem_used":36475078736,"ops":1370.629370629371,"vb_replica_curr_items":139245453},"uptime":"339914","memoryTotal":64424656896,"memoryFree":23533023232,"mcdMemoryReserved":49152,"mcdMemoryAllocated":49152,"replication":1,"clusterMembership":"active","recoveryType":"none","status":"healthy","otpNode":"ns_1@172.16.8.127","hostname":"172.16.8.127:8091","clusterCompatibility":196608,"version":"3.0.1-1444-rel-community","os":"x86_64-unknown-linux-gnu","ports":{"proxy":11211,"direct":11210}},{"couchApiBase":"http://172.16.15.120:8092/blastro-df%2B2e6b9dc4c278300ce3a4f27ad540323f","systemStats":{"cpu_utilization_rate":23.38028169014084,"swap_total":0,"swap_used":0,"mem_total":64424656896,"mem_free":23672963072},"interestingStats":{"cmd_get":88.08808808808809,"couch_docs_actual_disk_size":80260594761,"couch_docs_data_size":38632863189,"couch_views_actual_disk_size":0,"couch_views_data_size":0,"curr_items":139251563,"curr_items_tot":278498913,"ep_bg_fetched":0,"get_hits":74.07407407407408,"mem_used":36348663000,"ops":1707.707707707708,"vb_replica_curr_items":139247350},"uptime":"343235","memoryTotal":64424656896,"memoryFree":23672963072,"mcdMemoryReserved":49152,"mcdMemoryAllocated":49152,"replication":1,"clusterMembership":"active","recoveryType":"none","status":"healthy","otpNode":"ns_1@172.16.15.120","hostname":"172.16.15.120:8091","clusterCompatibility":196608,"version":"3.0.1-1444-rel-community","os":"x86_64-unknown-linux-gnu","ports":{"proxy":11211,"direct":11210}},{"couchApiBase":"http://172.16.13.173:8092/blastro-df%2B2e6b9dc4c278300ce3a4f27ad540323f","systemStats":{"cpu_utilization_rate":22.15988779803646,"swap_total":0,"swap_used":0,"mem_total":64424656896,"mem_free":23818825728},"interestingStats":{"cmd_get":103.1031031031031,"couch_docs_actual_disk_size":68247785524,"couch_docs_data_size":38747583467,"couch_views_actual_disk_size":0,"couch_views_data_size":0,"curr_items":139245453,"curr_items_tot":279451313,"ep_bg_fetched":1.001001001001001,"get_hits":86.08608608608608,"mem_used":36524715864,"ops":1749.74974974975,"vb_replica_curr_items":140205860},"uptime":"343266","memoryTotal":64424656896,"memoryFree":23818825728,"mcdMemoryReserved":49152,"mcdMemoryAllocated":49152,"replication":1,"clusterMembership":"active","recoveryType":"none","status":"healthy","otpNode":"ns_1@172.16.13.173","hostname":"172.16.13.173:8091","clusterCompatibility":196608,"version":"3.0.1-1444-rel-community","os":"x86_64-unknown-linux-gnu","ports":{"proxy":11211,"direct":11210}},{"couchApiBase":"http://172.16.13.105:8092/blastro-df%2B2e6b9dc4c278300ce3a4f27ad540323f","systemStats":{"cpu_utilization_rate":21.94444444444444,"swap_total":0,"swap_used":0,"mem_total":64424656896,"mem_free":23721426944},"interestingStats":{"cmd_get":113.1131131131131,"couch_docs_actual_disk_size":68102832275,"couch_docs_data_size":38747477407,"couch_views_actual_disk_size":0,"couch_views_data_size":0,"curr_items":139230887,"curr_items_tot":279420530,"ep_bg_fetched":0,"get_hits":106.1061061061061,"mem_used":36524887624,"ops":1799.7997997998,"vb_replica_curr_items":140189643},"uptime":"343950","memoryTotal":64424656896,"memoryFree":23721426944,"mcdMemoryReserved":49152,"mcdMemoryAllocated":49152,"replication":1,"clusterMembership":"active","recoveryType":"none","status":"healthy","otpNode":"ns_1@172.16.13.105","hostname":"172.16.13.105:8091","clusterCompatibility":196608,"version":"3.0.1-1444-rel-community","os":"x86_64-unknown-linux-gnu","ports":{"proxy":11211,"direct":11210}},{"couchApiBase":"http://172.16.10.65:8092/blastro-df%2B2e6b9dc4c278300ce3a4f27ad540323f","systemStats":{"cpu_utilization_rate":60.62176165803109,"swap_total":0,"swap_used":0,"mem_total":64424656896,"mem_free":23618203648},"interestingStats":{"cmd_get":30.96903096903097,"couch_docs_actual_disk_size":69052175561,"couch_docs_data_size":38755695030,"couch_views_actual_disk_size":0,"couch_views_data_size":0,"curr_items":140210194,"curr_items_tot":279454253,"ep_bg_fetched":0,"get_hits":26.97302697302698,"mem_used":36543072472,"ops":1337.662337662338,"vb_replica_curr_items":139244059},"uptime":"343950","memoryTotal":64424656896,"memoryFree":23618203648,"mcdMemoryReserved":49152,"mcdMemoryAllocated":49152,"replication":1,"clusterMembership":"active","recoveryType":"none","status":"healthy","otpNode":"ns_1@172.16.10.65","hostname":"172.16.10.65:8091","clusterCompatibility":196608,"version":"3.0.1-1444-rel-community","os":"x86_64-unknown-linux-gnu","ports":{"proxy":11211,"direct":11210}},{"couchApiBase":"http://172.16.10.187:8092/blastro-df%2B2e6b9dc4c278300ce3a4f27ad540323f","systemStats":{"cpu_utilization_rate":21.83588317107093,"swap_total":0,"swap_used":0,"mem_total":64424656896,"mem_free":23062269952},"interestingStats":{"cmd_get":33.03303303303304,"couch_docs_actual_disk_size":74422029546,"couch_docs_data_size":38758172837,"couch_views_actual_disk_size":0,"couch_views_data_size":0,"curr_items":140194321,"curr_items_tot":279445526,"ep_bg_fetched":0,"get_hits":21.02102102102102,"mem_used":36527676832,"ops":1088.088088088088,"vb_replica_curr_items":139251205},"uptime":"343971","memoryTotal":64424656896,"memoryFree":23062269952,"mcdMemoryReserved":49152,"mcdMemoryAllocated":49152,"replication":1,"clusterMembership":"active","recoveryType":"none","status":"healthy","otpNode":"ns_1@172.16.10.187","thisNode":true,"hostname":"172.16.10.187:8091","clusterCompatibility":196608,"version":"3.0.1-1444-rel-community","os":"x86_64-unknown-linux-gnu","ports":{"proxy":11211,"direct":11210}}],"stats":{"uri":"/pools/default/buckets/blastro-df/stats","directoryURI":"/pools/default/buckets/blastro-df/statsDirectory","nodeStatsListURI":"/pools/default/buckets/blastro-df/nodes"},"ddocs":{"uri":"/pools/default/buckets/blastro-df/ddocs"},"nodeLocator":"vbucket","fastWarmupSettings":false,"autoCompactionSettings":false,"uuid":"2e6b9dc4c278300ce3a4f27ad540323f","vBucketServerMap":{"hashAlgorithm":"CRC","numReplicas":1,"serverList":["172.16.10.187:11210","172.16.10.65:11210","172.16.13.105:11210","172.16.13.173:11210","172.16.15.120:11210","172.16.8.127:11210","172.16.8.148:11210"],"vBucketMap":[[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,6],[0,6],[0,6],[0,6],[0,6],[1,3],[1,3],[1,3],[1,4],[1,4],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[2,3],[2,3],[2,5],[2,5],[2,5],[2,5],[2,5],[2,5],[2,5],[2,5],[2,5],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[2,5],[2,5],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[3,5],[3,5],[3,5],[3,5],[3,5],[3,5],[3,5],[3,5],[3,5],[3,5],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[3,5],[3,5],[3,5],[3,5],[3,5],[3,5],[3,6],[3,6],[3,6],[3,6],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[0,6],[5,3],[5,4],[5,4],[5,4],[5,4],[5,4],[5,4],[5,4],[5,4],[5,4],[6,5],[6,5],[6,5],[6,5],[6,5],[6,5],[6,5],[6,5],[6,5],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[0,3],[0,3],[0,3],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,4],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,5],[2,5],[2,5],[2,5],[2,5],[2,5],[4,5],[4,5],[4,5],[4,5],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[1,3],[2,6],[2,6],[3,2],[3,2],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,5],[3,5],[3,5],[3,5],[2,0],[2,0],[2,0],[2,0],[2,0],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[4,2],[4,3],[4,3],[4,3],[4,5],[4,5],[4,5],[4,5],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[1,6],[5,4],[5,4],[5,6],[5,6],[5,6],[5,6],[5,6],[5,6],[5,6],[5,6],[6,5],[6,5],[6,5],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[2,0],[0,4],[0,4],[0,4],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[0,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,6],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,4],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[4,6],[4,6],[4,6],[4,6],[4,6],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[3,4],[3,4],[3,4],[3,5],[3,5],[3,5],[3,5],[5,0],[5,0],[5,0],[2,0],[2,0],[3,0],[3,0],[3,0],[5,3],[5,3],[5,3],[5,3],[5,3],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[2,4],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,5],[4,5],[1,0],[3,0],[3,1],[3,1],[3,1],[3,1],[5,4],[5,4],[5,4],[5,4],[5,4],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[2,6],[5,6],[5,6],[5,6],[6,2],[6,2],[6,3],[6,3],[6,3],[4,0],[4,0],[4,0],[4,0],[4,0],[4,1],[4,1],[4,1],[5,6],[5,6],[5,6],[5,6],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[3,0],[0,5],[0,5],[0,5],[0,6],[0,6],[0,6],[0,6],[0,6],[0,1],[0,1],[4,6],[4,6],[4,6],[4,6],[5,0],[5,0],[5,0],[5,0],[5,0],[5,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[1,5],[1,6],[2,0],[2,0],[5,2],[5,3],[5,3],[5,3],[5,3],[5,1],[5,1],[5,1],[5,1],[5,1],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[2,5],[2,5],[2,5],[2,5],[2,5],[2,5],[2,5],[4,1],[4,1],[4,1],[5,3],[5,3],[5,3],[5,3],[5,3],[2,0],[5,2],[5,2],[5,2],[5,2],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,0],[1,2],[5,4],[5,4],[5,4],[5,4],[5,4],[5,4],[5,4],[5,4],[5,4],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[3,6],[4,1],[4,1],[5,0],[5,0],[5,0],[5,0],[5,0],[5,0],[5,0],[5,1],[5,6],[5,6],[5,6],[5,6],[5,6],[5,6],[5,6],[5,6],[5,6],[5,6],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,1],[0,2],[0,2],[5,0],[5,0],[5,0],[5,0],[5,0],[5,0],[5,0],[5,0],[0,2],[0,2],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[4,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[2,1],[5,1],[5,1],[5,1],[5,1],[5,1],[5,1],[5,1],[5,1],[5,1],[3,1],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,1],[4,1],[4,2],[4,2],[4,2],[6,3],[6,3],[6,3],[6,3],[6,3],[5,2],[5,2],[5,2],[5,2],[5,2],[5,2],[5,2],[5,2],[5,2],[5,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[5,3],[5,3],[5,3],[5,3],[5,3],[5,3],[5,3],[5,3],[5,3],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[5,1],[5,1],[5,1],[5,1],[5,1],[5,1],[5,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,2],[6,2],[6,2],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[6,0],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[2,1],[2,3],[2,3],[1,2],[1,2],[1,2],[1,3],[1,3],[1,3],[1,3],[1,3],[3,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[3,1],[3,1],[3,1],[3,1],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[3,2],[6,3],[6,3],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[6,2],[5,1],[5,1],[5,2],[5,2],[5,2],[5,2],[5,2],[5,2],[5,2],[5,2],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[5,2],[6,2],[6,2],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[6,3],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,2],[0,3],[1,3],[1,3],[6,2],[6,2],[0,3],[0,3],[0,3],[0,3],[0,3],[0,3],[1,3],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,4],[6,5],[6,5],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[6,5],[6,5],[6,5],[6,5],[6,5],[6,5],[6,5],[6,5],[6,5],[6,2]]},"replicaNumber":1,"threadsNumber":3,"quota":{"ram":293601280000,"rawRAM":41943040000},"basicStats":{"quotaPercentUsed":68.85424936294555,"opsPerSec":5686.789686789687,"diskFetches":0,"itemCount":943239752,"diskUsed":409178772321,"dataUsed":212179309111,"memUsed":202156957464},"evictionPolicy":"valueOnly","bucketCapabilitiesVer":"","bucketCapabilities":["cbhello","touch","couchapi","cccp","xdcrCheckpointing","nodesExt"]}}` const bucketStatsResponse string = `{"op":{"samples":{"couch_total_disk_size":[559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341],"couch_docs_fragmentation":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"couch_views_fragmentation":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"hit_ratio":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_cache_miss_rate":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_resident_items_rate":[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100],"vb_avg_active_queue_age":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_avg_replica_queue_age":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_avg_pending_queue_age":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_avg_total_queue_age":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_resident_items_ratio":[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100],"vb_replica_resident_items_ratio":[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100],"vb_pending_resident_items_ratio":[100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100],"avg_disk_update_time":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"avg_disk_commit_time":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"avg_bg_wait_time":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"avg_active_timestamp_drift":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"avg_replica_timestamp_drift":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views+indexes_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views+indexes_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views+indexes_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views+indexes_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views+indexes_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views+indexes_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views+indexes_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"bg_wait_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"bg_wait_total":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"bytes_read":[118.1818181818182,142.2805247225025,180.8080808080808,197.7800201816347,141.9939577039275,118.5410334346505,142.4242424242424,148.4848484848485,197.3816717019134,202.4291497975709,118.0625630676085,142.4242424242424,179.6165489404642,197.979797979798,142.4242424242424,118.1818181818182,142.2805247225025,148.4848484848485,197.979797979798,201.816347124117,118.1818181818182,142.4242424242424,148.4848484848485,197.7800201816347,142.4242424242424,118.1818181818182,142.2805247225025,179.7979797979798,197.1830985915493,202.6342451874367,118.1818181818182,142.2805247225025,180.4435483870968,198.3805668016194,142.2805247225025,118.1818181818182,142.2805247225025,148.4848484848485,197.979797979798,202.020202020202,118.0625630676085,118.1818181818182,204.040404040404,197.7800201816347,142.1370967741935,118.4210526315789,118.1818181818182,172.5529767911201,197.5806451612903,202.4291497975709,118.0625630676085,118.1818181818182,172.7272727272727,197.7800201816347,142.4242424242424,118.0625630676085,118.1818181818182,204.040404040404,197.979797979798,201.816347124117],"bytes_written":[36420.20202020202,37762.86579212916,37225.25252525252,50460.14127144299,37686.80765357502,36530.90172239109,37801.0101010101,37111.11111111111,50358.50956696878,60511.13360323886,36383.45105953582,37801.0101010101,37393.54187689203,50511.11111111111,37801.0101010101,36420.20202020202,37762.86579212916,37111.11111111111,50511.11111111111,60327.95156407669,36420.20202020202,37801.0101010101,37111.11111111111,50460.14127144299,37801.0101010101,36420.20202020202,37762.86579212916,37431.31313131313,50307.84708249497,60572.44174265451,36420.20202020202,37762.86579212916,37150.20161290323,50613.36032388664,37762.86579212916,36420.20202020202,37762.86579212916,37111.11111111111,50511.11111111111,60388.88888888889,36383.45105953582,36420.20202020202,38812.12121212122,50460.14127144299,37724.79838709677,36493.92712550607,36420.20202020202,38453.07769929364,50409.27419354839,60511.13360323886,36383.45105953582,36420.20202020202,38491.91919191919,50460.14127144299,37801.0101010101,36383.45105953582,36420.20202020202,38812.12121212122,50511.11111111111,60327.95156407669],"cas_badval":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"cas_hits":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"cas_misses":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"cmd_get":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"cmd_lookup":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"cmd_set":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"couch_docs_actual_disk_size":[559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341],"couch_docs_data_size":[531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373],"couch_docs_disk_size":[531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373,531373],"couch_spatial_data_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"couch_spatial_disk_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"couch_spatial_ops":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"couch_views_actual_disk_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"couch_views_data_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"couch_views_disk_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"couch_views_ops":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"curr_connections":[14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14],"curr_items":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"curr_items_tot":[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],"decr_hits":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"decr_misses":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"delete_hits":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"delete_misses":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"disk_commit_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"disk_commit_total":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"disk_update_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"disk_update_total":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"disk_write_queue":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_active_ahead_exceptions":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_active_hlc_drift":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_active_hlc_drift_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_bg_fetched":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_clock_cas_drift_threshold_exceeded":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_data_read_failed":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_data_write_failed":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_2i_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_2i_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_2i_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_2i_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_2i_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_2i_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_2i_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_cbas_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_cbas_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_cbas_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_cbas_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_cbas_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_cbas_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_cbas_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_eventing_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_eventing_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_eventing_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_eventing_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_eventing_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_eventing_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_eventing_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_fts_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_fts_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_fts_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_fts_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_fts_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_fts_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_fts_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_other_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_other_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_other_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_other_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_other_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_other_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_other_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_replica_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_replica_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_replica_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_replica_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_replica_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_replica_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_replica_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_views_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_xdcr_backoff":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_xdcr_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_xdcr_items_remaining":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_xdcr_items_sent":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_xdcr_producer_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_xdcr_total_backlog_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_dcp_xdcr_total_bytes":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_diskqueue_drain":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_diskqueue_fill":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_diskqueue_items":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_flusher_todo":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_item_commit_failed":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_kv_size":[10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340,10340],"ep_max_size":[8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032,8264876032],"ep_mem_high_wat":[7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627,7025144627],"ep_mem_low_wat":[6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024,6198657024],"ep_meta_data_memory":[68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68],"ep_num_non_resident":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_num_ops_del_meta":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_num_ops_del_ret_meta":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_num_ops_get_meta":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_num_ops_set_meta":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_num_ops_set_ret_meta":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_num_value_ejects":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_oom_errors":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_ops_create":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_ops_update":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_overhead":[403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824,403824],"ep_queue_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_replica_ahead_exceptions":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_replica_hlc_drift":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_replica_hlc_drift_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_tmp_oom_errors":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ep_vb_total":[64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],"evictions":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"get_hits":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"get_misses":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"incr_hits":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"incr_misses":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"mem_used":[4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016,4937016],"misses":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"ops":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"timestamp":[1615918120012,1615918121003,1615918121993,1615918122984,1615918123977,1615918124964,1615918125954,1615918126944,1615918127937,1615918128925,1615918129916,1615918130906,1615918131897,1615918132887,1615918133877,1615918134867,1615918135858,1615918136848,1615918137838,1615918138829,1615918139819,1615918140809,1615918141799,1615918142790,1615918143780,1615918144770,1615918145761,1615918146751,1615918147745,1615918148732,1615918149722,1615918150713,1615918151705,1615918152693,1615918153684,1615918154674,1615918155665,1615918156655,1615918157645,1615918158635,1615918159626,1615918160616,1615918161606,1615918162597,1615918163589,1615918164577,1615918165567,1615918166558,1615918167550,1615918168538,1615918169529,1615918170519,1615918171509,1615918172500,1615918173490,1615918174481,1615918175471,1615918176461,1615918177451,1615918178442],"vb_active_eject":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_itm_memory":[88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88,88],"vb_active_meta_data_memory":[68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68,68],"vb_active_num":[64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64],"vb_active_num_non_resident":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_ops_create":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_ops_update":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_queue_age":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_queue_drain":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_queue_fill":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_queue_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_sync_write_aborted_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_sync_write_accepted_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_active_sync_write_committed_count":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_curr_items":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_eject":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_itm_memory":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_meta_data_memory":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_num":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_num_non_resident":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_ops_create":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_ops_update":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_queue_age":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_queue_drain":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_queue_fill":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_pending_queue_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_curr_items":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_eject":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_itm_memory":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_meta_data_memory":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_num":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_num_non_resident":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_ops_create":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_ops_update":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_queue_age":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_queue_drain":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_queue_fill":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_replica_queue_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"vb_total_queue_age":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"xdc_ops":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"allocstall":[18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615,18446744073709551615],"cpu_cores_available":[12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12],"cpu_irq_rate":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"cpu_stolen_rate":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"cpu_sys_rate":[4.942965779467681,5.243268776570619,6.823027718550106,4.815073272854153,4.853128991060026,5.068836045056321,4.983108108108108,4.110738255033557,3.201347935973041,3.959561920808762,3.610411418975651,3.459915611814346,3.691275167785235,4.553119730185498,6.470588235294118,4.545454545454546,5.046257359125315,5.976430976430977,5.564924114671164,3.703703703703704,3.529411764705882,3.544303797468354,3.826787512588117,5.118961788031723,7.166947723440135,5.87248322147651,4.289318755256518,5.485232067510548,4.765886287625418,4.672897196261682,4.184100418410042,4.560810810810811,7.02928870292887,6.081081081081081,5.378151260504202,6.239460370994941,8.984047019311502,6.896551724137931,9.636517328825022,9.335576114381833,7.64063811922754,8.684654300168635,6.543624161073826,6.465155331654072,5.961376994122586,3.807106598984772,3.36417157275021,3.700588730025231,3.775167785234899,9.45945945945946,3.114478114478115,3.451178451178451,4.465037910699242,3.852596314907873,3.462837837837838,5.205709487825357,5.218855218855219,6.532663316582915,5.885057471264368,4.030226700251889],"cpu_user_rate":[15.20912547528517,9.58904109589041,10.76759061833689,8.443824145150035,8.301404853128991,10.95118898623279,9.797297297297296,6.879194630872483,6.823925863521483,6.908171861836562,6.54911838790932,6.835443037974684,7.382550335570469,10.28667790893761,16.97478991596639,11.53198653198653,9.75609756097561,11.11111111111111,12.05733558178752,7.154882154882155,6.890756302521009,6.666666666666667,7.150050352467271,10.23792357606345,12.7318718381113,9.479865771812081,7.905803195962994,8.016877637130802,9.19732441471572,9.600679694137638,7.364016736401673,8.108108108108109,15.31380753138075,13.85135135135135,10.58823529411765,12.64755480607083,18.47187237615449,13.28847771236333,19.8647506339814,21.86711522287637,23.5936188077246,22.17537942664418,12.08053691275168,16.96053736356003,32.49370277078086,8.20642978003384,10.17661900756939,7.653490328006728,10.82214765100671,14.27364864864865,6.986531986531986,7.407407407407407,10.02527379949452,11.55778894472362,8.192567567567568,12.34256926952141,14.05723905723906,28.64321608040201,13.14942528735632,7.388748950461797],"cpu_utilization_rate":[20.15209125475285,14.83230987246103,17.59061833688699,13.25889741800419,13.15453384418902,16.02002503128911,14.78040540540541,10.98993288590604,10.02527379949452,10.86773378264532,10.15952980688497,10.29535864978903,11.0738255033557,14.8397976391231,23.4453781512605,16.07744107744108,14.80235492010092,17.08754208754209,17.62225969645868,10.85858585858586,10.42016806722689,10.21097046413502,10.97683786505539,15.35688536409517,19.89881956155143,15.35234899328859,12.19512195121951,13.50210970464135,13.96321070234114,14.27357689039932,11.54811715481171,12.66891891891892,22.34309623430962,19.93243243243243,15.96638655462185,18.88701517706577,27.45591939546599,20.18502943650126,29.50126796280642,31.2026913372582,31.23425692695214,30.86003372681282,18.6241610738255,23.42569269521411,38.45507976490345,12.01353637901861,13.5407905803196,11.35407905803196,14.59731543624161,23.73310810810811,10.1010101010101,10.85858585858586,14.49031171019377,15.41038525963149,11.65540540540541,17.54827875734677,19.27609427609428,35.17587939698493,19.03448275862069,11.41897565071369],"hibernated_requests":[7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7],"hibernated_waked":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"mem_actual_free":[7004864512,6998364160,7056683008,7055605760,7059243008,7078457344,7079067648,7079514112,7078977536,7088099328,7091081216,7091773440,7091589120,7080108032,7073554432,7073914880,7080144896,7065124864,7063183360,7072677888,7073767424,7073542144,7073542144,7074902016,7053836288,7050895360,7055720448,7056822272,7057281024,7053025280,7052763136,7051984896,7049113600,7040618496,7045636096,7050907648,7021027328,7001329664,6985895936,6985895936,6955642880,7059750912,7058616320,7050067968,7047163904,7045873664,7050272768,7068528640,7073677312,7079116800,7078252544,7075880960,7065079808,7066251264,7065726976,7063486464,7064797184,7066206208,7068819456,7071809536],"mem_actual_used":[10175004672,10181505024,10123186176,10124263424,10120626176,10101411840,10100801536,10100355072,10100891648,10091769856,10088787968,10088095744,10088280064,10099761152,10106314752,10105954304,10099724288,10114744320,10116685824,10107191296,10106101760,10106327040,10106327040,10104967168,10126032896,10128973824,10124148736,10123046912,10122588160,10126843904,10127106048,10127884288,10130755584,10139250688,10134233088,10128961536,10158841856,10178539520,10193973248,10193973248,10224226304,10120118272,10121252864,10129801216,10132705280,10133995520,10129596416,10111340544,10106191872,10100752384,10101616640,10103988224,10114789376,10113617920,10114142208,10116382720,10115072000,10113662976,10111049728,10108059648],"mem_free":[7004864512,6998364160,7056683008,7055605760,7059243008,7078457344,7079067648,7079514112,7078977536,7088099328,7091081216,7091773440,7091589120,7080108032,7073554432,7073914880,7080144896,7065124864,7063183360,7072677888,7073767424,7073542144,7073542144,7074902016,7053836288,7050895360,7055720448,7056822272,7057281024,7053025280,7052763136,7051984896,7049113600,7040618496,7045636096,7050907648,7021027328,7001329664,6985895936,6985895936,6955642880,7059750912,7058616320,7050067968,7047163904,7045873664,7050272768,7068528640,7073677312,7079116800,7078252544,7075880960,7065079808,7066251264,7065726976,7063486464,7064797184,7066206208,7068819456,7071809536],"mem_limit":[17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184],"mem_total":[17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184,17179869184],"mem_used_sys":[16694517760,16707862528,16608030720,16610041856,16604663808,16553811968,16553463808,16553369600,16553861120,16539238400,16536092672,16535760896,16535707648,16553418752,16559439872,16558895104,16554569728,16580468736,16582680576,16565084160,16564649984,16565272576,16565272576,16562823168,16599863296,16602157056,16597528576,16596774912,16595107840,16593002496,16593485824,16596668416,16598691840,16607469568,16599904256,16590753792,16644947968,16684613632,16714768384,16714768384,16781234176,16573353984,16575979520,16593072128,16603037696,16605077504,16599199744,16581554176,16570187776,16560140288,16561221632,16565153792,16577990656,16577200128,16578031616,16582909952,16569671680,16565702656,16560218112,16554315776],"odp_report_failed":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"rest_requests":[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,3,2,2,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,3,2,2,2,2,2],"swap_total":[1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824,1073741824],"swap_used":[122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392,122683392]},"samplesCount":60,"isPersistent":true,"lastTStamp":1615918178442,"interval":1000},"hot_keys":[{"name":"first-duck","ops":6.003482019571351e-05}]}` +const bucketStatsResponseWithMissing string = `{"op":{"samples":{"couch_total_disk_size":[559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341,559341]},"samplesCount":60,"isPersistent":true,"lastTStamp":1615918178442,"interval":1000},"hot_keys":[{"name":"first-duck","ops":6.003482019571351e-05}]}` From fd6f752613e7f33d84fe646dd295a07939aad8d8 Mon Sep 17 00:00:00 2001 From: Alexander Krantz Date: Tue, 6 Jul 2021 12:57:52 -0700 Subject: [PATCH 23/85] Fix segfault in kube_inventory (#9456) (cherry picked from commit a0ec75a62b3c32b3868b8bb26c1fa6ecad167840) --- plugins/inputs/kube_inventory/endpoint.go | 8 +- .../inputs/kube_inventory/endpoint_test.go | 96 +++++++++++++++++++ 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/kube_inventory/endpoint.go b/plugins/inputs/kube_inventory/endpoint.go index 4b3cffa59fad3..89cbf6587bf0d 100644 --- a/plugins/inputs/kube_inventory/endpoint.go +++ b/plugins/inputs/kube_inventory/endpoint.go @@ -39,7 +39,9 @@ func (ki *KubernetesInventory) gatherEndpoint(e corev1.Endpoints, acc telegraf.A fields["ready"] = true tags["hostname"] = readyAddr.Hostname - tags["node_name"] = *readyAddr.NodeName + if readyAddr.NodeName != nil { + tags["node_name"] = *readyAddr.NodeName + } if readyAddr.TargetRef != nil { tags[strings.ToLower(readyAddr.TargetRef.Kind)] = readyAddr.TargetRef.Name } @@ -57,7 +59,9 @@ func (ki *KubernetesInventory) gatherEndpoint(e corev1.Endpoints, acc telegraf.A fields["ready"] = false tags["hostname"] = notReadyAddr.Hostname - tags["node_name"] = *notReadyAddr.NodeName + if notReadyAddr.NodeName != nil { + tags["node_name"] = *notReadyAddr.NodeName + } if notReadyAddr.TargetRef != nil { tags[strings.ToLower(notReadyAddr.TargetRef.Kind)] = notReadyAddr.TargetRef.Name } diff --git a/plugins/inputs/kube_inventory/endpoint_test.go b/plugins/inputs/kube_inventory/endpoint_test.go index 6feb262cbcee7..936a64b72544b 100644 --- a/plugins/inputs/kube_inventory/endpoint_test.go +++ b/plugins/inputs/kube_inventory/endpoint_test.go @@ -157,6 +157,102 @@ func TestEndpoint(t *testing.T) { }, hasError: false, }, + { + name: "endpoints missing node_name", + handler: &mockHandler{ + responseMap: map[string]interface{}{ + "/endpoints/": &v1.EndpointsList{ + Items: []v1.Endpoints{ + { + Subsets: []v1.EndpointSubset{ + { + NotReadyAddresses: []v1.EndpointAddress{ + { + Hostname: "storage-6", + TargetRef: &v1.ObjectReference{ + Kind: "pod", + Name: "storage-6", + }, + }, + }, + Ports: []v1.EndpointPort{ + { + Name: "server", + Protocol: "TCP", + Port: 8080, + }, + }, + }, + { + Addresses: []v1.EndpointAddress{ + { + Hostname: "storage-12", + TargetRef: &v1.ObjectReference{ + Kind: "pod", + Name: "storage-12", + }, + }, + }, + Ports: []v1.EndpointPort{ + { + Name: "server", + Protocol: "TCP", + Port: 8080, + }, + }, + }, + }, + ObjectMeta: metav1.ObjectMeta{ + Generation: 12, + Namespace: "ns1", + Name: "storage", + CreationTimestamp: metav1.Time{Time: now}, + }, + }, + }, + }, + }, + }, + output: []telegraf.Metric{ + testutil.MustMetric( + "kubernetes_endpoint", + map[string]string{ + "endpoint_name": "storage", + "namespace": "ns1", + "hostname": "storage-6", + "port_name": "server", + "port_protocol": "TCP", + "pod": "storage-6", + }, + map[string]interface{}{ + "ready": false, + "port": int32(8080), + "generation": int64(12), + "created": now.UnixNano(), + }, + time.Unix(0, 0), + ), + testutil.MustMetric( + "kubernetes_endpoint", + map[string]string{ + "endpoint_name": "storage", + "namespace": "ns1", + "hostname": "storage-12", + "port_name": "server", + "port_protocol": "TCP", + "pod": "storage-12", + }, + map[string]interface{}{ + "ready": true, + "port": int32(8080), + "generation": int64(12), + "created": now.UnixNano(), + }, + time.Unix(0, 0), + ), + }, + hasError: false, + }, } for _, v := range tests { From c5c4ae295e75eedcef4efdd5ce75160742bbd190 Mon Sep 17 00:00:00 2001 From: Dmitry Alimov Date: Wed, 7 Jul 2021 00:04:06 +0300 Subject: [PATCH 24/85] Fix typo in perDeviceIncludeDeprecationWarning (#9442) (cherry picked from commit 285cae2b64d24bfcf254fe3a7837828ad16a3cfa) --- plugins/inputs/docker/docker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/docker/docker.go b/plugins/inputs/docker/docker.go index 4e6dc5ad4d221..5320e77b27ce8 100644 --- a/plugins/inputs/docker/docker.go +++ b/plugins/inputs/docker/docker.go @@ -75,7 +75,7 @@ const ( defaultEndpoint = "unix:///var/run/docker.sock" - perDeviceIncludeDeprecationWarning = "'perdevice' setting is set to 'true' so 'blkio' and 'network' metrics will" + + perDeviceIncludeDeprecationWarning = "'perdevice' setting is set to 'true' so 'blkio' and 'network' metrics will " + "be collected. Please set it to 'false' and use 'perdevice_include' instead to control this behaviour as " + "'perdevice' will be deprecated" From f128f33a2657a1790884c90fce37ec1f8b8ef107 Mon Sep 17 00:00:00 2001 From: Thomas Casteleyn Date: Tue, 6 Jul 2021 23:20:53 +0200 Subject: [PATCH 25/85] Improve documentation (#9457) (cherry picked from commit c56a652b4d295b52c3583d191e41b8cf552db42b) --- CONTRIBUTING.md | 6 +++--- README.md | 4 +++- config/README.md | 1 + docs/developers/README.md | 1 + 4 files changed, 8 insertions(+), 4 deletions(-) create mode 120000 config/README.md create mode 120000 docs/developers/README.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2ada24a762335..ea06a968ce1c6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,11 +14,11 @@ 1. Open a new [pull request][]. #### Contributing an External Plugin *(new)* -Input, output, and processor plugins written for internal Telegraf can be run as externally-compiled plugins through the [Execd Input](plugins/inputs/execd), [Execd Output](/plugins/outputs/execd), and [Execd Processor](plugins/processors/execd) Plugins without having to change the plugin code. -Follow the guidelines of how to integrate your plugin with the [Execd Go Shim](/plugins/common/shim) to easily compile it as a separate app and run it with the respective `execd` plugin. -Check out our [guidelines](docs/EXTERNAL_PLUGINS.md#external-plugin-guidelines) on how to build and set up your external plugins to run with `execd`. +Input, output, and processor plugins written for internal Telegraf can be run as externally-compiled plugins through the [Execd Input](/plugins/inputs/execd), [Execd Output](/plugins/outputs/execd), and [Execd Processor](/plugins/processors/execd) Plugins without having to change the plugin code. +Follow the guidelines of how to integrate your plugin with the [Execd Go Shim](/plugins/common/shim) to easily compile it as a separate app and run it with the respective `execd` plugin. +Check out our [guidelines](/docs/EXTERNAL_PLUGINS.md#external-plugin-guidelines) on how to build and set up your external plugins to run with `execd`. #### Security Vulnerability Reporting InfluxData takes security and our users' trust very seriously. If you believe you have found a security issue in any of our diff --git a/README.md b/README.md index 5180d0d822817..d0d67cb1932dd 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,8 @@ Telegraf is plugin-driven and has the concept of 4 distinct plugin types: New plugins are designed to be easy to contribute, pull requests are welcomed and we work to incorporate as many pull requests as possible. +If none of the internal plugins fit your needs, you could have a look at the +[list of external plugins](EXTERNAL_PLUGINS.md). ## Try in Browser :rocket: @@ -29,7 +31,7 @@ There are many ways to contribute: - [Review code and feature proposals](https://github.com/influxdata/telegraf/pulls) - Answer questions and discuss here on github and on the [Community Site](https://community.influxdata.com/) - [Contribute plugins](CONTRIBUTING.md) -- [Contribute external plugins](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/execd/shim) *(experimental)* +- [Contribute external plugins](docs/EXTERNAL_PLUGINS.md) ## Minimum Requirements diff --git a/config/README.md b/config/README.md new file mode 120000 index 0000000000000..5455122d9fbb5 --- /dev/null +++ b/config/README.md @@ -0,0 +1 @@ +../docs/CONFIGURATION.md \ No newline at end of file diff --git a/docs/developers/README.md b/docs/developers/README.md new file mode 120000 index 0000000000000..f939e75f21a8b --- /dev/null +++ b/docs/developers/README.md @@ -0,0 +1 @@ +../../CONTRIBUTING.md \ No newline at end of file From 4b9d35c50bc7971ddc173b8b663e7f82206d3436 Mon Sep 17 00:00:00 2001 From: reimda Date: Wed, 7 Jul 2021 13:09:52 -0600 Subject: [PATCH 26/85] Sqlserver input: require authentication method to be specified (#9388) (cherry picked from commit 537ac63c6894f61301d73593d4c781489610708c) --- plugins/inputs/sqlserver/README.md | 7 +++++- plugins/inputs/sqlserver/sqlserver.go | 28 +++++++++++++++------- plugins/inputs/sqlserver/sqlserver_test.go | 2 ++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/plugins/inputs/sqlserver/README.md b/plugins/inputs/sqlserver/README.md index d5ad22ee7a204..10f6064581dfb 100644 --- a/plugins/inputs/sqlserver/README.md +++ b/plugins/inputs/sqlserver/README.md @@ -52,6 +52,10 @@ GO "Server=192.168.1.10;Port=1433;User Id=;Password=;app name=telegraf;log=1;", ] + ## Authentication method + ## valid methods: "connection_string", "AAD" + # auth_method = "connection_string" + ## "database_type" enables a specific set of queries depending on the database type. If specified, it replaces azuredb = true/false and query_version = 2 ## In the config file, the sql server plugin section should be repeated each with a set of servers for a specific database_type. ## Possible values for database_type are - "AzureSQLDB" or "AzureSQLManagedInstance" or "SQLServer" @@ -197,11 +201,12 @@ EXECUTE ('GRANT VIEW DATABASE STATE TO []') - On the SQL Server resource of the database(s) being monitored, go to "Firewalls and Virtual Networks" tab and allowlist the monitoring VM IP address. - On the Monitoring VM, update the telegraf config file with the database connection string in the following format. Please note AAD based auth is currently only supported for Azure SQL Database and Azure SQL Managed Instance (but not for SQL Server), as described [here](https://docs.microsoft.com/en-us/azure/azure-sql/database/security-overview#authentication). - On the Monitoring VM, update the telegraf config file with the database connection string in the following format. -- On the Monitoring VM, update the telegraf config file with the database connection string in the following format. The connection string only provides the server and database name, but no password (since the VM's system-assigned managed identity would be used for authentication). +- On the Monitoring VM, update the telegraf config file with the database connection string in the following format. The connection string only provides the server and database name, but no password (since the VM's system-assigned managed identity would be used for authentication). The auth method must be set to "AAD" ```toml servers = [ "Server=.database.windows.net;Port=1433;Database=;app name=telegraf;log=1;", ] + auth_method = "AAD" ``` - Please note AAD based auth is currently only supported for Azure SQL Database and Azure SQL Managed Instance (but not for SQL Server), as described [here](https://docs.microsoft.com/en-us/azure/azure-sql/database/security-overview#authentication). diff --git a/plugins/inputs/sqlserver/sqlserver.go b/plugins/inputs/sqlserver/sqlserver.go index 7da1218c084ae..95f6f9b9a1989 100644 --- a/plugins/inputs/sqlserver/sqlserver.go +++ b/plugins/inputs/sqlserver/sqlserver.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" "log" - "regexp" + "strings" "sync" "time" @@ -19,6 +19,7 @@ import ( // SQLServer struct type SQLServer struct { Servers []string `toml:"servers"` + AuthMethod string `toml:"auth_method"` QueryVersion int `toml:"query_version"` AzureDB bool `toml:"azuredb"` DatabaseType string `toml:"database_type"` @@ -80,6 +81,10 @@ servers = [ "Server=192.168.1.10;Port=1433;User Id=;Password=;app name=telegraf;log=1;", ] +## Authentication method +## valid methods: "connection_string", "AAD" +# auth_method = "connection_string" + ## "database_type" enables a specific set of queries depending on the database type. If specified, it replaces azuredb = true/false and query_version = 2 ## In the config file, the sql server plugin section should be repeated each with a set of servers for a specific database_type. ## Possible values for database_type are - "AzureSQLDB" or "AzureSQLManagedInstance" or "SQLServer" @@ -286,11 +291,11 @@ func (s *SQLServer) Start(acc telegraf.Accumulator) error { for _, serv := range s.Servers { var pool *sql.DB - // setup connection based on authentication - rx := regexp.MustCompile(`\b(?:(Password=((?:&(?:[a-z]+|#[0-9]+);|[^;]){0,})))\b`) - - // when password is provided in connection string, use SQL auth - if rx.MatchString(serv) { + switch strings.ToLower(s.AuthMethod) { + case "connection_string": + // Use the DSN (connection string) directly. In this case, + // empty username/password causes use of Windows + // integrated authentication. var err error pool, err = sql.Open("mssql", serv) @@ -298,8 +303,8 @@ func (s *SQLServer) Start(acc telegraf.Accumulator) error { acc.AddError(err) continue } - } else { - // otherwise assume AAD Auth with system-assigned managed identity (MSI) + case "aad": + // AAD Auth with system-assigned managed identity (MSI) // AAD Auth is only supported for Azure SQL Database or Azure SQL Managed Instance if s.DatabaseType == "SQLServer" { @@ -322,6 +327,8 @@ func (s *SQLServer) Start(acc telegraf.Accumulator) error { } pool = sql.OpenDB(connector) + default: + return fmt.Errorf("unknown auth method: %v", s.AuthMethod) } s.pools = append(s.pools, pool) @@ -553,6 +560,9 @@ func (s *SQLServer) refreshToken() (*adal.Token, error) { func init() { inputs.Add("sqlserver", func() telegraf.Input { - return &SQLServer{Servers: []string{defaultServer}} + return &SQLServer{ + Servers: []string{defaultServer}, + AuthMethod: "connection_string", + } }) } diff --git a/plugins/inputs/sqlserver/sqlserver_test.go b/plugins/inputs/sqlserver/sqlserver_test.go index 3d1ddd3094025..a9a022bd23fa7 100644 --- a/plugins/inputs/sqlserver/sqlserver_test.go +++ b/plugins/inputs/sqlserver/sqlserver_test.go @@ -191,11 +191,13 @@ func TestSqlServer_HealthMetric(t *testing.T) { Servers: []string{fakeServer1, fakeServer2}, IncludeQuery: []string{"DatabaseSize", "MemoryClerk"}, HealthMetric: true, + AuthMethod: "connection_string", } s2 := &SQLServer{ Servers: []string{fakeServer1}, IncludeQuery: []string{"DatabaseSize"}, + AuthMethod: "connection_string", } // acc1 should have the health metric because it is specified in the config From 2248a7bf17ecf9e95abc5b0b78091a0f23fa4bd2 Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 7 Jul 2021 14:12:51 -0600 Subject: [PATCH 27/85] update build version --- build_version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_version.txt b/build_version.txt index 815d5ca06d530..66e2ae6c25cd6 100644 --- a/build_version.txt +++ b/build_version.txt @@ -1 +1 @@ -1.19.0 +1.19.1 From 7f90f97853ffc1d6cc8ea6d6d4324e68249e0735 Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 7 Jul 2021 14:32:45 -0600 Subject: [PATCH 28/85] Update changelog --- CHANGELOG.md | 25 +++++++++++++++++++++++++ etc/telegraf.conf | 10 ++++++++++ 2 files changed, 35 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f0a59529a9ad..6dcf1617400e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,28 @@ +## v1.19.1 [2021-07-07] + +#### Bugfixes + + - [#9388](https://github.com/influxdata/telegraf/pull/9388) `inputs.sqlserver` Require authentication method to be specified + - [#9456](https://github.com/influxdata/telegraf/pull/9456) `inputs.kube_inventory` Fix segfault in kube_inventory + - [#9448](https://github.com/influxdata/telegraf/pull/9448) `inputs.couchbase` Fix panic + - [#9444](https://github.com/influxdata/telegraf/pull/9444) `inputs.knx_listener` Fix nil pointer panic + - [#9446](https://github.com/influxdata/telegraf/pull/9446) `inputs.procstat` Update gopsutil module to fix panic + - [#9443](https://github.com/influxdata/telegraf/pull/9443) `inputs.rabbitmq` Fix JSON unmarshall regression + - [#9369](https://github.com/influxdata/telegraf/pull/9369) Update nat-server module to v2.2.6 + - [#9429](https://github.com/influxdata/telegraf/pull/9429) `inputs.dovecot` Exclude read-timeout from being an error + - [#9423](https://github.com/influxdata/telegraf/pull/9423) `inputs.statsd` Don't stop parsing after parsing error + - [#9370](https://github.com/influxdata/telegraf/pull/9370) Update apimachinary module to v0.21.1 + - [#9373](https://github.com/influxdata/telegraf/pull/9373) Update jwt module to v1.2.2 and jwt-go module to v3.2.3 + - [#9412](https://github.com/influxdata/telegraf/pull/9412) Update couchbase Module to v0.1.0 + - [#9366](https://github.com/influxdata/telegraf/pull/9366) `inputs.snmp` Add a check for oid and name to prevent empty metrics + - [#9413](https://github.com/influxdata/telegraf/pull/9413) `outputs.http` Fix toml error when parsing insecure_skip_verify + - [#9400](https://github.com/influxdata/telegraf/pull/9400) `inputs.x509_cert` Fix 'source' tag for https + - [#9375](https://github.com/influxdata/telegraf/pull/9375) Update signalfx module to v3.3.34 + - [#9406](https://github.com/influxdata/telegraf/pull/9406) `parsers.json_v2` Don't require tags to be added to included_keys + - [#9289](https://github.com/influxdata/telegraf/pull/9289) `inputs.x509_cert` Fix SNI support + - [#9372](https://github.com/influxdata/telegraf/pull/9372) Update gjson module to v1.8.0 + - [#9379](https://github.com/influxdata/telegraf/pull/9379) Linter fixes for plugins/inputs/[de]* + ## v1.19.0 [2021-06-17] #### Release Notes diff --git a/etc/telegraf.conf b/etc/telegraf.conf index 492bf704087db..6d11fa692706d 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -5637,6 +5637,12 @@ # ## specified, metrics for all exchanges are gathered. # # exchanges = ["telegraf"] # +# ## Metrics to include and exclude. Globs accepted. +# ## Note that an empty array for both will include all metrics +# ## Currently the following metrics are supported: "exchange", "federation", "node", "overview", "queue" +# # metric_include = [] +# # metric_exclude = [] +# # ## Queues to include and exclude. Globs accepted. # ## Note that an empty array for both will include all queues # queue_name_include = [] @@ -8137,6 +8143,10 @@ # "Server=192.168.1.10;Port=1433;User Id=;Password=;app name=telegraf;log=1;", # ] # +# ## Authentication method +# ## valid methods: "connection_string", "AAD" +# # auth_method = "connection_string" +# # ## "database_type" enables a specific set of queries depending on the database type. If specified, it replaces azuredb = true/false and query_version = 2 # ## In the config file, the sql server plugin section should be repeated each with a set of servers for a specific database_type. # ## Possible values for database_type are - "AzureSQLDB" or "AzureSQLManagedInstance" or "SQLServer" From 9f8be0473260e321dbbcd6670356f0e37ee9a05f Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 7 Jul 2021 14:34:20 -0600 Subject: [PATCH 29/85] Telegraf v1.19.1 From 1f92e0b578c92bf9a4424fbd9d69fe8bb0baeb17 Mon Sep 17 00:00:00 2001 From: nicolasme Date: Wed, 16 Jun 2021 00:11:23 +0200 Subject: [PATCH 30/85] Add s7comm external input plugin (#9360) (cherry picked from commit 07778c57d5d043c01652a20f153240fffb2f5785) --- EXTERNAL_PLUGINS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/EXTERNAL_PLUGINS.md b/EXTERNAL_PLUGINS.md index 66e9143da9aee..225497e84ef53 100644 --- a/EXTERNAL_PLUGINS.md +++ b/EXTERNAL_PLUGINS.md @@ -19,6 +19,7 @@ Pull requests welcome. - [dnsmasq](https://github.com/machinly/dnsmasq-telegraf-plugin) - Gather dnsmasq statistics from dnsmasq - [ldap_org and ds389](https://github.com/falon/CSI-telegraf-plugins) - Gather statistics from 389ds and from LDAP trees. - [x509_crl](https://github.com/jcgonnard/telegraf-input-x590crl) - Gather information from your X509 CRL files +- [s7comm](https://github.com/nicolasme/s7comm) - Gather information from Siemens PLC ## Outputs - [kinesis](https://github.com/morfien101/telegraf-output-kinesis) - Aggregation and compression of metrics to send Amazon Kinesis. From 3afb7e83b0430c4b3a33cb0e132c8a59214fe76c Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Thu, 8 Jul 2021 13:05:41 -0500 Subject: [PATCH 31/85] Fix json_v2 parser to handle nested objects in arrays properly (#9479) (cherry picked from commit 1b20680e3728367987c96111d48870478064ca34) --- plugins/parsers/json_v2/parser.go | 9 ++++++++- plugins/parsers/json_v2/parser_test.go | 4 ++++ .../json_v2/testdata/array_of_objects/expected.out | 2 ++ .../json_v2/testdata/array_of_objects/input.json | 14 ++++++++++++++ .../testdata/array_of_objects/telegraf.conf | 9 +++++++++ 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 plugins/parsers/json_v2/testdata/array_of_objects/expected.out create mode 100644 plugins/parsers/json_v2/testdata/array_of_objects/input.json create mode 100644 plugins/parsers/json_v2/testdata/array_of_objects/telegraf.conf diff --git a/plugins/parsers/json_v2/parser.go b/plugins/parsers/json_v2/parser.go index d013f6b35e24f..da128880d1d01 100644 --- a/plugins/parsers/json_v2/parser.go +++ b/plugins/parsers/json_v2/parser.go @@ -381,6 +381,7 @@ func (p *Parser) processObjects(objects []JSONObject, input []byte) ([]telegraf. // If the object has multiple array's as elements it won't comine those, they will remain separate metrics func (p *Parser) combineObject(result MetricNode) ([]MetricNode, error) { var results []MetricNode + var combineObjectResult []MetricNode if result.IsArray() || result.IsObject() { var err error var prevArray bool @@ -437,7 +438,7 @@ func (p *Parser) combineObject(result MetricNode) ([]MetricNode, error) { arrayNode.Tag = tag if val.IsObject() { prevArray = false - _, err = p.combineObject(arrayNode) + combineObjectResult, err = p.combineObject(arrayNode) if err != nil { return false } @@ -477,6 +478,12 @@ func (p *Parser) combineObject(result MetricNode) ([]MetricNode, error) { } } + if len(results) == 0 { + // If the results are empty, use the results of the call to combine object + // This happens with nested objects in array's, see the test array_of_objects + results = combineObjectResult + } + return results, nil } diff --git a/plugins/parsers/json_v2/parser_test.go b/plugins/parsers/json_v2/parser_test.go index b53eac0fe0ee8..50c981c4d51f9 100644 --- a/plugins/parsers/json_v2/parser_test.go +++ b/plugins/parsers/json_v2/parser_test.go @@ -21,6 +21,10 @@ func TestData(t *testing.T) { name string test string }{ + { + name: "Test having an array of objects", + test: "array_of_objects", + }, { name: "Test using just fields and tags", test: "fields_and_tags", diff --git a/plugins/parsers/json_v2/testdata/array_of_objects/expected.out b/plugins/parsers/json_v2/testdata/array_of_objects/expected.out new file mode 100644 index 0000000000000..75f9e5e407f21 --- /dev/null +++ b/plugins/parsers/json_v2/testdata/array_of_objects/expected.out @@ -0,0 +1,2 @@ +file properties_mag=5.17 +file properties_mag=6.2 diff --git a/plugins/parsers/json_v2/testdata/array_of_objects/input.json b/plugins/parsers/json_v2/testdata/array_of_objects/input.json new file mode 100644 index 0000000000000..6b43061bcba43 --- /dev/null +++ b/plugins/parsers/json_v2/testdata/array_of_objects/input.json @@ -0,0 +1,14 @@ +{ + "features": [ + { + "properties": { + "mag": 5.17 + } + }, + { + "properties": { + "mag": 6.2 + } + } + ] +} diff --git a/plugins/parsers/json_v2/testdata/array_of_objects/telegraf.conf b/plugins/parsers/json_v2/testdata/array_of_objects/telegraf.conf new file mode 100644 index 0000000000000..9a93a1d05a3be --- /dev/null +++ b/plugins/parsers/json_v2/testdata/array_of_objects/telegraf.conf @@ -0,0 +1,9 @@ +# Example taken from: https://github.com/influxdata/telegraf/issues/5940 + +[[inputs.file]] + files = ["./testdata/array_of_objects/input.json"] + data_format = "json_v2" + [[inputs.file.json_v2]] + [[inputs.file.json_v2.object]] + path = "features" + From f4e0d74f533dc1685dec8be6021aa354371d522b Mon Sep 17 00:00:00 2001 From: Andre Nathan Date: Thu, 8 Jul 2021 17:54:22 -0300 Subject: [PATCH 32/85] Allow multiple keys when parsing cgroups (#8108) (cherry picked from commit 59e79fa8d4703bfcfef1cee0d81582f3de16fa5d) --- plugins/inputs/cgroup/README.md | 6 +- plugins/inputs/cgroup/cgroup_linux.go | 16 +-- plugins/inputs/cgroup/cgroup_test.go | 152 ++++++++++++++++++++++++++ 3 files changed, 164 insertions(+), 10 deletions(-) diff --git a/plugins/inputs/cgroup/README.md b/plugins/inputs/cgroup/README.md index 3b755bbd8790d..7d0eede0f7f10 100644 --- a/plugins/inputs/cgroup/README.md +++ b/plugins/inputs/cgroup/README.md @@ -27,11 +27,11 @@ VAL1\n VAL0 VAL1 ...\n ``` -* New line separated key-space-value's +* Space separated keys and value, separated by new line ``` -KEY0 VAL0\n -KEY1 VAL1\n +KEY0 ... VAL0\n +KEY1 ... VAL1\n ``` diff --git a/plugins/inputs/cgroup/cgroup_linux.go b/plugins/inputs/cgroup/cgroup_linux.go index 6ecfd255a06b7..43aa68f233fc1 100644 --- a/plugins/inputs/cgroup/cgroup_linux.go +++ b/plugins/inputs/cgroup/cgroup_linux.go @@ -10,6 +10,7 @@ import ( "path/filepath" "regexp" "strconv" + "strings" "github.com/influxdata/telegraf" ) @@ -168,7 +169,7 @@ type fileFormat struct { parser func(measurement string, fields map[string]interface{}, b []byte) } -const keyPattern = "[[:alpha:]_]+" +const keyPattern = "[[:alnum:]:_]+" const valuePattern = "[\\d-]+" var fileFormats = [...]fileFormat{ @@ -208,17 +209,18 @@ var fileFormats = [...]fileFormat{ } }, }, - // KEY0 VAL0\n - // KEY1 VAL1\n + // KEY0 ... VAL0\n + // KEY1 ... VAL1\n // ... { - name: "New line separated key-space-value's", - pattern: "^(" + keyPattern + " " + valuePattern + "\n)+$", + name: "Space separated keys and value, separated by new line", + pattern: "^((" + keyPattern + " )+" + valuePattern + "\n)+$", parser: func(measurement string, fields map[string]interface{}, b []byte) { - re := regexp.MustCompile("(" + keyPattern + ") (" + valuePattern + ")\n") + re := regexp.MustCompile("((?:" + keyPattern + " ?)+) (" + valuePattern + ")\n") matches := re.FindAllStringSubmatch(string(b), -1) for _, v := range matches { - fields[measurement+"."+v[1]] = numberOrString(v[2]) + k := strings.ReplaceAll(v[1], " ", ".") + fields[measurement+"."+k] = numberOrString(v[2]) } }, }, diff --git a/plugins/inputs/cgroup/cgroup_test.go b/plugins/inputs/cgroup/cgroup_test.go index b3094baef31ae..bd7a191b31df7 100644 --- a/plugins/inputs/cgroup/cgroup_test.go +++ b/plugins/inputs/cgroup/cgroup_test.go @@ -180,3 +180,155 @@ func TestCgroupStatistics_6(t *testing.T) { } acc.AssertContainsTaggedFields(t, "cgroup", fields, tags) } + +// ====================================================================== + +var cg7 = &CGroup{ + Paths: []string{"testdata/blkio"}, + Files: []string{"blkio.throttle.io_serviced"}, +} + +func TestCgroupStatistics_7(t *testing.T) { + var acc testutil.Accumulator + + err := acc.GatherError(cg7.Gather) + require.NoError(t, err) + + tags := map[string]string{ + "path": "testdata/blkio", + } + fields := map[string]interface{}{ + "blkio.throttle.io_serviced.11:0.Read": int64(0), + "blkio.throttle.io_serviced.11:0.Write": int64(0), + "blkio.throttle.io_serviced.11:0.Sync": int64(0), + "blkio.throttle.io_serviced.11:0.Async": int64(0), + "blkio.throttle.io_serviced.11:0.Total": int64(0), + "blkio.throttle.io_serviced.8:0.Read": int64(49134), + "blkio.throttle.io_serviced.8:0.Write": int64(216703), + "blkio.throttle.io_serviced.8:0.Sync": int64(177906), + "blkio.throttle.io_serviced.8:0.Async": int64(87931), + "blkio.throttle.io_serviced.8:0.Total": int64(265837), + "blkio.throttle.io_serviced.7:7.Read": int64(0), + "blkio.throttle.io_serviced.7:7.Write": int64(0), + "blkio.throttle.io_serviced.7:7.Sync": int64(0), + "blkio.throttle.io_serviced.7:7.Async": int64(0), + "blkio.throttle.io_serviced.7:7.Total": int64(0), + "blkio.throttle.io_serviced.7:6.Read": int64(0), + "blkio.throttle.io_serviced.7:6.Write": int64(0), + "blkio.throttle.io_serviced.7:6.Sync": int64(0), + "blkio.throttle.io_serviced.7:6.Async": int64(0), + "blkio.throttle.io_serviced.7:6.Total": int64(0), + "blkio.throttle.io_serviced.7:5.Read": int64(0), + "blkio.throttle.io_serviced.7:5.Write": int64(0), + "blkio.throttle.io_serviced.7:5.Sync": int64(0), + "blkio.throttle.io_serviced.7:5.Async": int64(0), + "blkio.throttle.io_serviced.7:5.Total": int64(0), + "blkio.throttle.io_serviced.7:4.Read": int64(0), + "blkio.throttle.io_serviced.7:4.Write": int64(0), + "blkio.throttle.io_serviced.7:4.Sync": int64(0), + "blkio.throttle.io_serviced.7:4.Async": int64(0), + "blkio.throttle.io_serviced.7:4.Total": int64(0), + "blkio.throttle.io_serviced.7:3.Read": int64(0), + "blkio.throttle.io_serviced.7:3.Write": int64(0), + "blkio.throttle.io_serviced.7:3.Sync": int64(0), + "blkio.throttle.io_serviced.7:3.Async": int64(0), + "blkio.throttle.io_serviced.7:3.Total": int64(0), + "blkio.throttle.io_serviced.7:2.Read": int64(0), + "blkio.throttle.io_serviced.7:2.Write": int64(0), + "blkio.throttle.io_serviced.7:2.Sync": int64(0), + "blkio.throttle.io_serviced.7:2.Async": int64(0), + "blkio.throttle.io_serviced.7:2.Total": int64(0), + "blkio.throttle.io_serviced.7:1.Read": int64(0), + "blkio.throttle.io_serviced.7:1.Write": int64(0), + "blkio.throttle.io_serviced.7:1.Sync": int64(0), + "blkio.throttle.io_serviced.7:1.Async": int64(0), + "blkio.throttle.io_serviced.7:1.Total": int64(0), + "blkio.throttle.io_serviced.7:0.Read": int64(0), + "blkio.throttle.io_serviced.7:0.Write": int64(0), + "blkio.throttle.io_serviced.7:0.Sync": int64(0), + "blkio.throttle.io_serviced.7:0.Async": int64(0), + "blkio.throttle.io_serviced.7:0.Total": int64(0), + "blkio.throttle.io_serviced.1:15.Read": int64(3), + "blkio.throttle.io_serviced.1:15.Write": int64(0), + "blkio.throttle.io_serviced.1:15.Sync": int64(0), + "blkio.throttle.io_serviced.1:15.Async": int64(3), + "blkio.throttle.io_serviced.1:15.Total": int64(3), + "blkio.throttle.io_serviced.1:14.Read": int64(3), + "blkio.throttle.io_serviced.1:14.Write": int64(0), + "blkio.throttle.io_serviced.1:14.Sync": int64(0), + "blkio.throttle.io_serviced.1:14.Async": int64(3), + "blkio.throttle.io_serviced.1:14.Total": int64(3), + "blkio.throttle.io_serviced.1:13.Read": int64(3), + "blkio.throttle.io_serviced.1:13.Write": int64(0), + "blkio.throttle.io_serviced.1:13.Sync": int64(0), + "blkio.throttle.io_serviced.1:13.Async": int64(3), + "blkio.throttle.io_serviced.1:13.Total": int64(3), + "blkio.throttle.io_serviced.1:12.Read": int64(3), + "blkio.throttle.io_serviced.1:12.Write": int64(0), + "blkio.throttle.io_serviced.1:12.Sync": int64(0), + "blkio.throttle.io_serviced.1:12.Async": int64(3), + "blkio.throttle.io_serviced.1:12.Total": int64(3), + "blkio.throttle.io_serviced.1:11.Read": int64(3), + "blkio.throttle.io_serviced.1:11.Write": int64(0), + "blkio.throttle.io_serviced.1:11.Sync": int64(0), + "blkio.throttle.io_serviced.1:11.Async": int64(3), + "blkio.throttle.io_serviced.1:11.Total": int64(3), + "blkio.throttle.io_serviced.1:10.Read": int64(3), + "blkio.throttle.io_serviced.1:10.Write": int64(0), + "blkio.throttle.io_serviced.1:10.Sync": int64(0), + "blkio.throttle.io_serviced.1:10.Async": int64(3), + "blkio.throttle.io_serviced.1:10.Total": int64(3), + "blkio.throttle.io_serviced.1:9.Read": int64(3), + "blkio.throttle.io_serviced.1:9.Write": int64(0), + "blkio.throttle.io_serviced.1:9.Sync": int64(0), + "blkio.throttle.io_serviced.1:9.Async": int64(3), + "blkio.throttle.io_serviced.1:9.Total": int64(3), + "blkio.throttle.io_serviced.1:8.Read": int64(3), + "blkio.throttle.io_serviced.1:8.Write": int64(0), + "blkio.throttle.io_serviced.1:8.Sync": int64(0), + "blkio.throttle.io_serviced.1:8.Async": int64(3), + "blkio.throttle.io_serviced.1:8.Total": int64(3), + "blkio.throttle.io_serviced.1:7.Read": int64(3), + "blkio.throttle.io_serviced.1:7.Write": int64(0), + "blkio.throttle.io_serviced.1:7.Sync": int64(0), + "blkio.throttle.io_serviced.1:7.Async": int64(3), + "blkio.throttle.io_serviced.1:7.Total": int64(3), + "blkio.throttle.io_serviced.1:6.Read": int64(3), + "blkio.throttle.io_serviced.1:6.Write": int64(0), + "blkio.throttle.io_serviced.1:6.Sync": int64(0), + "blkio.throttle.io_serviced.1:6.Async": int64(3), + "blkio.throttle.io_serviced.1:6.Total": int64(3), + "blkio.throttle.io_serviced.1:5.Read": int64(3), + "blkio.throttle.io_serviced.1:5.Write": int64(0), + "blkio.throttle.io_serviced.1:5.Sync": int64(0), + "blkio.throttle.io_serviced.1:5.Async": int64(3), + "blkio.throttle.io_serviced.1:5.Total": int64(3), + "blkio.throttle.io_serviced.1:4.Read": int64(3), + "blkio.throttle.io_serviced.1:4.Write": int64(0), + "blkio.throttle.io_serviced.1:4.Sync": int64(0), + "blkio.throttle.io_serviced.1:4.Async": int64(3), + "blkio.throttle.io_serviced.1:4.Total": int64(3), + "blkio.throttle.io_serviced.1:3.Read": int64(3), + "blkio.throttle.io_serviced.1:3.Write": int64(0), + "blkio.throttle.io_serviced.1:3.Sync": int64(0), + "blkio.throttle.io_serviced.1:3.Async": int64(3), + "blkio.throttle.io_serviced.1:3.Total": int64(3), + "blkio.throttle.io_serviced.1:2.Read": int64(3), + "blkio.throttle.io_serviced.1:2.Write": int64(0), + "blkio.throttle.io_serviced.1:2.Sync": int64(0), + "blkio.throttle.io_serviced.1:2.Async": int64(3), + "blkio.throttle.io_serviced.1:2.Total": int64(3), + "blkio.throttle.io_serviced.1:1.Read": int64(3), + "blkio.throttle.io_serviced.1:1.Write": int64(0), + "blkio.throttle.io_serviced.1:1.Sync": int64(0), + "blkio.throttle.io_serviced.1:1.Async": int64(3), + "blkio.throttle.io_serviced.1:1.Total": int64(3), + "blkio.throttle.io_serviced.1:0.Read": int64(3), + "blkio.throttle.io_serviced.1:0.Write": int64(0), + "blkio.throttle.io_serviced.1:0.Sync": int64(0), + "blkio.throttle.io_serviced.1:0.Async": int64(3), + "blkio.throttle.io_serviced.1:0.Total": int64(3), + "blkio.throttle.io_serviced.Total": int64(265885), + } + acc.AssertContainsTaggedFields(t, "cgroup", fields, tags) +} From edf9a54c7adf9384af2c546534f683cd4f17bba1 Mon Sep 17 00:00:00 2001 From: Russ Savage Date: Fri, 9 Jul 2021 19:24:44 -0700 Subject: [PATCH 33/85] chore: fixing link in influxdb_listener plugin (#9431) (cherry picked from commit 55a27bb62d7c0e55f0569d16b6bb1834613faa0e) --- plugins/inputs/influxdb_listener/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/inputs/influxdb_listener/README.md b/plugins/inputs/influxdb_listener/README.md index aae77fb965f7a..0912c36087b75 100644 --- a/plugins/inputs/influxdb_listener/README.md +++ b/plugins/inputs/influxdb_listener/README.md @@ -75,5 +75,5 @@ Metrics are created from InfluxDB Line Protocol in the request body. curl -i -XPOST 'http://localhost:8186/write' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000' ``` -[influxdb_http_api]: https://docs.influxdata.com/influxdb/latest/guides/writing_data/ +[influxdb_http_api]: https://docs.influxdata.com/influxdb/v1.8/guides/write_data/ [http_listener_v2]: /plugins/inputs/http_listener_v2/README.md From f66e09186b49fb28dee53294b41b5224447dee8d Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Sat, 10 Jul 2021 01:58:51 -0400 Subject: [PATCH 34/85] Update the dynatrace metric utils v0.1->v0.2 (#9399) (cherry picked from commit f2d9dbe8cc74cc580d73a910497bba5e6843f725) --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index aece5288d276a..20d75dd628ae3 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,7 @@ require ( github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 github.com/dimchansky/utfbom v1.1.1 github.com/docker/docker v20.10.6+incompatible - github.com/dynatrace-oss/dynatrace-metric-utils-go v0.1.0 + github.com/dynatrace-oss/dynatrace-metric-utils-go v0.2.0 github.com/eclipse/paho.mqtt.golang v1.3.0 github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 diff --git a/go.sum b/go.sum index 8802a978a1ff2..9cebf22aaad42 100644 --- a/go.sum +++ b/go.sum @@ -463,8 +463,8 @@ github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:Htrtb github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dynatrace-oss/dynatrace-metric-utils-go v0.1.0 h1:ldKn47mFgWCoiJRXA32psdEACPKffX9O1Msh1K8M+f0= -github.com/dynatrace-oss/dynatrace-metric-utils-go v0.1.0/go.mod h1:qw0E9EJ0PnSlhWawDNuqE0zhc1hqOBUCFIAj3dd9DNw= +github.com/dynatrace-oss/dynatrace-metric-utils-go v0.2.0 h1:TEG5Jj7RYM2JBCUH3nLqCmSZy6srnaefvXxjUTCuHyA= +github.com/dynatrace-oss/dynatrace-metric-utils-go v0.2.0/go.mod h1:qw0E9EJ0PnSlhWawDNuqE0zhc1hqOBUCFIAj3dd9DNw= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-resiliency v1.2.0 h1:v7g92e/KSN71Rq7vSThKaWIq68fL4YHvWyiUKorFR1Q= github.com/eapache/go-resiliency v1.2.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= From 73699094ad9f1376731935a023a0d35c82ec4264 Mon Sep 17 00:00:00 2001 From: Madhushree Sreenivasa Date: Tue, 13 Jul 2021 14:08:41 -0700 Subject: [PATCH 35/85] Provide detailed error message in telegraf log (#9466) (cherry picked from commit 2267733a04ca86554cf8fb182dc7e6c150c62fa2) --- plugins/inputs/sqlserver/sqlserver.go | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/plugins/inputs/sqlserver/sqlserver.go b/plugins/inputs/sqlserver/sqlserver.go index 95f6f9b9a1989..4a965bec15afd 100644 --- a/plugins/inputs/sqlserver/sqlserver.go +++ b/plugins/inputs/sqlserver/sqlserver.go @@ -256,11 +256,12 @@ func (s *SQLServer) Gather(acc telegraf.Accumulator) error { wg.Add(1) go func(pool *sql.DB, query Query, serverIndex int) { defer wg.Done() - queryError := s.gatherServer(pool, query, acc) + connectionString := s.Servers[serverIndex] + queryError := s.gatherServer(pool, query, acc, connectionString) if s.HealthMetric { mutex.Lock() - s.gatherHealth(healthMetrics, s.Servers[serverIndex], queryError) + s.gatherHealth(healthMetrics, connectionString, queryError) mutex.Unlock() } @@ -344,12 +345,21 @@ func (s *SQLServer) Stop() { } } -func (s *SQLServer) gatherServer(pool *sql.DB, query Query, acc telegraf.Accumulator) error { +func (s *SQLServer) gatherServer(pool *sql.DB, query Query, acc telegraf.Accumulator, connectionString string) error { // execute query rows, err := pool.Query(query.Script) if err != nil { - return fmt.Errorf("script %s failed: %w", query.ScriptName, err) + serverName, databaseName := getConnectionIdentifiers(connectionString) + + // Error msg based on the format in SSMS. SQLErrorClass() is another term for severity/level: http://msdn.microsoft.com/en-us/library/dd304156.aspx + if sqlerr, ok := err.(mssql.Error); ok { + return fmt.Errorf("Query %s failed for server: %s and database: %s with Msg %d, Level %d, State %d:, Line %d, Error: %w", query.ScriptName, + serverName, databaseName, sqlerr.SQLErrorNumber(), sqlerr.SQLErrorClass(), sqlerr.SQLErrorState(), sqlerr.SQLErrorLineNo(), err) + } + + return fmt.Errorf("Query %s failed for server: %s and database: %s with Error: %w", query.ScriptName, serverName, databaseName, err) } + defer rows.Close() // grab the column information from the result From 9508d4f09c13628a8c177a560531a9a0874a1476 Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Thu, 15 Jul 2021 11:11:58 -0500 Subject: [PATCH 36/85] Detect changes to config and reload telegraf (copy of pr #8529) (#9485) (cherry picked from commit 2a72295734eaee0343dac595598070c97fa725b7) --- cmd/telegraf/telegraf.go | 53 ++++++++++++++++++++++++++++++++++++++- go.mod | 3 ++- go.sum | 4 +-- internal/usage.go | 3 +++ internal/usage_windows.go | 3 +++ 5 files changed, 62 insertions(+), 4 deletions(-) diff --git a/cmd/telegraf/telegraf.go b/cmd/telegraf/telegraf.go index 02acdbbdebeb4..688c1e5bdd6c5 100644 --- a/cmd/telegraf/telegraf.go +++ b/cmd/telegraf/telegraf.go @@ -15,6 +15,7 @@ import ( "syscall" "time" + "github.com/influxdata/tail/watch" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/agent" "github.com/influxdata/telegraf/config" @@ -27,6 +28,7 @@ import ( "github.com/influxdata/telegraf/plugins/outputs" _ "github.com/influxdata/telegraf/plugins/outputs/all" _ "github.com/influxdata/telegraf/plugins/processors/all" + "gopkg.in/tomb.v1" ) type sliceFlags []string @@ -53,7 +55,7 @@ var fTestWait = flag.Int("test-wait", 0, "wait up to this many seconds for servi var fConfigs sliceFlags var fConfigDirs sliceFlags - +var fWatchConfig = flag.String("watch-config", "", "Monitoring config changes [notify, poll]") var fVersion = flag.Bool("version", false, "display the version and exit") var fSampleConfig = flag.Bool("sample-config", false, "print out full sample configuration") @@ -115,6 +117,15 @@ func reloadLoop( signals := make(chan os.Signal, 1) signal.Notify(signals, os.Interrupt, syscall.SIGHUP, syscall.SIGTERM, syscall.SIGINT) + if *fWatchConfig != "" { + for _, fConfig := range fConfigs { + if _, err := os.Stat(fConfig); err == nil { + go watchLocalConfig(signals, fConfig) + } else { + log.Printf("W! Cannot watch config %s: %s", fConfig, err) + } + } + } go func() { select { case sig := <-signals: @@ -136,6 +147,46 @@ func reloadLoop( } } +func watchLocalConfig(signals chan os.Signal, fConfig string) { + var mytomb tomb.Tomb + var watcher watch.FileWatcher + if *fWatchConfig == "poll" { + watcher = watch.NewPollingFileWatcher(fConfig) + } else { + watcher = watch.NewInotifyFileWatcher(fConfig) + } + changes, err := watcher.ChangeEvents(&mytomb, 0) + if err != nil { + log.Printf("E! Error watching config: %s\n", err) + return + } + log.Println("I! Config watcher started") + select { + case <-changes.Modified: + log.Println("I! Config file modified") + case <-changes.Deleted: + // deleted can mean moved. wait a bit a check existence + <-time.After(time.Second) + if _, err := os.Stat(fConfig); err == nil { + log.Println("I! Config file overwritten") + } else { + log.Println("W! Config file deleted") + if err := watcher.BlockUntilExists(&mytomb); err != nil { + log.Printf("E! Cannot watch for config: %s\n", err.Error()) + return + } + log.Println("I! Config file appeared") + } + case <-changes.Truncated: + log.Println("I! Config file truncated") + case <-mytomb.Dying(): + log.Println("I! Config watcher ended") + return + } + mytomb.Done() + signals <- syscall.SIGHUP +} + func runAgent(ctx context.Context, inputFilters []string, outputFilters []string, diff --git a/go.mod b/go.mod index 20d75dd628ae3..ed438a746f2ac 100644 --- a/go.mod +++ b/go.mod @@ -77,7 +77,7 @@ require ( github.com/influxdata/influxdb-observability/common v0.0.0-20210429174543-86ae73cafd31 github.com/influxdata/influxdb-observability/otel2influx v0.0.0-20210429174543-86ae73cafd31 github.com/influxdata/influxdb-observability/otlp v0.0.0-20210429174543-86ae73cafd31 - github.com/influxdata/tail v1.0.1-0.20200707181643-03a791b270e4 + github.com/influxdata/tail v1.0.1-0.20210707231403-b283181d1fa7 github.com/influxdata/toml v0.0.0-20190415235208-270119a8ce65 github.com/influxdata/wlog v0.0.0-20160411224016-7c63b0a71ef8 github.com/jackc/pgx/v4 v4.6.0 @@ -147,6 +147,7 @@ require ( gopkg.in/ldap.v3 v3.1.0 gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 gopkg.in/olivere/elastic.v5 v5.0.70 + gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 gopkg.in/yaml.v2 v2.4.0 gotest.tools v2.2.0+incompatible k8s.io/api v0.20.4 diff --git a/go.sum b/go.sum index 9cebf22aaad42..33229bdbd04f4 100644 --- a/go.sum +++ b/go.sum @@ -864,8 +864,8 @@ github.com/influxdata/influxql v1.1.0/go.mod h1:KpVI7okXjK6PRi3Z5B+mtKZli+R1DnZg github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= -github.com/influxdata/tail v1.0.1-0.20200707181643-03a791b270e4 h1:K3A5vHPs/p8OjI4SL3l1+hs/98mhxTVDcV1Ap0c265E= -github.com/influxdata/tail v1.0.1-0.20200707181643-03a791b270e4/go.mod h1:VeiWgI3qaGdJWust2fP27a6J+koITo/1c/UhxeOxgaM= +github.com/influxdata/tail v1.0.1-0.20210707231403-b283181d1fa7 h1:0rQOs1VHLVFpAAOIR0mJEvVOIaMYFgYdreeVbgI9sII= +github.com/influxdata/tail v1.0.1-0.20210707231403-b283181d1fa7/go.mod h1:VeiWgI3qaGdJWust2fP27a6J+koITo/1c/UhxeOxgaM= github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= github.com/influxdata/toml v0.0.0-20190415235208-270119a8ce65 h1:vvyMtD5LTJc1W9sQKjDkAWdcg0478CszSdzlHtiAXCY= github.com/influxdata/toml v0.0.0-20190415235208-270119a8ce65/go.mod h1:zApaNFpP/bTpQItGZNNUMISDMDAnTXu9UqJ4yT3ocz8= diff --git a/internal/usage.go b/internal/usage.go index 6eff30e6b0b21..1a4b3a3496281 100644 --- a/internal/usage.go +++ b/internal/usage.go @@ -16,6 +16,9 @@ The commands & flags are: --aggregator-filter filter the aggregators to enable, separator is : --config configuration file to load --config-directory directory containing additional *.conf files + --watch-config Telegraf will restart on local config changes. Monitor changes + using either fs notifications or polling. Valid values: 'inotify' or 'poll'. + Monitoring is off by default. --plugin-directory directory containing *.so files, this directory will be searched recursively. Any Plugin found will be loaded and namespaced. diff --git a/internal/usage_windows.go b/internal/usage_windows.go index 7fee6a1f1595c..236e1426b345c 100644 --- a/internal/usage_windows.go +++ b/internal/usage_windows.go @@ -16,6 +16,9 @@ The commands & flags are: --aggregator-filter filter the aggregators to enable, separator is : --config configuration file to load --config-directory directory containing additional *.conf files + --watch-config Telegraf will restart on local config changes. Monitor changes + using either fs notifications or polling. Valid values: 'inotify' or 'poll'. + Monitoring is off by default. --debug turn on debug logging --input-filter filter the inputs to enable, separator is : --input-list print available input plugins. From eabe630afc2eb1c472731bf7592ece9763459ba5 Mon Sep 17 00:00:00 2001 From: Mya Date: Mon, 19 Jul 2021 08:53:07 -0600 Subject: [PATCH 37/85] fixed percentiles not being able to be ints (#9447) (cherry picked from commit ff8ed3776246d3756fb8ddb46e2c882b1a02bd84) --- plugins/inputs/statsd/statsd.go | 17 +++++++++++++++-- plugins/inputs/statsd/statsd_test.go | 15 ++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/plugins/inputs/statsd/statsd.go b/plugins/inputs/statsd/statsd.go index 4416a19f4624e..fbbfef251adf9 100644 --- a/plugins/inputs/statsd/statsd.go +++ b/plugins/inputs/statsd/statsd.go @@ -37,6 +37,19 @@ const ( var errParsing = errors.New("error parsing statsd line") +// Number will get parsed as an int or float depending on what is passed +type Number float64 + +func (n *Number) UnmarshalTOML(b []byte) error { + value, err := strconv.ParseFloat(string(b), 64) + if err != nil { + return err + } + + *n = Number(value) + return nil +} + // Statsd allows the importing of statsd and dogstatsd data. type Statsd struct { // Protocol used on listener - udp or tcp @@ -51,7 +64,7 @@ type Statsd struct { // Percentiles specifies the percentiles that will be calculated for timing // and histogram stats. - Percentiles []float64 + Percentiles []Number PercentileLimit int DeleteGauges bool @@ -307,7 +320,7 @@ func (s *Statsd) Gather(acc telegraf.Accumulator) error { fields[prefix+"count"] = stats.Count() for _, percentile := range s.Percentiles { name := fmt.Sprintf("%s%v_percentile", prefix, percentile) - fields[name] = stats.Percentile(percentile) + fields[name] = stats.Percentile(float64(percentile)) } } diff --git a/plugins/inputs/statsd/statsd_test.go b/plugins/inputs/statsd/statsd_test.go index bef21b8de9eff..a236d638ba330 100644 --- a/plugins/inputs/statsd/statsd_test.go +++ b/plugins/inputs/statsd/statsd_test.go @@ -397,7 +397,7 @@ func TestParse_Counters(t *testing.T) { // Tests low-level functionality of timings func TestParse_Timings(t *testing.T) { s := NewTestStatsd() - s.Percentiles = []float64{90.0} + s.Percentiles = []Number{90.0} acc := &testutil.Accumulator{} // Test that timings work @@ -1186,7 +1186,7 @@ func TestParse_MeasurementsWithMultipleValues(t *testing.T) { func TestParse_TimingsMultipleFieldsWithTemplate(t *testing.T) { s := NewTestStatsd() s.Templates = []string{"measurement.field"} - s.Percentiles = []float64{90.0} + s.Percentiles = []Number{90.0} acc := &testutil.Accumulator{} validLines := []string{ @@ -1234,7 +1234,7 @@ func TestParse_TimingsMultipleFieldsWithTemplate(t *testing.T) { func TestParse_TimingsMultipleFieldsWithoutTemplate(t *testing.T) { s := NewTestStatsd() s.Templates = []string{} - s.Percentiles = []float64{90.0} + s.Percentiles = []Number{90.0} acc := &testutil.Accumulator{} validLines := []string{ @@ -1664,3 +1664,12 @@ func TestUdp(t *testing.T) { testutil.IgnoreTime(), ) } + +func TestParse_Ints(t *testing.T) { + s := NewTestStatsd() + s.Percentiles = []Number{90} + acc := &testutil.Accumulator{} + + require.NoError(t, s.Gather(acc)) + require.Equal(t, s.Percentiles, []Number{90.0}) +} From a42c14f6bab22f98f963df5f003ad7976bb1f3d8 Mon Sep 17 00:00:00 2001 From: Alexander Krantz Date: Mon, 19 Jul 2021 20:23:12 -0700 Subject: [PATCH 38/85] Add support for large uint64 and int64 numbers (#9520) (cherry picked from commit 2eb0ee2e1ec1b2a41e594f841609546012a3a502) --- plugins/parsers/json_v2/parser.go | 14 ++++++------ plugins/parsers/json_v2/parser_test.go | 4 ++++ .../testdata/large_numbers/expected.out | 3 +++ .../json_v2/testdata/large_numbers/input.json | 17 ++++++++++++++ .../testdata/large_numbers/telegraf.conf | 22 +++++++++++++++++++ 5 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 plugins/parsers/json_v2/testdata/large_numbers/expected.out create mode 100644 plugins/parsers/json_v2/testdata/large_numbers/input.json create mode 100644 plugins/parsers/json_v2/testdata/large_numbers/telegraf.conf diff --git a/plugins/parsers/json_v2/parser.go b/plugins/parsers/json_v2/parser.go index da128880d1d01..ef8981dffc859 100644 --- a/plugins/parsers/json_v2/parser.go +++ b/plugins/parsers/json_v2/parser.go @@ -323,7 +323,7 @@ func (p *Parser) expandArray(result MetricNode) ([]MetricNode, error) { if result.Tag { result.DesiredType = "string" } - v, err := p.convertType(result.Value(), result.DesiredType, result.SetName) + v, err := p.convertType(result.Result, result.DesiredType, result.SetName) if err != nil { return nil, err } @@ -525,8 +525,8 @@ func (p *Parser) SetDefaultTags(tags map[string]string) { } // convertType will convert the value parsed from the input JSON to the specified type in the config -func (p *Parser) convertType(input interface{}, desiredType string, name string) (interface{}, error) { - switch inputType := input.(type) { +func (p *Parser) convertType(input gjson.Result, desiredType string, name string) (interface{}, error) { + switch inputType := input.Value().(type) { case string: if desiredType != "string" { switch desiredType { @@ -537,7 +537,7 @@ func (p *Parser) convertType(input interface{}, desiredType string, name string) } return r, nil case "int": - r, err := strconv.Atoi(inputType) + r, err := strconv.ParseInt(inputType, 10, 64) if err != nil { return nil, fmt.Errorf("Unable to convert field '%s' to type int: %v", name, err) } @@ -579,9 +579,9 @@ func (p *Parser) convertType(input interface{}, desiredType string, name string) case "string": return fmt.Sprint(inputType), nil case "int": - return int64(inputType), nil + return input.Int(), nil case "uint": - return uint64(inputType), nil + return input.Uint(), nil case "bool": if inputType == 0 { return false, nil @@ -596,5 +596,5 @@ func (p *Parser) convertType(input interface{}, desiredType string, name string) return nil, fmt.Errorf("unknown format '%T' for field '%s'", inputType, name) } - return input, nil + return input.Value(), nil } diff --git a/plugins/parsers/json_v2/parser_test.go b/plugins/parsers/json_v2/parser_test.go index 50c981c4d51f9..9321d7256fada 100644 --- a/plugins/parsers/json_v2/parser_test.go +++ b/plugins/parsers/json_v2/parser_test.go @@ -77,6 +77,10 @@ func TestData(t *testing.T) { name: "Test field with null", test: "null", }, + { + name: "Test large numbers (int64, uin64, float64)", + test: "large_numbers", + }, } for _, tc := range tests { diff --git a/plugins/parsers/json_v2/testdata/large_numbers/expected.out b/plugins/parsers/json_v2/testdata/large_numbers/expected.out new file mode 100644 index 0000000000000..1edb0565f6313 --- /dev/null +++ b/plugins/parsers/json_v2/testdata/large_numbers/expected.out @@ -0,0 +1,3 @@ +file large=4294967296i,larger=9007199254740991i,largest=9223372036854775807i +file large=9007199254740991u,larger=9223372036854775807u,largest=18446744073709551615u +file large=4294967296,larger=4.294967296663e+09,largest=9007199254740991 diff --git a/plugins/parsers/json_v2/testdata/large_numbers/input.json b/plugins/parsers/json_v2/testdata/large_numbers/input.json new file mode 100644 index 0000000000000..a800d0cd0d4e5 --- /dev/null +++ b/plugins/parsers/json_v2/testdata/large_numbers/input.json @@ -0,0 +1,17 @@ +{ + "int": { + "large": 4294967296, + "larger": 9007199254740991, + "largest": 9223372036854775807 + }, + "uint": { + "large": 9007199254740991, + "larger": 9223372036854775807, + "largest": 18446744073709551615 + }, + "float": { + "large": 4294967296, + "larger": 4.294967296663e+09, + "largest": 9007199254740991 + } +} diff --git a/plugins/parsers/json_v2/testdata/large_numbers/telegraf.conf b/plugins/parsers/json_v2/testdata/large_numbers/telegraf.conf new file mode 100644 index 0000000000000..a0b9736a045a6 --- /dev/null +++ b/plugins/parsers/json_v2/testdata/large_numbers/telegraf.conf @@ -0,0 +1,22 @@ +[[inputs.file]] + files = ["./testdata/large_numbers/input.json"] + data_format = "json_v2" + [[inputs.file.json_v2]] + [[inputs.file.json_v2.object]] + path = "int" + [inputs.file.json_v2.object.fields] + large = "int" + larger = "int" + largest = "int" + [[inputs.file.json_v2.object]] + path = "uint" + [inputs.file.json_v2.object.fields] + large = "uint" + larger = "uint" + largest = "uint" + [[inputs.file.json_v2.object]] + path = "float" + [inputs.file.json_v2.object.fields] + large = "float" + larger = "float" + largest = "float" From 03ff37b393e4a3ed42f54047539d55322a37a9f8 Mon Sep 17 00:00:00 2001 From: Imran Ismail Date: Wed, 21 Jul 2021 05:08:29 +0800 Subject: [PATCH 39/85] Fix prometheus cadvisor authentication (#9497) (cherry picked from commit 8965291f294aa5d5b478ab30f19224beb5fe25a0) --- plugins/inputs/prometheus/kubernetes.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/prometheus/kubernetes.go b/plugins/inputs/prometheus/kubernetes.go index 7a85d88e2c59b..c1fb3828114bc 100644 --- a/plugins/inputs/prometheus/kubernetes.go +++ b/plugins/inputs/prometheus/kubernetes.go @@ -88,7 +88,7 @@ func (p *Prometheus) start(ctx context.Context) error { return case <-time.After(time.Second): if p.isNodeScrapeScope { - err = p.cAdvisor(ctx) + err = p.cAdvisor(ctx, config.BearerToken) if err != nil { p.Log.Errorf("Unable to monitor pods with node scrape scope: %s", err.Error()) } @@ -145,10 +145,13 @@ func (p *Prometheus) watchPod(ctx context.Context, client *kubernetes.Clientset) return nil } -func (p *Prometheus) cAdvisor(ctx context.Context) error { +func (p *Prometheus) cAdvisor(ctx context.Context, bearerToken string) error { // The request will be the same each time podsURL := fmt.Sprintf("https://%s:10250/pods", p.NodeIP) req, err := http.NewRequest("GET", podsURL, nil) + req.Header.Set("Authorization", "Bearer "+bearerToken) + req.Header.Add("Accept", "application/json") + if err != nil { return fmt.Errorf("error when creating request to %s to get pod list: %w", podsURL, err) } From d74a17b35d7e00ec59b0ba4a23734f0da49e0c18 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Wed, 21 Jul 2021 10:53:23 -0400 Subject: [PATCH 40/85] [output dynatrace] Initialize loggedMetrics map (#9491) (cherry picked from commit 403ce477c1f494edaf5d57e848aa9e89b95f6f71) --- plugins/outputs/dynatrace/dynatrace.go | 28 ++++++--- plugins/outputs/dynatrace/dynatrace_test.go | 70 +++++++++++++++++++++ 2 files changed, 89 insertions(+), 9 deletions(-) diff --git a/plugins/outputs/dynatrace/dynatrace.go b/plugins/outputs/dynatrace/dynatrace.go index fd012d0e1c6f5..f9a00b4b02b2b 100644 --- a/plugins/outputs/dynatrace/dynatrace.go +++ b/plugins/outputs/dynatrace/dynatrace.go @@ -200,17 +200,18 @@ func (d *Dynatrace) send(msg string) error { } defer resp.Body.Close() - // print metric line results as info log - if resp.StatusCode == http.StatusOK || resp.StatusCode == http.StatusAccepted || resp.StatusCode == http.StatusBadRequest { - bodyBytes, err := ioutil.ReadAll(resp.Body) - if err != nil { - d.Log.Errorf("Dynatrace error reading response") - } - bodyString := string(bodyBytes) - d.Log.Debugf("Dynatrace returned: %s", bodyString) - } else { + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusAccepted && resp.StatusCode != http.StatusBadRequest { return fmt.Errorf("request failed with response code:, %d", resp.StatusCode) } + + // print metric line results as info log + bodyBytes, err := ioutil.ReadAll(resp.Body) + if err != nil { + d.Log.Errorf("Dynatrace error reading response") + } + bodyString := string(bodyBytes) + d.Log.Debugf("Dynatrace returned: %s", bodyString) + return nil } @@ -236,6 +237,15 @@ func (d *Dynatrace) Init() error { }, Timeout: time.Duration(d.Timeout), } + + dims := []dimensions.Dimension{} + for key, value := range d.DefaultDimensions { + dims = append(dims, dimensions.NewDimension(key, value)) + } + d.normalizedDefaultDimensions = dimensions.NewNormalizedDimensionList(dims...) + d.normalizedStaticDimensions = dimensions.NewNormalizedDimensionList(dimensions.NewDimension("dt.metrics.source", "telegraf")) + d.loggedMetrics = make(map[string]bool) + return nil } diff --git a/plugins/outputs/dynatrace/dynatrace_test.go b/plugins/outputs/dynatrace/dynatrace_test.go index ae0e3390fa557..fc0f58107896f 100644 --- a/plugins/outputs/dynatrace/dynatrace_test.go +++ b/plugins/outputs/dynatrace/dynatrace_test.go @@ -379,3 +379,73 @@ func TestSendCounterMetricWithoutTags(t *testing.T) { err = d.Write(metrics) require.NoError(t, err) } + +var warnfCalledTimes int + +type loggerStub struct { + testutil.Logger +} + +func (l loggerStub) Warnf(format string, args ...interface{}) { + warnfCalledTimes++ +} + +func TestSendUnsupportedMetric(t *testing.T) { + warnfCalledTimes = 0 + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + t.Fatal("should not export because the only metric is an invalid type") + })) + defer ts.Close() + + d := &Dynatrace{} + + logStub := loggerStub{} + + d.URL = ts.URL + d.APIToken = "123" + d.Log = logStub + err := d.Init() + require.NoError(t, err) + err = d.Connect() + require.NoError(t, err) + + // Init metrics + + m1 := metric.New( + "mymeasurement", + map[string]string{}, + map[string]interface{}{"metric1": "unsupported_type"}, + time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC), + ) + + metrics := []telegraf.Metric{m1} + + err = d.Write(metrics) + require.NoError(t, err) + // Warnf called for invalid export + require.Equal(t, 1, warnfCalledTimes) + + err = d.Write(metrics) + require.NoError(t, err) + // Warnf skipped for more invalid exports with the same name + require.Equal(t, 1, warnfCalledTimes) + + m2 := metric.New( + "mymeasurement", + map[string]string{}, + map[string]interface{}{"metric2": "unsupported_type"}, + time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC), + ) + + metrics = []telegraf.Metric{m2} + + err = d.Write(metrics) + require.NoError(t, err) + // Warnf called again for invalid export with a new metric name + require.Equal(t, 2, warnfCalledTimes) + + err = d.Write(metrics) + require.NoError(t, err) + // Warnf skipped for more invalid exports with the same name + require.Equal(t, 2, warnfCalledTimes) +} From 32a3881aaeda07a4534745706410afc93025ce8d Mon Sep 17 00:00:00 2001 From: Alexander Krantz Date: Thu, 22 Jul 2021 13:50:23 -0700 Subject: [PATCH 41/85] Switch MongoDB libraries (#9493) (cherry picked from commit cae338814bc9296fd07a844f2a59619d17be6dfd) --- docs/LICENSE_OF_DEPENDENCIES.md | 6 +- go.mod | 15 +- go.sum | 41 +++-- plugins/inputs/mongodb/mongodb.go | 168 ++++++++---------- plugins/inputs/mongodb/mongodb_server.go | 107 +++++++---- plugins/inputs/mongodb/mongodb_server_test.go | 6 +- plugins/inputs/mongodb/mongodb_test.go | 55 ++---- plugins/inputs/mongodb/mongostat.go | 61 ++++--- 8 files changed, 243 insertions(+), 216 deletions(-) diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index aa8d9b857a72b..08b92d486a306 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -207,9 +207,14 @@ following works: - github.com/wavefronthq/wavefront-sdk-go [Apache License 2.0](https://github.com/wavefrontHQ/wavefront-sdk-go/blob/master/LICENSE) - github.com/wvanbergen/kafka [MIT License](https://github.com/wvanbergen/kafka/blob/master/LICENSE) - github.com/wvanbergen/kazoo-go [MIT License](https://github.com/wvanbergen/kazoo-go/blob/master/MIT-LICENSE) +- github.com/xdg-go/pbkdf2 [Apache License 2.0](https://github.com/xdg-go/pbkdf2/blob/main/LICENSE) +- github.com/xdg-go/scram [Apache License 2.0](https://github.com/xdg-go/scram/blob/master/LICENSE) +- github.com/xdg-go/stringprep [Apache License 2.0](https://github.com/xdg-go/stringprep/blob/master/LICENSE) - github.com/xdg/scram [Apache License 2.0](https://github.com/xdg-go/scram/blob/master/LICENSE) - github.com/xdg/stringprep [Apache License 2.0](https://github.com/xdg-go/stringprep/blob/master/LICENSE) +- github.com/youmark/pkcs8 [MIT License](https://github.com/youmark/pkcs8/blob/master/LICENSE) - github.com/yuin/gopher-lua [MIT License](https://github.com/yuin/gopher-lua/blob/master/LICENSE) +- go.mongodb.org/mongo-driver [Apache License 2.0](https://github.com/mongodb/mongo-go-driver/blob/master/LICENSE) - go.opencensus.io [Apache License 2.0](https://github.com/census-instrumentation/opencensus-go/blob/master/LICENSE) - go.starlark.net [BSD 3-Clause "New" or "Revised" License](https://github.com/google/starlark-go/blob/master/LICENSE) - go.uber.org/atomic [MIT License](https://pkg.go.dev/go.uber.org/atomic?tab=licenses) @@ -241,7 +246,6 @@ following works: - gopkg.in/jcmturner/gokrb5.v7 [Apache License 2.0](https://github.com/jcmturner/gokrb5/tree/v7.5.0/LICENSE) - gopkg.in/jcmturner/rpc.v1 [Apache License 2.0](https://github.com/jcmturner/rpc/blob/v1.1.0/LICENSE) - gopkg.in/ldap.v3 [MIT License](https://github.com/go-ldap/ldap/blob/v3.1.7/LICENSE) -- gopkg.in/mgo.v2 [BSD 2-Clause "Simplified" License](https://github.com/go-mgo/mgo/blob/v2/LICENSE) - gopkg.in/olivere/elastic.v5 [MIT License](https://github.com/olivere/elastic/blob/v5.0.76/LICENSE) - gopkg.in/tomb.v1 [BSD 3-Clause Clear License](https://github.com/go-tomb/tomb/blob/v1/LICENSE) - gopkg.in/tomb.v2 [BSD 3-Clause Clear License](https://github.com/go-tomb/tomb/blob/v2/LICENSE) diff --git a/go.mod b/go.mod index ed438a746f2ac..6543bd15f7305 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/apache/thrift v0.13.0 github.com/aristanetworks/glog v0.0.0-20191112221043-67e8567f59f3 // indirect github.com/aristanetworks/goarista v0.0.0-20190325233358-a123909ec740 - github.com/aws/aws-sdk-go v1.34.34 + github.com/aws/aws-sdk-go v1.38.69 github.com/aws/aws-sdk-go-v2 v1.3.2 github.com/aws/aws-sdk-go-v2/config v1.1.5 github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.6 @@ -60,7 +60,7 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golang/geo v0.0.0-20190916061304-5b978397cfec github.com/golang/protobuf v1.5.1 - github.com/golang/snappy v0.0.1 + github.com/golang/snappy v0.0.3 github.com/google/go-cmp v0.5.5 github.com/google/go-github/v32 v32.1.0 github.com/gopcua/opcua v0.1.13 @@ -86,6 +86,7 @@ require ( github.com/kardianos/service v1.0.0 github.com/karrick/godirwalk v1.16.1 github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 + github.com/klauspost/compress v1.13.1 // indirect github.com/lib/pq v1.3.0 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 github.com/mdlayher/apcupsd v0.0.0-20200608131503-2bf01da7bf1b @@ -128,14 +129,17 @@ require ( github.com/wvanbergen/kafka v0.0.0-20171203153745-e2edea948ddf github.com/wvanbergen/kazoo-go v0.0.0-20180202103751-f72d8611297a // indirect github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c + github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect github.com/yuin/gopher-lua v0.0.0-20180630135845-46796da1b0b4 // indirect + go.mongodb.org/mongo-driver v1.5.3 go.starlark.net v0.0.0-20210406145628-7a1108eaa012 go.uber.org/multierr v1.6.0 // indirect + golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d - golang.org/x/sync v0.0.0-20201207232520-09787c993a3a - golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 - golang.org/x/text v0.3.4 + golang.org/x/sync v0.0.0-20210220032951-036812b2e83c + golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 + golang.org/x/text v0.3.6 golang.org/x/tools v0.1.0 golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4 google.golang.org/api v0.29.0 @@ -145,7 +149,6 @@ require ( gopkg.in/fatih/pool.v2 v2.0.0 // indirect gopkg.in/gorethink/gorethink.v3 v3.0.5 gopkg.in/ldap.v3 v3.1.0 - gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 gopkg.in/olivere/elastic.v5 v5.0.70 gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 gopkg.in/yaml.v2 v2.4.0 diff --git a/go.sum b/go.sum index 33229bdbd04f4..c3812473b5d3f 100644 --- a/go.sum +++ b/go.sum @@ -206,8 +206,9 @@ github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQ github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.34.9/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= -github.com/aws/aws-sdk-go v1.34.34 h1:5dC0ZU0xy25+UavGNEkQ/5MOQwxXDA2YXtjCL1HfYKI= -github.com/aws/aws-sdk-go v1.34.34/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= +github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= +github.com/aws/aws-sdk-go v1.38.69 h1:V489lmrdkIQSfF6OAGZZ1Cavcm7eczCm2JcGvX+yHRg= +github.com/aws/aws-sdk-go v1.38.69/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.1.0/go.mod h1:smfAbmpW+tcRVuNUjo3MOArSZmW72t62rkCzc2i0TWM= github.com/aws/aws-sdk-go-v2 v1.3.2 h1:RQj8l98yKUm0UV2Wd3w/Ms+TXV9Rs1E6Kr5tRRMfyU4= @@ -699,8 +700,9 @@ github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaS github.com/golang/protobuf v1.5.1 h1:jAbXjIeW2ZSW2AwFxlGTDoc2CjI2XujLkV3ArsZFCvc= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= +github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/addlicense v0.0.0-20190510175307-22550fa7c1b0/go.mod h1:QtPG26W17m+OIQgE6gQ24gC1M6pUaMBAbFrTIDtwG/E= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= @@ -976,8 +978,10 @@ github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.9.5/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.11.0/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.12 h1:famVnQVu7QwryBN4jNseQdUKES71ZAOnB6UQQJPZvqk= github.com/klauspost/compress v1.11.12/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.11.12/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.1 h1:wXr2uRxZTJXHLly6qhJabee5JqIhTRoLBhDOA74hDEQ= +github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= @@ -1230,6 +1234,7 @@ github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChl github.com/pavius/impi v0.0.0-20180302134524-c1cbdcb8df2b/go.mod h1:x/hU0bfdWIhuOT1SKwiJg++yvkk6EuOtJk8WtDZqgr8= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= @@ -1468,6 +1473,12 @@ github.com/wvanbergen/kafka v0.0.0-20171203153745-e2edea948ddf h1:TOV5PC6fIWwFOF github.com/wvanbergen/kafka v0.0.0-20171203153745-e2edea948ddf/go.mod h1:nxx7XRXbR9ykhnC8lXqQyJS0rfvJGxKyKw/sT1YOttg= github.com/wvanbergen/kazoo-go v0.0.0-20180202103751-f72d8611297a h1:ILoU84rj4AQ3q6cjQvtb9jBjx4xzR/Riq/zYhmDQiOk= github.com/wvanbergen/kazoo-go v0.0.0-20180202103751-f72d8611297a/go.mod h1:vQQATAGxVK20DC1rRubTJbZDDhhpA4QfU02pMdPxGO4= +github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2 h1:6iq84/ryjjeRmMJwxutI51F2GIPlP5BfTvXHeYjyhBc= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c h1:u40Z8hqBAAQyv+vATcGgV0YCnDjqSL7/q/JyPhhJSPk= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= @@ -1479,6 +1490,9 @@ github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xlab/treeprint v1.0.0/go.mod h1:IoImgRak9i3zJyuxOKUP1v4UZd1tMoKkq/Cimt1uhCg= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= +github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a h1:fZHgsYlfvtyqToslyjUt3VOPF4J7aK/3MPcK7xp3PDk= +github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/R083muKhosV54bj5niojjWZvU8xrevuH4= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1499,6 +1513,8 @@ go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qL go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= go.mongodb.org/mongo-driver v1.3.2/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= +go.mongodb.org/mongo-driver v1.5.3 h1:wWbFB6zaGHpzguF3f7tW94sVE8sFl3lHx8OZx/4OuFI= +go.mongodb.org/mongo-driver v1.5.3/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= go.mozilla.org/pkcs7 v0.0.0-20200128120323-432b2356ecb1/go.mod h1:SNgMg+EgDFwmvSmLRTNKC5fegJjB7v23qTQ0XLGUNHk= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1548,6 +1564,7 @@ golang.org/x/crypto v0.0.0-20191202143827-86a70503ff7e/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200204104054-c9f3fb736b72/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1555,8 +1572,10 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc= +golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI= +golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -1665,8 +1684,9 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1767,8 +1787,8 @@ golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887 h1:dXfMednGJh/SUUFjTLsWJz3P+TQt9qnR11GgeI3vWKs= -golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -1778,8 +1798,10 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.4 h1:0YWbFKbhXG/wIiuHDSKpS0Iy7FSA+u45VtBMfQcFTTc= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -2001,7 +2023,6 @@ gopkg.in/jcmturner/rpc.v1 v1.1.0 h1:QHIUxTX1ISuAv9dD2wJ9HWQVuWDX/Zc0PfeC2tjc4rU= gopkg.in/jcmturner/rpc.v1 v1.1.0/go.mod h1:YIdkC4XfD6GXbzje11McwsDuOlZQSb9W4vfLvuNnlv8= gopkg.in/ldap.v3 v3.1.0 h1:DIDWEjI7vQWREh0S8X5/NFPCZ3MCVd55LmXKPW4XLGE= gopkg.in/ldap.v3 v3.1.0/go.mod h1:dQjCc0R0kfyFjIlWNMH1DORwUASZyDxo2Ry1B51dXaQ= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/olivere/elastic.v5 v5.0.70 h1:DqFG2Odzs74JCz6SssgJjd6qpGnsOAzNc7+l5EnvsnE= diff --git a/plugins/inputs/mongodb/mongodb.go b/plugins/inputs/mongodb/mongodb.go index 82a1b75c4e4fb..0366636200064 100644 --- a/plugins/inputs/mongodb/mongodb.go +++ b/plugins/inputs/mongodb/mongodb.go @@ -1,10 +1,10 @@ package mongodb import ( + "context" "crypto/tls" "crypto/x509" "fmt" - "net" "net/url" "strings" "sync" @@ -13,13 +13,14 @@ import ( "github.com/influxdata/telegraf" tlsint "github.com/influxdata/telegraf/plugins/common/tls" "github.com/influxdata/telegraf/plugins/inputs" - "gopkg.in/mgo.v2" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/mongo/readpref" ) type MongoDB struct { Servers []string Ssl Ssl - mongos map[string]*Server GatherClusterStatus bool GatherPerdbStats bool GatherColStats bool @@ -27,7 +28,9 @@ type MongoDB struct { ColStatsDbs []string tlsint.ClientConfig - Log telegraf.Logger + Log telegraf.Logger `toml:"-"` + + clients []*Server } type Ssl struct { @@ -78,118 +81,103 @@ func (*MongoDB) Description() string { return "Read metrics from one or many MongoDB servers" } -var localhost = &url.URL{Host: "mongodb://127.0.0.1:27017"} +func (m *MongoDB) Init() error { + var tlsConfig *tls.Config + if m.Ssl.Enabled { + // Deprecated TLS config + tlsConfig = &tls.Config{ + InsecureSkipVerify: m.ClientConfig.InsecureSkipVerify, + } + if len(m.Ssl.CaCerts) == 0 { + return fmt.Errorf("you must explicitly set insecure_skip_verify to skip cerificate validation") + } + + roots := x509.NewCertPool() + for _, caCert := range m.Ssl.CaCerts { + if ok := roots.AppendCertsFromPEM([]byte(caCert)); !ok { + return fmt.Errorf("failed to parse root certificate") + } + } + tlsConfig.RootCAs = roots + } else { + var err error + tlsConfig, err = m.ClientConfig.TLSConfig() + if err != nil { + return err + } + } -// Reads stats from all configured servers accumulates stats. -// Returns one of the errors encountered while gather stats (if any). -func (m *MongoDB) Gather(acc telegraf.Accumulator) error { if len(m.Servers) == 0 { - return m.gatherServer(m.getMongoServer(localhost), acc) + m.Servers = []string{"mongodb://127.0.0.1:27017"} } - var wg sync.WaitGroup - for i, serv := range m.Servers { - if !strings.HasPrefix(serv, "mongodb://") { + for _, connURL := range m.Servers { + if !strings.HasPrefix(connURL, "mongodb://") && !strings.HasPrefix(connURL, "mongodb+srv://") { // Preserve backwards compatibility for hostnames without a // scheme, broken in go 1.8. Remove in Telegraf 2.0 - serv = "mongodb://" + serv - m.Log.Warnf("Using %q as connection URL; please update your configuration to use an URL", serv) - m.Servers[i] = serv + connURL = "mongodb://" + connURL + m.Log.Warnf("Using %q as connection URL; please update your configuration to use an URL", connURL) } - u, err := url.Parse(serv) + u, err := url.Parse(connURL) if err != nil { - m.Log.Errorf("Unable to parse address %q: %s", serv, err.Error()) - continue - } - if u.Host == "" { - m.Log.Errorf("Unable to parse address %q", serv) - continue + return fmt.Errorf("unable to parse connection URL: %q", err) } - wg.Add(1) - go func(srv *Server) { - defer wg.Done() - err := m.gatherServer(srv, acc) - if err != nil { - m.Log.Errorf("Error in plugin: %v", err) - } - }(m.getMongoServer(u)) - } + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() //nolint:revive - wg.Wait() - return nil -} - -func (m *MongoDB) getMongoServer(url *url.URL) *Server { - if _, ok := m.mongos[url.Host]; !ok { - m.mongos[url.Host] = &Server{ - Log: m.Log, - URL: url, + opts := options.Client().ApplyURI(connURL) + if tlsConfig != nil { + opts.TLSConfig = tlsConfig } - } - return m.mongos[url.Host] -} - -func (m *MongoDB) gatherServer(server *Server, acc telegraf.Accumulator) error { - if server.Session == nil { - var dialAddrs []string - if server.URL.User != nil { - dialAddrs = []string{server.URL.String()} - } else { - dialAddrs = []string{server.URL.Host} + if opts.ReadPreference == nil { + opts.ReadPreference = readpref.Nearest() } - dialInfo, err := mgo.ParseURL(dialAddrs[0]) + + client, err := mongo.Connect(ctx, opts) if err != nil { - return fmt.Errorf("unable to parse URL %q: %s", dialAddrs[0], err.Error()) - } - dialInfo.Direct = true - dialInfo.Timeout = 5 * time.Second - - var tlsConfig *tls.Config - - if m.Ssl.Enabled { - // Deprecated TLS config - tlsConfig = &tls.Config{} - if len(m.Ssl.CaCerts) > 0 { - roots := x509.NewCertPool() - for _, caCert := range m.Ssl.CaCerts { - ok := roots.AppendCertsFromPEM([]byte(caCert)) - if !ok { - return fmt.Errorf("failed to parse root certificate") - } - } - tlsConfig.RootCAs = roots - } else { - tlsConfig.InsecureSkipVerify = true - } - } else { - tlsConfig, err = m.ClientConfig.TLSConfig() - if err != nil { - return err - } + return fmt.Errorf("unable to connect to MongoDB: %q", err) } - // If configured to use TLS, add a dial function - if tlsConfig != nil { - dialInfo.DialServer = func(addr *mgo.ServerAddr) (net.Conn, error) { - return tls.Dial("tcp", addr.String(), tlsConfig) - } + err = client.Ping(ctx, opts.ReadPreference) + if err != nil { + return fmt.Errorf("unable to connect to MongoDB: %s", err) } - sess, err := mgo.DialWithInfo(dialInfo) - if err != nil { - return fmt.Errorf("unable to connect to MongoDB: %s", err.Error()) + server := &Server{ + client: client, + hostname: u.Host, + Log: m.Log, } - server.Session = sess + m.clients = append(m.clients, server) } - return server.gatherData(acc, m.GatherClusterStatus, m.GatherPerdbStats, m.GatherColStats, m.GatherTopStat, m.ColStatsDbs) + + return nil +} + +// Reads stats from all configured servers accumulates stats. +// Returns one of the errors encountered while gather stats (if any). +func (m *MongoDB) Gather(acc telegraf.Accumulator) error { + var wg sync.WaitGroup + for _, client := range m.clients { + wg.Add(1) + go func(srv *Server) { + defer wg.Done() + err := srv.gatherData(acc, m.GatherClusterStatus, m.GatherPerdbStats, m.GatherColStats, m.GatherTopStat, m.ColStatsDbs) + if err != nil { + m.Log.Errorf("failed to gather data: %q", err) + } + }(client) + } + + wg.Wait() + return nil } func init() { inputs.Add("mongodb", func() telegraf.Input { return &MongoDB{ - mongos: make(map[string]*Server), GatherClusterStatus: true, GatherPerdbStats: false, GatherColStats: false, diff --git a/plugins/inputs/mongodb/mongodb_server.go b/plugins/inputs/mongodb/mongodb_server.go index e362a0bd7f008..723b0698b9ac8 100644 --- a/plugins/inputs/mongodb/mongodb_server.go +++ b/plugins/inputs/mongodb/mongodb_server.go @@ -1,19 +1,22 @@ package mongodb import ( + "context" "fmt" - "net/url" + "go.mongodb.org/mongo-driver/bson/primitive" "strings" "time" "github.com/influxdata/telegraf" - "gopkg.in/mgo.v2" - "gopkg.in/mgo.v2/bson" + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" + "go.mongodb.org/mongo-driver/x/bsonx" ) type Server struct { - URL *url.URL - Session *mgo.Session + client *mongo.Client + hostname string lastResult *MongoStatus Log telegraf.Logger @@ -21,12 +24,12 @@ type Server struct { func (s *Server) getDefaultTags() map[string]string { tags := make(map[string]string) - tags["hostname"] = s.URL.Host + tags["hostname"] = s.hostname return tags } type oplogEntry struct { - Timestamp bson.MongoTimestamp `bson:"ts"` + Timestamp primitive.Timestamp `bson:"ts"` } func IsAuthorization(err error) bool { @@ -41,15 +44,23 @@ func (s *Server) authLog(err error) { } } +func (s *Server) runCommand(database string, cmd interface{}, result interface{}) error { + r := s.client.Database(database).RunCommand(context.Background(), cmd) + if r.Err() != nil { + return r.Err() + } + return r.Decode(result) +} + func (s *Server) gatherServerStatus() (*ServerStatus, error) { serverStatus := &ServerStatus{} - err := s.Session.DB("admin").Run(bson.D{ + err := s.runCommand("admin", bson.D{ { - Name: "serverStatus", + Key: "serverStatus", Value: 1, }, { - Name: "recordStats", + Key: "recordStats", Value: 0, }, }, serverStatus) @@ -61,9 +72,9 @@ func (s *Server) gatherServerStatus() (*ServerStatus, error) { func (s *Server) gatherReplSetStatus() (*ReplSetStatus, error) { replSetStatus := &ReplSetStatus{} - err := s.Session.DB("admin").Run(bson.D{ + err := s.runCommand("admin", bson.D{ { - Name: "replSetGetStatus", + Key: "replSetGetStatus", Value: 1, }, }, replSetStatus) @@ -74,35 +85,52 @@ func (s *Server) gatherReplSetStatus() (*ReplSetStatus, error) { } func (s *Server) gatherTopStatData() (*TopStats, error) { - topStats := &TopStats{} - err := s.Session.DB("admin").Run(bson.D{ + dest := &bsonx.Doc{} + err := s.runCommand("admin", bson.D{ { - Name: "top", + Key: "top", Value: 1, }, - }, topStats) + }, dest) + if err != nil { + return nil, err + } + + // From: https://github.com/mongodb/mongo-tools/blob/master/mongotop/mongotop.go#L49-L70 + // Remove 'note' field that prevents easy decoding, then round-trip + // again to simplify unpacking into the nested data structure + totals, err := dest.LookupErr("totals") + if err != nil { + return nil, err + } + recoded, err := totals.Document().Delete("note").MarshalBSON() if err != nil { return nil, err } - return topStats, nil + topInfo := make(map[string]TopStatCollection) + if err := bson.Unmarshal(recoded, &topInfo); err != nil { + return nil, err + } + + return &TopStats{Totals: topInfo}, nil } func (s *Server) gatherClusterStatus() (*ClusterStatus, error) { - chunkCount, err := s.Session.DB("config").C("chunks").Find(bson.M{"jumbo": true}).Count() + chunkCount, err := s.client.Database("config").Collection("chunks").CountDocuments(context.Background(), bson.M{"jumbo": true}) if err != nil { return nil, err } return &ClusterStatus{ - JumboChunksCount: int64(chunkCount), + JumboChunksCount: chunkCount, }, nil } func (s *Server) gatherShardConnPoolStats() (*ShardStats, error) { shardStats := &ShardStats{} - err := s.Session.DB("admin").Run(bson.D{ + err := s.runCommand("admin", bson.D{ { - Name: "shardConnPoolStats", + Key: "shardConnPoolStats", Value: 1, }, }, &shardStats) @@ -114,9 +142,9 @@ func (s *Server) gatherShardConnPoolStats() (*ShardStats, error) { func (s *Server) gatherDBStats(name string) (*Db, error) { stats := &DbStatsData{} - err := s.Session.DB(name).Run(bson.D{ + err := s.runCommand(name, bson.D{ { - Name: "dbStats", + Key: "dbStats", Value: 1, }, }, stats) @@ -134,19 +162,25 @@ func (s *Server) getOplogReplLag(collection string) (*OplogStats, error) { query := bson.M{"ts": bson.M{"$exists": true}} var first oplogEntry - err := s.Session.DB("local").C(collection).Find(query).Sort("$natural").Limit(1).One(&first) - if err != nil { + firstResult := s.client.Database("local").Collection(collection).FindOne(context.Background(), query, options.FindOne().SetSort(bson.M{"$natural": 1})) + if firstResult.Err() != nil { + return nil, firstResult.Err() + } + if err := firstResult.Decode(&first); err != nil { return nil, err } var last oplogEntry - err = s.Session.DB("local").C(collection).Find(query).Sort("-$natural").Limit(1).One(&last) - if err != nil { + lastResult := s.client.Database("local").Collection(collection).FindOne(context.Background(), query, options.FindOne().SetSort(bson.M{"$natural": -1})) + if lastResult.Err() != nil { + return nil, lastResult.Err() + } + if err := lastResult.Decode(&last); err != nil { return nil, err } - firstTime := time.Unix(int64(first.Timestamp>>32), 0) - lastTime := time.Unix(int64(last.Timestamp>>32), 0) + firstTime := time.Unix(int64(first.Timestamp.T), 0) + lastTime := time.Unix(int64(last.Timestamp.T), 0) stats := &OplogStats{ TimeDiff: int64(lastTime.Sub(firstTime).Seconds()), } @@ -168,7 +202,7 @@ func (s *Server) gatherOplogStats() (*OplogStats, error) { } func (s *Server) gatherCollectionStats(colStatsDbs []string) (*ColStats, error) { - names, err := s.Session.DatabaseNames() + names, err := s.client.ListDatabaseNames(context.Background(), bson.D{}) if err != nil { return nil, err } @@ -177,16 +211,16 @@ func (s *Server) gatherCollectionStats(colStatsDbs []string) (*ColStats, error) for _, dbName := range names { if stringInSlice(dbName, colStatsDbs) || len(colStatsDbs) == 0 { var colls []string - colls, err = s.Session.DB(dbName).CollectionNames() + colls, err = s.client.Database(dbName).ListCollectionNames(context.Background(), bson.D{}) if err != nil { s.Log.Errorf("Error getting collection names: %s", err.Error()) continue } for _, colName := range colls { colStatLine := &ColStatsData{} - err = s.Session.DB(dbName).Run(bson.D{ + err = s.runCommand(dbName, bson.D{ { - Name: "collStats", + Key: "collStats", Value: colName, }, }, colStatLine) @@ -207,9 +241,6 @@ func (s *Server) gatherCollectionStats(colStatsDbs []string) (*ColStats, error) } func (s *Server) gatherData(acc telegraf.Accumulator, gatherClusterStatus bool, gatherDbStats bool, gatherColStats bool, gatherTopStat bool, colStatsDbs []string) error { - s.Session.SetMode(mgo.Eventual, true) - s.Session.SetSocketTimeout(0) - serverStatus, err := s.gatherServerStatus() if err != nil { return err @@ -257,7 +288,7 @@ func (s *Server) gatherData(acc telegraf.Accumulator, gatherClusterStatus bool, dbStats := &DbStats{} if gatherDbStats { - names, err := s.Session.DatabaseNames() + names, err := s.client.ListDatabaseNames(context.Background(), bson.D{}) if err != nil { return err } @@ -300,7 +331,7 @@ func (s *Server) gatherData(acc telegraf.Accumulator, gatherClusterStatus bool, durationInSeconds = 1 } data := NewMongodbData( - NewStatLine(*s.lastResult, *result, s.URL.Host, true, durationInSeconds), + NewStatLine(*s.lastResult, *result, s.hostname, true, durationInSeconds), s.getDefaultTags(), ) data.AddDefaultStats() diff --git a/plugins/inputs/mongodb/mongodb_server_test.go b/plugins/inputs/mongodb/mongodb_server_test.go index 463d7af1b1f65..2cf58689a6eab 100644 --- a/plugins/inputs/mongodb/mongodb_server_test.go +++ b/plugins/inputs/mongodb/mongodb_server_test.go @@ -15,7 +15,7 @@ func TestGetDefaultTags(t *testing.T) { in string out string }{ - {"hostname", server.Url.Host}, + {"hostname", server.hostname}, } defaultTags := server.getDefaultTags() for _, tt := range tagTests { @@ -28,11 +28,11 @@ func TestGetDefaultTags(t *testing.T) { func TestAddDefaultStats(t *testing.T) { var acc testutil.Accumulator - err := server.gatherData(&acc, false) + err := server.gatherData(&acc, false, true, true, true, []string{"local"}) require.NoError(t, err) // need to call this twice so it can perform the diff - err = server.gatherData(&acc, false) + err = server.gatherData(&acc, false, true, true, true, []string{"local"}) require.NoError(t, err) for key := range defaultStats { diff --git a/plugins/inputs/mongodb/mongodb_test.go b/plugins/inputs/mongodb/mongodb_test.go index cd3b741e250d8..9484118dd19ab 100644 --- a/plugins/inputs/mongodb/mongodb_test.go +++ b/plugins/inputs/mongodb/mongodb_test.go @@ -3,60 +3,41 @@ package mongodb import ( + "context" "log" "math/rand" - "net/url" "os" "testing" "time" - "gopkg.in/mgo.v2" + "github.com/influxdata/telegraf/testutil" ) -var connect_url string var server *Server -func init() { - connect_url = os.Getenv("MONGODB_URL") - if connect_url == "" { - connect_url = "127.0.0.1:27017" - server = &Server{URL: &url.URL{Host: connect_url}} - } else { - full_url, err := url.Parse(connect_url) - if err != nil { - log.Fatalf("Unable to parse URL (%s), %s\n", full_url, err.Error()) - } - server = &Server{URL: full_url} +func testSetup(_ *testing.M) { + connectionString := os.Getenv("MONGODB_URL") + if connectionString == "" { + connectionString = "mongodb://127.0.0.1:27017" } -} -func testSetup(m *testing.M) { - var err error - var dialAddrs []string - if server.URL.User != nil { - dialAddrs = []string{server.URL.String()} - } else { - dialAddrs = []string{server.URL.Host} - } - dialInfo, err := mgo.ParseURL(dialAddrs[0]) - if err != nil { - log.Fatalf("Unable to parse URL (%s), %s\n", dialAddrs[0], err.Error()) - } - dialInfo.Direct = true - dialInfo.Timeout = 5 * time.Second - sess, err := mgo.DialWithInfo(dialInfo) - if err != nil { - log.Fatalf("Unable to connect to MongoDB, %s\n", err.Error()) + m := &MongoDB{ + Log: testutil.Logger{}, + Servers: []string{connectionString}, } - server.Session = sess - server.Session, _ = mgo.Dial(server.URL.Host) + err := m.Init() if err != nil { - log.Fatalln(err.Error()) + log.Fatalf("Failed to connect to MongoDB: %v", err) } + + server = m.clients[0] } -func testTeardown(m *testing.M) { - server.Session.Close() +func testTeardown(_ *testing.M) { + err := server.client.Disconnect(context.Background()) + if err != nil { + log.Fatalf("failed to disconnect: %v", err) + } } func TestMain(m *testing.M) { diff --git a/plugins/inputs/mongodb/mongostat.go b/plugins/inputs/mongodb/mongostat.go index c4cfa45c5c0e7..41f735d389c7a 100644 --- a/plugins/inputs/mongodb/mongostat.go +++ b/plugins/inputs/mongodb/mongostat.go @@ -41,6 +41,8 @@ type MongoStatus struct { } type ServerStatus struct { + SampleTime time.Time `bson:""` + Flattened map[string]interface{} `bson:""` Host string `bson:"host"` Version string `bson:"version"` Process string `bson:"process"` @@ -64,7 +66,7 @@ type ServerStatus struct { Mem *MemStats `bson:"mem"` Repl *ReplStatus `bson:"repl"` ShardCursorType map[string]interface{} `bson:"shardCursorType"` - StorageEngine map[string]string `bson:"storageEngine"` + StorageEngine *StorageEngine `bson:"storageEngine"` WiredTiger *WiredTiger `bson:"wiredTiger"` Metrics *MetricsStats `bson:"metrics"` TCMallocStats *TCMallocStats `bson:"tcmalloc"` @@ -171,11 +173,7 @@ type ShardHostStatsData struct { } type TopStats struct { - Totals map[string]TopStatCollections `bson:"totals"` -} - -type TopStatCollections struct { - TSCollection TopStatCollection `bson:",inline"` + Totals map[string]TopStatCollection `bson:"totals"` } type TopStatCollection struct { @@ -238,6 +236,10 @@ type CacheStats struct { UnmodifiedPagesEvicted int64 `bson:"unmodified pages evicted"` } +type StorageEngine struct { + Name string `bson:"name"` +} + // TransactionStats stores transaction checkpoints in WiredTiger. type TransactionStats struct { TransCheckpointsTotalTimeMsecs int64 `bson:"transaction checkpoint total time (msecs)"` @@ -246,7 +248,7 @@ type TransactionStats struct { // ReplStatus stores data related to replica sets. type ReplStatus struct { - SetName interface{} `bson:"setName"` + SetName string `bson:"setName"` IsMaster interface{} `bson:"ismaster"` Secondary interface{} `bson:"secondary"` IsReplicaSet interface{} `bson:"isreplicaset"` @@ -932,8 +934,8 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec returnVal.TotalCreatedC = newStat.Connections.TotalCreated // set the storage engine appropriately - if newStat.StorageEngine != nil && newStat.StorageEngine["name"] != "" { - returnVal.StorageEngine = newStat.StorageEngine["name"] + if newStat.StorageEngine != nil && newStat.StorageEngine.Name != "" { + returnVal.StorageEngine = newStat.StorageEngine.Name } else { returnVal.StorageEngine = "mmapv1" } @@ -1159,10 +1161,7 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec } if newStat.Repl != nil { - setName, isReplSet := newStat.Repl.SetName.(string) - if isReplSet { - returnVal.ReplSetName = setName - } + returnVal.ReplSetName = newStat.Repl.SetName // BEGIN code modification if newStat.Repl.IsMaster.(bool) { returnVal.NodeType = "PRI" @@ -1407,24 +1406,24 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec for collection, data := range newMongo.TopStats.Totals { topStatDataLine := &TopStatLine{ CollectionName: collection, - TotalTime: data.TSCollection.Total.Time, - TotalCount: data.TSCollection.Total.Count, - ReadLockTime: data.TSCollection.ReadLock.Time, - ReadLockCount: data.TSCollection.ReadLock.Count, - WriteLockTime: data.TSCollection.WriteLock.Time, - WriteLockCount: data.TSCollection.WriteLock.Count, - QueriesTime: data.TSCollection.Queries.Time, - QueriesCount: data.TSCollection.Queries.Count, - GetMoreTime: data.TSCollection.GetMore.Time, - GetMoreCount: data.TSCollection.GetMore.Count, - InsertTime: data.TSCollection.Insert.Time, - InsertCount: data.TSCollection.Insert.Count, - UpdateTime: data.TSCollection.Update.Time, - UpdateCount: data.TSCollection.Update.Count, - RemoveTime: data.TSCollection.Remove.Time, - RemoveCount: data.TSCollection.Remove.Count, - CommandsTime: data.TSCollection.Commands.Time, - CommandsCount: data.TSCollection.Commands.Count, + TotalTime: data.Total.Time, + TotalCount: data.Total.Count, + ReadLockTime: data.ReadLock.Time, + ReadLockCount: data.ReadLock.Count, + WriteLockTime: data.WriteLock.Time, + WriteLockCount: data.WriteLock.Count, + QueriesTime: data.Queries.Time, + QueriesCount: data.Queries.Count, + GetMoreTime: data.GetMore.Time, + GetMoreCount: data.GetMore.Count, + InsertTime: data.Insert.Time, + InsertCount: data.Insert.Count, + UpdateTime: data.Update.Time, + UpdateCount: data.Update.Count, + RemoveTime: data.Remove.Time, + RemoveCount: data.Remove.Count, + CommandsTime: data.Commands.Time, + CommandsCount: data.Commands.Count, } returnVal.TopStatLines = append(returnVal.TopStatLines, *topStatDataLine) } From cc1659c4d224b5c761547fc660ab8017570ef63c Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Thu, 22 Jul 2021 19:09:01 -0500 Subject: [PATCH 42/85] Simplify how nesting is handled (#9504) (cherry picked from commit d6b7d4da2cfc53598f95bcbd295d9914b9350ce2) --- plugins/parsers/json_v2/parser.go | 65 ++++--------------- plugins/parsers/json_v2/parser_test.go | 4 ++ .../testdata/complex_nesting/expected.out | 3 + .../testdata/complex_nesting/input.json | 31 +++++++++ .../testdata/complex_nesting/telegraf.conf | 9 +++ .../multiple_arrays_in_object/expected.out | 15 +++-- 6 files changed, 70 insertions(+), 57 deletions(-) create mode 100644 plugins/parsers/json_v2/testdata/complex_nesting/expected.out create mode 100644 plugins/parsers/json_v2/testdata/complex_nesting/input.json create mode 100644 plugins/parsers/json_v2/testdata/complex_nesting/telegraf.conf diff --git a/plugins/parsers/json_v2/parser.go b/plugins/parsers/json_v2/parser.go index ef8981dffc859..fa0946621cde4 100644 --- a/plugins/parsers/json_v2/parser.go +++ b/plugins/parsers/json_v2/parser.go @@ -184,11 +184,7 @@ func (p *Parser) processMetric(data []DataSet, input []byte, tag bool) ([]telegr return nil, err } - var m []telegraf.Metric - for _, n := range nodes { - m = append(m, n.Metric) - } - metrics = append(metrics, m) + metrics = append(metrics, nodes) } for i := 1; i < len(metrics); i++ { @@ -229,8 +225,8 @@ func mergeMetric(a telegraf.Metric, m telegraf.Metric) { } // expandArray will recursively create a new MetricNode for each element in a JSON array or single value -func (p *Parser) expandArray(result MetricNode) ([]MetricNode, error) { - var results []MetricNode +func (p *Parser) expandArray(result MetricNode) ([]telegraf.Metric, error) { + var results []telegraf.Metric if result.IsObject() { if !p.iterateObjects { @@ -262,8 +258,7 @@ func (p *Parser) expandArray(result MetricNode) ([]MetricNode, error) { Metric: m, Result: val, } - var r []MetricNode - r, err = p.combineObject(n) + r, err := p.combineObject(n) if err != nil { return false } @@ -274,7 +269,7 @@ func (p *Parser) expandArray(result MetricNode) ([]MetricNode, error) { } if len(results) != 0 { for _, newResult := range results { - mergeMetric(result.Metric, newResult.Metric) + mergeMetric(result.Metric, newResult) } } return true @@ -294,8 +289,7 @@ func (p *Parser) expandArray(result MetricNode) ([]MetricNode, error) { Metric: m, Result: val, } - var r []MetricNode - r, err = p.expandArray(n) + r, err := p.expandArray(n) if err != nil { return false } @@ -335,7 +329,7 @@ func (p *Parser) expandArray(result MetricNode) ([]MetricNode, error) { } } - results = append(results, result) + results = append(results, result.Metric) } return results, nil @@ -369,9 +363,7 @@ func (p *Parser) processObjects(objects []JSONObject, input []byte) ([]telegraf. if err != nil { return nil, err } - for _, m := range metrics { - t = append(t, m.Metric) - } + t = append(t, metrics...) } return t, nil @@ -379,12 +371,10 @@ func (p *Parser) processObjects(objects []JSONObject, input []byte) ([]telegraf. // combineObject will add all fields/tags to a single metric // If the object has multiple array's as elements it won't comine those, they will remain separate metrics -func (p *Parser) combineObject(result MetricNode) ([]MetricNode, error) { - var results []MetricNode - var combineObjectResult []MetricNode +func (p *Parser) combineObject(result MetricNode) ([]telegraf.Metric, error) { + var results []telegraf.Metric if result.IsArray() || result.IsObject() { var err error - var prevArray bool result.ForEach(func(key, val gjson.Result) bool { // Determine if field/tag set name is configured var setName string @@ -436,38 +426,18 @@ func (p *Parser) combineObject(result MetricNode) ([]MetricNode, error) { } arrayNode.Tag = tag + if val.IsObject() { - prevArray = false - combineObjectResult, err = p.combineObject(arrayNode) + results, err = p.combineObject(arrayNode) if err != nil { return false } } else { - var r []MetricNode - r, err = p.expandArray(arrayNode) + r, err := p.expandArray(arrayNode) if err != nil { return false } - if prevArray { - if !arrayNode.IsArray() { - // If another non-array element was found, merge it into all previous gathered metrics - if len(results) != 0 { - for _, newResult := range results { - mergeMetric(result.Metric, newResult.Metric) - } - } - } else { - // Multiple array's won't be merged but kept separate, add additional metrics gathered from an array - results = append(results, r...) - } - } else { - // Continue using the same metric if its an object - results = r - } - - if val.IsArray() { - prevArray = true - } + results = cartesianProduct(results, r) } return true @@ -477,13 +447,6 @@ func (p *Parser) combineObject(result MetricNode) ([]MetricNode, error) { return nil, err } } - - if len(results) == 0 { - // If the results are empty, use the results of the call to combine object - // This happens with nested objects in array's, see the test array_of_objects - results = combineObjectResult - } - return results, nil } diff --git a/plugins/parsers/json_v2/parser_test.go b/plugins/parsers/json_v2/parser_test.go index 9321d7256fada..f0f018034dc5b 100644 --- a/plugins/parsers/json_v2/parser_test.go +++ b/plugins/parsers/json_v2/parser_test.go @@ -21,6 +21,10 @@ func TestData(t *testing.T) { name string test string }{ + { + name: "Test complex nesting", + test: "complex_nesting", + }, { name: "Test having an array of objects", test: "array_of_objects", diff --git a/plugins/parsers/json_v2/testdata/complex_nesting/expected.out b/plugins/parsers/json_v2/testdata/complex_nesting/expected.out new file mode 100644 index 0000000000000..265549c57abce --- /dev/null +++ b/plugins/parsers/json_v2/testdata/complex_nesting/expected.out @@ -0,0 +1,3 @@ +file,properties_place=Antelope\ Valley\,\ CA geometry_coordinates=-119.4998333,geometry_type="Point",id="nc73584926",properties_mag=6,properties_updated=1.626277167263e+12,type="Feature" +file,properties_place=Antelope\ Valley\,\ CA geometry_coordinates=38.5075,geometry_type="Point",id="nc73584926",properties_mag=6,properties_updated=1.626277167263e+12,type="Feature" +file,properties_place=Antelope\ Valley\,\ CA geometry_coordinates=7.45,geometry_type="Point",id="nc73584926",properties_mag=6,properties_updated=1.626277167263e+12,type="Feature" diff --git a/plugins/parsers/json_v2/testdata/complex_nesting/input.json b/plugins/parsers/json_v2/testdata/complex_nesting/input.json new file mode 100644 index 0000000000000..69bff40a45983 --- /dev/null +++ b/plugins/parsers/json_v2/testdata/complex_nesting/input.json @@ -0,0 +1,31 @@ +{ + "type": "FeatureCollection", + "metadata": { + "generated": 1626285886000, + "url": "https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_week.geojson", + "title": "USGS Significant Earthquakes, Past Week", + "status": 200, + "api": "1.10.3", + "count": 1 + }, + "features": [ + { + "type": "Feature", + "properties": { + "mag": 6, + "place": "Antelope Valley, CA", + "time": 1625784588110, + "updated": 1626277167263 + }, + "geometry": { + "type": "Point", + "coordinates": [ + -119.4998333, + 38.5075, + 7.45 + ] + }, + "id": "nc73584926" + } + ] +} diff --git a/plugins/parsers/json_v2/testdata/complex_nesting/telegraf.conf b/plugins/parsers/json_v2/testdata/complex_nesting/telegraf.conf new file mode 100644 index 0000000000000..66347da8410b9 --- /dev/null +++ b/plugins/parsers/json_v2/testdata/complex_nesting/telegraf.conf @@ -0,0 +1,9 @@ +[[inputs.file]] + files = ["./testdata/complex_nesting/input.json"] + data_format = "json_v2" + [[inputs.file.json_v2]] + [[inputs.file.json_v2.object]] + path = "features" + timestamp_key = "properties_time" + timestamp_format = "unix_ms" + tags = ["properties_place"] diff --git a/plugins/parsers/json_v2/testdata/multiple_arrays_in_object/expected.out b/plugins/parsers/json_v2/testdata/multiple_arrays_in_object/expected.out index 814d044ce6b6f..2948da1720f64 100644 --- a/plugins/parsers/json_v2/testdata/multiple_arrays_in_object/expected.out +++ b/plugins/parsers/json_v2/testdata/multiple_arrays_in_object/expected.out @@ -1,6 +1,9 @@ -file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="A Long-expected Party" -file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="The Shadow of the Past" -file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",name="Bilbo",species="hobbit" -file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",name="Frodo",species="hobbit" -file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",random=1 -file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",random=2 +file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="A Long-expected Party",name="Bilbo",species="hobbit",random=1 +file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="A Long-expected Party",name="Bilbo",species="hobbit",random=2 +file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="A Long-expected Party",name="Frodo",species="hobbit",random=1 +file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="A Long-expected Party",name="Frodo",species="hobbit",random=2 +file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="The Shadow of the Past",name="Bilbo",species="hobbit",random=1 +file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="The Shadow of the Past",name="Bilbo",species="hobbit",random=2 +file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="The Shadow of the Past",name="Frodo",species="hobbit",random=1 +file,title=The\ Lord\ Of\ The\ Rings author="Tolkien",chapters="The Shadow of the Past",name="Frodo",species="hobbit",random=2 + From cce753969ece47db98368f35b8d25ee9fec08b02 Mon Sep 17 00:00:00 2001 From: Alexander Krantz Date: Thu, 22 Jul 2021 17:44:36 -0700 Subject: [PATCH 43/85] Prevent x509_cert from hanging on UDP connection (#9323) (cherry picked from commit 32d4234ae4edb39a9ae86915d457974d167a0d0c) --- docs/LICENSE_OF_DEPENDENCIES.md | 4 ++ go.mod | 3 +- go.sum | 18 ++++++++- plugins/inputs/x509_cert/README.md | 5 ++- plugins/inputs/x509_cert/x509_cert.go | 44 ++++++++++++++++++++-- plugins/inputs/x509_cert/x509_cert_test.go | 32 ++++++++++++++++ 6 files changed, 100 insertions(+), 6 deletions(-) diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index 08b92d486a306..6fdae959e8168 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -170,6 +170,10 @@ following works: - github.com/openzipkin/zipkin-go-opentracing [MIT License](https://github.com/openzipkin/zipkin-go-opentracing/blob/master/LICENSE) - github.com/philhofer/fwd [MIT License](https://github.com/philhofer/fwd/blob/master/LICENSE.md) - github.com/pierrec/lz4 [BSD 3-Clause "New" or "Revised" License](https://github.com/pierrec/lz4/blob/master/LICENSE) +- github.com/pion/dtls [MIT License](https://github.com/pion/dtls/blob/master/LICENSE) +- github.com/pion/logging [MIT License](https://github.com/pion/logging/blob/master/LICENSE) +- github.com/pion/transport [MIT License](https://github.com/pion/transport/blob/master/LICENSE) +- github.com/pion/udp [MIT License](https://github.com/pion/udp/blob/master/LICENSE) - github.com/pkg/browser [BSD 2-Clause "Simplified" License](https://github.com/pkg/browser/blob/master/LICENSE) - github.com/pkg/errors [BSD 2-Clause "Simplified" License](https://github.com/pkg/errors/blob/master/LICENSE) - github.com/pmezard/go-difflib [BSD 3-Clause Clear License](https://github.com/pmezard/go-difflib/blob/master/LICENSE) diff --git a/go.mod b/go.mod index 6543bd15f7305..3241c36981280 100644 --- a/go.mod +++ b/go.mod @@ -101,6 +101,7 @@ require ( github.com/nsqio/go-nsq v1.0.8 github.com/openconfig/gnmi v0.0.0-20180912164834-33a1865c3029 github.com/openzipkin/zipkin-go-opentracing v0.3.4 + github.com/pion/dtls/v2 v2.0.9 github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.7.1 github.com/prometheus/client_model v0.2.0 @@ -135,7 +136,7 @@ require ( go.starlark.net v0.0.0-20210406145628-7a1108eaa012 go.uber.org/multierr v1.6.0 // indirect golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect - golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 + golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 diff --git a/go.sum b/go.sum index c3812473b5d3f..2e47bcb1d80b6 100644 --- a/go.sum +++ b/go.sum @@ -1245,6 +1245,15 @@ github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0 github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.5.2+incompatible h1:WCjObylUIOlKy/+7Abdn34TLIkXiA4UWUMhxq9m9ZXI= github.com/pierrec/lz4 v2.5.2+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pion/dtls/v2 v2.0.9 h1:7Ow+V++YSZQMYzggI0P9vLJz/hUFcffsfGMfT/Qy+u8= +github.com/pion/dtls/v2 v2.0.9/go.mod h1:O0Wr7si/Zj5/EBFlDzDd6UtVxx25CE1r7XM7BQKYQho= +github.com/pion/logging v0.2.2 h1:M9+AIj/+pxNsDfAT64+MAVgJO0rsyLnoJKCqf//DoeY= +github.com/pion/logging v0.2.2/go.mod h1:k0/tDVsRCX2Mb2ZEmTqNa7CWsQPc+YYCB7Q+5pahoms= +github.com/pion/transport v0.12.2/go.mod h1:N3+vZQD9HlDP5GWkZ85LohxNsDcNgofQmyL6ojX5d8Q= +github.com/pion/transport v0.12.3 h1:vdBfvfU/0Wq8kd2yhUMSDB/x+O4Z9MYVl2fJ5BT4JZw= +github.com/pion/transport v0.12.3/go.mod h1:OViWW9SP2peE/HbwBvARicmAVnesphkNkCVZIWJ6q9A= +github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o= +github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -1573,6 +1582,7 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e h1:gsTQYXdTw2Gq7RBsWvlQ91b+aEQ6bXFUngBGuR8sPpI= golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -1662,12 +1672,16 @@ golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200904194848-62affa334b73/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201201195509-5d6afe98e0b7/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210224082022-3d97a244fca7/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 h1:qWPm9rbaAMKs8Bq/9LRpbMqxWRVUAQwMI9fVrssnTfw= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c h1:KHUzaHIpjWVlVVNh65G3hhuj3KB1HnjY6Cq5cTvRQT8= +golang.org/x/net v0.0.0-20210331212208-0fccb6fa2b5c/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1786,7 +1800,9 @@ golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 h1:SrN+KX8Art/Sf4HNj6Zcz06G7VEz+7w9tdXTPOZ7+l4= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= diff --git a/plugins/inputs/x509_cert/README.md b/plugins/inputs/x509_cert/README.md index f206f6c0979a5..5211c38e9a9c2 100644 --- a/plugins/inputs/x509_cert/README.md +++ b/plugins/inputs/x509_cert/README.md @@ -3,6 +3,8 @@ This plugin provides information about X509 certificate accessible via local file or network connection. +When using a UDP address as a certificate source, the server must support [DTLS](https://en.wikipedia.org/wiki/Datagram_Transport_Layer_Security). + ### Configuration @@ -11,7 +13,8 @@ file or network connection. [[inputs.x509_cert]] ## List certificate sources, support wildcard expands for files ## Prefix your entry with 'file://' if you intend to use relative paths - sources = ["/etc/ssl/certs/ssl-cert-snakeoil.pem", "tcp://example.org:443", + sources = ["tcp://example.org:443", "https://influxdata.com:443", + "udp://127.0.0.1:4433", "/etc/ssl/certs/ssl-cert-snakeoil.pem", "/etc/mycerts/*.mydomain.org.pem", "file:///path/to/*.pem"] ## Timeout for SSL connection diff --git a/plugins/inputs/x509_cert/x509_cert.go b/plugins/inputs/x509_cert/x509_cert.go index 4ac115931a26a..b106f91b772f6 100644 --- a/plugins/inputs/x509_cert/x509_cert.go +++ b/plugins/inputs/x509_cert/x509_cert.go @@ -7,6 +7,7 @@ import ( "crypto/x509" "encoding/pem" "fmt" + "github.com/pion/dtls/v2" "io/ioutil" "net" "net/url" @@ -24,7 +25,8 @@ import ( const sampleConfig = ` ## List certificate sources ## Prefix your entry with 'file://' if you intend to use relative paths - sources = ["/etc/ssl/certs/ssl-cert-snakeoil.pem", "tcp://example.org:443", + sources = ["tcp://example.org:443", "https://influxdata.com:443", + "udp://127.0.0.1:4433", "/etc/ssl/certs/ssl-cert-snakeoil.pem", "/etc/mycerts/*.mydomain.org.pem", "file:///path/to/*.pem"] ## Timeout for SSL connection @@ -104,11 +106,47 @@ func (c *X509Cert) serverName(u *url.URL) (string, error) { func (c *X509Cert) getCert(u *url.URL, timeout time.Duration) ([]*x509.Certificate, error) { protocol := u.Scheme switch u.Scheme { + case "udp", "udp4", "udp6": + ipConn, err := net.DialTimeout(u.Scheme, u.Host, timeout) + if err != nil { + return nil, err + } + defer ipConn.Close() + + serverName, err := c.serverName(u) + if err != nil { + return nil, err + } + + dtlsCfg := &dtls.Config{ + InsecureSkipVerify: true, + Certificates: c.tlsCfg.Certificates, + RootCAs: c.tlsCfg.RootCAs, + ServerName: serverName, + } + conn, err := dtls.Client(ipConn, dtlsCfg) + if err != nil { + return nil, err + } + defer conn.Close() + + rawCerts := conn.ConnectionState().PeerCertificates + var certs []*x509.Certificate + for _, rawCert := range rawCerts { + parsed, err := x509.ParseCertificate(rawCert) + if err != nil { + return nil, err + } + + if parsed != nil { + certs = append(certs, parsed) + } + } + + return certs, nil case "https": protocol = "tcp" fallthrough - case "udp", "udp4", "udp6": - fallthrough case "tcp", "tcp4", "tcp6": ipConn, err := net.DialTimeout(protocol, u.Host, timeout) if err != nil { diff --git a/plugins/inputs/x509_cert/x509_cert_test.go b/plugins/inputs/x509_cert/x509_cert_test.go index 4f09b903b4c24..9c42c09bdabda 100644 --- a/plugins/inputs/x509_cert/x509_cert_test.go +++ b/plugins/inputs/x509_cert/x509_cert_test.go @@ -4,8 +4,10 @@ import ( "crypto/tls" "encoding/base64" "fmt" + "github.com/pion/dtls/v2" "io/ioutil" "math/big" + "net" "net/url" "os" "path/filepath" @@ -260,6 +262,36 @@ func TestGatherChain(t *testing.T) { } } +func TestGatherUDPCert(t *testing.T) { + pair, err := tls.X509KeyPair([]byte(pki.ReadServerCert()), []byte(pki.ReadServerKey())) + require.NoError(t, err) + + cfg := &dtls.Config{ + Certificates: []tls.Certificate{pair}, + } + + addr := &net.UDPAddr{IP: net.ParseIP("127.0.0.1"), Port: 0} + listener, err := dtls.Listen("udp", addr, cfg) + require.NoError(t, err) + defer listener.Close() + + go func() { + _, _ = listener.Accept() + }() + + m := &X509Cert{ + Sources: []string{"udp://" + listener.Addr().String()}, + Log: testutil.Logger{}, + } + require.NoError(t, m.Init()) + + var acc testutil.Accumulator + require.NoError(t, m.Gather(&acc)) + + assert.Len(t, acc.Errors, 0) + assert.True(t, acc.HasMeasurement("x509_cert")) +} + func TestStrings(t *testing.T) { sc := X509Cert{} require.NoError(t, sc.Init()) From 18b2719e148ae39aa587cdafff6b0e3c5bf8f8e7 Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Mon, 26 Jul 2021 20:39:23 -0500 Subject: [PATCH 44/85] Update Go to v1.16.6 (#9542) (cherry picked from commit a1dae0d2c186534286b172ac2929feb0f0089f45) --- .circleci/config.yml | 6 +++--- Makefile | 4 ++-- scripts/alpine.docker | 2 +- scripts/buster.docker | 2 +- scripts/ci-1.16.docker | 2 +- scripts/mac_installgo.sh | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 03fe58b17a739..010c54a0fedfd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -13,7 +13,7 @@ executors: go-1_16: working_directory: '/go/src/github.com/influxdata/telegraf' docker: - - image: 'quay.io/influxdb/telegraf-ci:1.16.5' + - image: 'quay.io/influxdb/telegraf-ci:1.16.6' environment: GOFLAGS: -p=8 mac: @@ -150,7 +150,7 @@ jobs: steps: - checkout - check-changed-files-or-halt-windows - - run: choco upgrade golang --version=1.16.5 + - run: choco upgrade golang --version=1.16.6 - run: choco install make - run: git config --system core.longpaths true - run: make test-windows @@ -448,4 +448,4 @@ workflows: filters: branches: only: - - master \ No newline at end of file + - master diff --git a/Makefile b/Makefile index 4f6ef13e8e4af..5cf7d2383604f 100644 --- a/Makefile +++ b/Makefile @@ -201,8 +201,8 @@ ci-1.15: .PHONY: ci-1.16 ci-1.16: - docker build -t quay.io/influxdb/telegraf-ci:1.16.5 - < scripts/ci-1.16.docker - docker push quay.io/influxdb/telegraf-ci:1.16.5 + docker build -t quay.io/influxdb/telegraf-ci:1.16.6 - < scripts/ci-1.16.docker + docker push quay.io/influxdb/telegraf-ci:1.16.6 .PHONY: install install: $(buildbin) diff --git a/scripts/alpine.docker b/scripts/alpine.docker index 673498c6f598e..d5b8b85f6abb7 100644 --- a/scripts/alpine.docker +++ b/scripts/alpine.docker @@ -1,4 +1,4 @@ -FROM golang:1.16.5 as builder +FROM golang:1.16.6 as builder WORKDIR /go/src/github.com/influxdata/telegraf COPY . /go/src/github.com/influxdata/telegraf diff --git a/scripts/buster.docker b/scripts/buster.docker index 4276730b4bf1e..685d30067e0ef 100644 --- a/scripts/buster.docker +++ b/scripts/buster.docker @@ -1,4 +1,4 @@ -FROM golang:1.16.5-buster as builder +FROM golang:1.16.6-buster as builder WORKDIR /go/src/github.com/influxdata/telegraf COPY . /go/src/github.com/influxdata/telegraf diff --git a/scripts/ci-1.16.docker b/scripts/ci-1.16.docker index 585abc137e060..f0b2badafd521 100644 --- a/scripts/ci-1.16.docker +++ b/scripts/ci-1.16.docker @@ -1,4 +1,4 @@ -FROM golang:1.16.5 +FROM golang:1.16.6 RUN chmod -R 755 "$GOPATH" diff --git a/scripts/mac_installgo.sh b/scripts/mac_installgo.sh index 285db8b315fc2..aab4731c22f30 100644 --- a/scripts/mac_installgo.sh +++ b/scripts/mac_installgo.sh @@ -3,8 +3,8 @@ set -eux GO_ARCH="darwin-amd64" -GO_VERSION="1.16.5" -GO_VERSION_SHA="be761716d5bfc958a5367440f68ba6563509da2f539ad1e1864bd42fe553f277" # from https://golang.org/dl +GO_VERSION="1.16.6" +GO_VERSION_SHA="e4e83e7c6891baa00062ed37273ce95835f0be77ad8203a29ec56dbf3d87508a" # from https://golang.org/dl # This path is cachable. (Saving in /usr/local/ would cause issues restoring the cache.) path="/usr/local/Cellar" From 69f1fa45a118063804cbad32b0665f8205cc5b7d Mon Sep 17 00:00:00 2001 From: Mark Wilkinson - m82labs Date: Mon, 26 Jul 2021 21:55:03 -0400 Subject: [PATCH 45/85] Worktable workfile stats (#8587) (cherry picked from commit 57ecd1d21b51eed1982c522c4fb1ed9b4b1231e2) --- plugins/inputs/sqlserver/azuresqlqueries.go | 6 ++++-- plugins/inputs/sqlserver/sqlserverqueries.go | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/sqlserver/azuresqlqueries.go b/plugins/inputs/sqlserver/azuresqlqueries.go index 318509ac28ee5..17361c20d41f8 100644 --- a/plugins/inputs/sqlserver/azuresqlqueries.go +++ b/plugins/inputs/sqlserver/azuresqlqueries.go @@ -527,8 +527,8 @@ WITH PerfCounters AS ( ,'Mirrored Write Transactions/sec' ,'Group Commit Time' ,'Group Commits/Sec' - ,'Distributed Query' - ,'DTC calls' + ,'Workfiles Created/sec' + ,'Worktables Created/sec' ,'Query Store CPU usage' ) OR ( spi.[object_name] LIKE '%User Settable%' @@ -1068,6 +1068,8 @@ WITH PerfCounters AS ( ,'Mirrored Write Transactions/sec' ,'Group Commit Time' ,'Group Commits/Sec' + ,'Workfiles Created/sec' + ,'Worktables Created/sec' ,'Distributed Query' ,'DTC calls' ,'Query Store CPU usage' diff --git a/plugins/inputs/sqlserver/sqlserverqueries.go b/plugins/inputs/sqlserver/sqlserverqueries.go index 1d46e5cd91277..49bde3fb915a2 100644 --- a/plugins/inputs/sqlserver/sqlserverqueries.go +++ b/plugins/inputs/sqlserver/sqlserverqueries.go @@ -409,6 +409,8 @@ SELECT DISTINCT ,'Mirrored Write Transactions/sec' ,'Group Commit Time' ,'Group Commits/Sec' + ,'Workfiles Created/sec' + ,'Worktables Created/sec' ,'Distributed Query' ,'DTC calls' ,'Query Store CPU usage' From 2d8d6eed09640e52df53828fc6e9d37e79ab298e Mon Sep 17 00:00:00 2001 From: Mya Date: Tue, 27 Jul 2021 14:34:35 -0600 Subject: [PATCH 46/85] Bug Fix Snmp empty metric name (#9519) (cherry picked from commit a48e11d0d1ea8ca1c056a888b0b3d7955a8ca2d8) --- plugins/processors/ifname/ifname.go | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/processors/ifname/ifname.go b/plugins/processors/ifname/ifname.go index 714578779a7a0..10623c041dd2d 100644 --- a/plugins/processors/ifname/ifname.go +++ b/plugins/processors/ifname/ifname.go @@ -349,6 +349,7 @@ func init() { func makeTableNoMock(fieldName string) (*si.Table, error) { var err error tab := si.Table{ + Name: "ifTable", IndexAsTag: true, Fields: []si.Field{ {Oid: fieldName}, From 238eb7328996568241d046d5d68557005b51b2b8 Mon Sep 17 00:00:00 2001 From: Raphael Yu Date: Wed, 28 Jul 2021 05:13:12 +0800 Subject: [PATCH 47/85] Attach the pod labels to the `kubernetes_pod_volume` & `kubernetes_pod_network` metrics. (#9438) (cherry picked from commit 51720f3bd73beb25170e82ec1decd65c477e5779) --- plugins/inputs/kubernetes/kubernetes.go | 28 +++++++++++++------- plugins/inputs/kubernetes/kubernetes_test.go | 4 +++ 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/plugins/inputs/kubernetes/kubernetes.go b/plugins/inputs/kubernetes/kubernetes.go index 32bfc04a061e6..ab1cf4bfe4afc 100644 --- a/plugins/inputs/kubernetes/kubernetes.go +++ b/plugins/inputs/kubernetes/kubernetes.go @@ -234,6 +234,17 @@ func (k *Kubernetes) LoadJSON(url string, v interface{}) error { func buildPodMetrics(summaryMetrics *SummaryMetrics, podInfo []Metadata, labelFilter filter.Filter, acc telegraf.Accumulator) { for _, pod := range summaryMetrics.Pods { + podLabels := make(map[string]string) + for _, info := range podInfo { + if info.Name == pod.PodRef.Name && info.Namespace == pod.PodRef.Namespace { + for k, v := range info.Labels { + if labelFilter.Match(k) { + podLabels[k] = v + } + } + } + } + for _, container := range pod.Containers { tags := map[string]string{ "node_name": summaryMetrics.Node.NodeName, @@ -241,16 +252,9 @@ func buildPodMetrics(summaryMetrics *SummaryMetrics, podInfo []Metadata, labelFi "container_name": container.Name, "pod_name": pod.PodRef.Name, } - for _, info := range podInfo { - if info.Name == pod.PodRef.Name && info.Namespace == pod.PodRef.Namespace { - for k, v := range info.Labels { - if labelFilter.Match(k) { - tags[k] = v - } - } - } + for k, v := range podLabels { + tags[k] = v } - fields := make(map[string]interface{}) fields["cpu_usage_nanocores"] = container.CPU.UsageNanoCores fields["cpu_usage_core_nanoseconds"] = container.CPU.UsageCoreNanoSeconds @@ -275,6 +279,9 @@ func buildPodMetrics(summaryMetrics *SummaryMetrics, podInfo []Metadata, labelFi "namespace": pod.PodRef.Namespace, "volume_name": volume.Name, } + for k, v := range podLabels { + tags[k] = v + } fields := make(map[string]interface{}) fields["available_bytes"] = volume.AvailableBytes fields["capacity_bytes"] = volume.CapacityBytes @@ -287,6 +294,9 @@ func buildPodMetrics(summaryMetrics *SummaryMetrics, podInfo []Metadata, labelFi "pod_name": pod.PodRef.Name, "namespace": pod.PodRef.Namespace, } + for k, v := range podLabels { + tags[k] = v + } fields := make(map[string]interface{}) fields["rx_bytes"] = pod.Network.RXBytes fields["rx_errors"] = pod.Network.RXErrors diff --git a/plugins/inputs/kubernetes/kubernetes_test.go b/plugins/inputs/kubernetes/kubernetes_test.go index 531dd13f950c8..864905448780d 100644 --- a/plugins/inputs/kubernetes/kubernetes_test.go +++ b/plugins/inputs/kubernetes/kubernetes_test.go @@ -141,6 +141,8 @@ func TestKubernetesStats(t *testing.T) { "volume_name": "volume1", "namespace": "foons", "pod_name": "foopod", + "app": "foo", + "superkey": "foobar", } acc.AssertContainsTaggedFields(t, "kubernetes_pod_volume", fields, tags) @@ -154,6 +156,8 @@ func TestKubernetesStats(t *testing.T) { "node_name": "node1", "namespace": "foons", "pod_name": "foopod", + "app": "foo", + "superkey": "foobar", } acc.AssertContainsTaggedFields(t, "kubernetes_pod_network", fields, tags) } From 657711ecc4783a454a129ec2731821867dc0c19b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Jaber?= Date: Tue, 27 Jul 2021 16:16:53 -0500 Subject: [PATCH 48/85] [Docs] Clarify tagging behavior (#9461) (cherry picked from commit 3f9643dd7e66df83bb18f78490685d31929e5dbf) --- docs/CONFIGURATION.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index 4965a4337f8d8..70e7981c9450b 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -144,6 +144,7 @@ combining an integer value and time unit as a string value. Valid time units ar Global tags can be specified in the `[global_tags]` table in key="value" format. All metrics that are gathered will be tagged with the tags specified. +Global tags are overriden by tags set by plugins. ```toml [global_tags] @@ -432,7 +433,7 @@ Parameters that can be used with any aggregator plugin: the name of the input). - **name_prefix**: Specifies a prefix to attach to the measurement name. - **name_suffix**: Specifies a suffix to attach to the measurement name. -- **tags**: A map of tags to apply to a specific input's measurements. +- **tags**: A map of tags to apply to the measurement - behavior varies based on aggregator. The [metric filtering][] parameters can be used to limit what metrics are handled by the aggregator. Excluded metrics are passed downstream to the next From 1580652762e681de660c09d24a663915b68feb91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20=C5=BBak?= Date: Tue, 27 Jul 2021 23:28:26 +0200 Subject: [PATCH 49/85] Linter fixes for plugins/inputs/[fg]* (#9387) (cherry picked from commit 87c94e4ac3ed4dd4124fcb26a00e067157a5ebca) --- plugins/inputs/fail2ban/fail2ban_test.go | 6 + plugins/inputs/file/file_test.go | 8 +- .../filecount/filesystem_helpers_test.go | 5 +- plugins/inputs/filestat/filestat.go | 4 +- plugins/inputs/filestat/filestat_test.go | 2 +- plugins/inputs/fluentd/fluentd.go | 4 +- plugins/inputs/fluentd/fluentd_test.go | 5 +- plugins/inputs/github/github.go | 31 ++-- plugins/inputs/gnmi/gnmi.go | 136 +++++++++--------- plugins/inputs/gnmi/gnmi_test.go | 128 ++++++++--------- 10 files changed, 172 insertions(+), 157 deletions(-) diff --git a/plugins/inputs/fail2ban/fail2ban_test.go b/plugins/inputs/fail2ban/fail2ban_test.go index 8ec313a1fbdda..1afac3d789abd 100644 --- a/plugins/inputs/fail2ban/fail2ban_test.go +++ b/plugins/inputs/fail2ban/fail2ban_test.go @@ -103,29 +103,35 @@ func TestHelperProcess(_ *testing.T) { if !strings.HasSuffix(cmd, "fail2ban-client") { //nolint:errcheck,revive // Test will fail anyway fmt.Fprint(os.Stdout, "command not found") + //nolint:revive // os.Exit called intentionally os.Exit(1) } if len(args) == 1 && args[0] == "status" { //nolint:errcheck,revive // Test will fail anyway fmt.Fprint(os.Stdout, execStatusOutput) + //nolint:revive // os.Exit called intentionally os.Exit(0) } else if len(args) == 2 && args[0] == "status" { if args[1] == "sshd" { //nolint:errcheck,revive // Test will fail anyway fmt.Fprint(os.Stdout, execStatusSshdOutput) + //nolint:revive // os.Exit called intentionally os.Exit(0) } else if args[1] == "postfix" { //nolint:errcheck,revive // Test will fail anyway fmt.Fprint(os.Stdout, execStatusPostfixOutput) + //nolint:revive // os.Exit called intentionally os.Exit(0) } else if args[1] == "dovecot" { //nolint:errcheck,revive // Test will fail anyway fmt.Fprint(os.Stdout, execStatusDovecotOutput) + //nolint:revive // os.Exit called intentionally os.Exit(0) } } //nolint:errcheck,revive // Test will fail anyway fmt.Fprint(os.Stdout, "invalid argument") + //nolint:revive // os.Exit called intentionally os.Exit(1) } diff --git a/plugins/inputs/file/file_test.go b/plugins/inputs/file/file_test.go index f8f7d773f719d..e633559236bd2 100644 --- a/plugins/inputs/file/file_test.go +++ b/plugins/inputs/file/file_test.go @@ -11,15 +11,18 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/parsers" "github.com/influxdata/telegraf/plugins/parsers/csv" "github.com/influxdata/telegraf/testutil" - "github.com/stretchr/testify/require" ) func TestRefreshFilePaths(t *testing.T) { wd, err := os.Getwd() + require.NoError(t, err) + r := File{ Files: []string{filepath.Join(wd, "dev/testfiles/**.log")}, } @@ -100,7 +103,8 @@ func TestGrokParser(t *testing.T) { require.NoError(t, err) err = r.Gather(&acc) - require.Equal(t, len(acc.Metrics), 2) + require.NoError(t, err) + require.Len(t, acc.Metrics, 2) } func TestCharacterEncoding(t *testing.T) { diff --git a/plugins/inputs/filecount/filesystem_helpers_test.go b/plugins/inputs/filecount/filesystem_helpers_test.go index b1dacc25bc731..8a6d9cf2aa035 100644 --- a/plugins/inputs/filecount/filesystem_helpers_test.go +++ b/plugins/inputs/filecount/filesystem_helpers_test.go @@ -53,11 +53,12 @@ func TestRealFS(t *testing.T) { fs = getTestFileSystem() // now, the same test as above will return an error as the file doesn't exist in our fake fs expectedError := "Stat " + getTestdataDir() + "/qux: No such file or directory" - fileInfo, err = fs.Stat(getTestdataDir() + "/qux") - require.Equal(t, expectedError, err.Error()) + _, err = fs.Stat(getTestdataDir() + "/qux") + require.Error(t, err, expectedError) // and verify that what we DO expect to find, we do fileInfo, err = fs.Stat("/testdata/foo") require.NoError(t, err) + require.NotNil(t, fileInfo) } func getTestFileSystem() fakeFileSystem { diff --git a/plugins/inputs/filestat/filestat.go b/plugins/inputs/filestat/filestat.go index 9450f9a41b77c..7d1143b74aaed 100644 --- a/plugins/inputs/filestat/filestat.go +++ b/plugins/inputs/filestat/filestat.go @@ -114,11 +114,11 @@ func (f *FileStat) Gather(acc telegraf.Accumulator) error { } if f.Md5 { - md5, err := getMd5(fileName) + md5Hash, err := getMd5(fileName) if err != nil { acc.AddError(err) } else { - fields["md5_sum"] = md5 + fields["md5_sum"] = md5Hash } } diff --git a/plugins/inputs/filestat/filestat_test.go b/plugins/inputs/filestat/filestat_test.go index 1c827f8dbe9ea..ea1bee47e4fb4 100644 --- a/plugins/inputs/filestat/filestat_test.go +++ b/plugins/inputs/filestat/filestat_test.go @@ -198,7 +198,7 @@ func TestGetMd5(t *testing.T) { require.NoError(t, err) require.Equal(t, "5a7e9b77fa25e7bb411dbd17cf403c1f", md5) - md5, err = getMd5("/tmp/foo/bar/fooooo") + _, err = getMd5("/tmp/foo/bar/fooooo") require.Error(t, err) } diff --git a/plugins/inputs/fluentd/fluentd.go b/plugins/inputs/fluentd/fluentd.go index dac25769a207c..03f46c67ce515 100644 --- a/plugins/inputs/fluentd/fluentd.go +++ b/plugins/inputs/fluentd/fluentd.go @@ -63,11 +63,11 @@ func parse(data []byte) (datapointArray []pluginData, err error) { if err = json.Unmarshal(data, &endpointData); err != nil { err = fmt.Errorf("processing JSON structure") - return + return nil, err } datapointArray = append(datapointArray, endpointData.Payload...) - return + return datapointArray, err } // Description - display description diff --git a/plugins/inputs/fluentd/fluentd_test.go b/plugins/inputs/fluentd/fluentd_test.go index 61cd6576ec648..a822c763f1402 100644 --- a/plugins/inputs/fluentd/fluentd_test.go +++ b/plugins/inputs/fluentd/fluentd_test.go @@ -8,8 +8,9 @@ import ( "net/url" "testing" - "github.com/influxdata/telegraf/testutil" "github.com/stretchr/testify/require" + + "github.com/influxdata/telegraf/testutil" ) // sampleJSON from fluentd version '0.14.9' @@ -127,6 +128,8 @@ func Test_Gather(t *testing.T) { })) requestURL, err := url.Parse(fluentdTest.Endpoint) + require.NoError(t, err) + require.NotNil(t, requestURL) ts.Listener, _ = net.Listen("tcp", fmt.Sprintf("%s:%s", requestURL.Hostname(), requestURL.Port())) diff --git a/plugins/inputs/github/github.go b/plugins/inputs/github/github.go index 020775cb43e8c..31fcc56aecdae 100644 --- a/plugins/inputs/github/github.go +++ b/plugins/inputs/github/github.go @@ -8,12 +8,13 @@ import ( "sync" "time" - "github.com/google/go-github/v32/github" + githubLib "github.com/google/go-github/v32/github" + "golang.org/x/oauth2" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/plugins/inputs" "github.com/influxdata/telegraf/selfstat" - "golang.org/x/oauth2" ) // GitHub - plugin main structure @@ -23,7 +24,7 @@ type GitHub struct { AdditionalFields []string `toml:"additional_fields"` EnterpriseBaseURL string `toml:"enterprise_base_url"` HTTPTimeout config.Duration `toml:"http_timeout"` - githubClient *github.Client + githubClient *githubLib.Client obfuscatedToken string @@ -68,7 +69,7 @@ func (g *GitHub) Description() string { } // Create GitHub Client -func (g *GitHub) createGitHubClient(ctx context.Context) (*github.Client, error) { +func (g *GitHub) createGitHubClient(ctx context.Context) (*githubLib.Client, error) { httpClient := &http.Client{ Transport: &http.Transport{ Proxy: http.ProxyFromEnvironment, @@ -93,11 +94,11 @@ func (g *GitHub) createGitHubClient(ctx context.Context) (*github.Client, error) return g.newGithubClient(httpClient) } -func (g *GitHub) newGithubClient(httpClient *http.Client) (*github.Client, error) { +func (g *GitHub) newGithubClient(httpClient *http.Client) (*githubLib.Client, error) { if g.EnterpriseBaseURL != "" { - return github.NewEnterpriseClient(g.EnterpriseBaseURL, "", httpClient) + return githubLib.NewEnterpriseClient(g.EnterpriseBaseURL, "", httpClient) } - return github.NewClient(httpClient), nil + return githubLib.NewClient(httpClient), nil } // Gather GitHub Metrics @@ -172,16 +173,16 @@ func (g *GitHub) Gather(acc telegraf.Accumulator) error { return nil } -func (g *GitHub) handleRateLimit(response *github.Response, err error) { +func (g *GitHub) handleRateLimit(response *githubLib.Response, err error) { if err == nil { g.RateLimit.Set(int64(response.Rate.Limit)) g.RateRemaining.Set(int64(response.Rate.Remaining)) - } else if _, ok := err.(*github.RateLimitError); ok { + } else if _, ok := err.(*githubLib.RateLimitError); ok { g.RateLimitErrors.Incr(1) } } -func splitRepositoryName(repositoryName string) (string, string, error) { +func splitRepositoryName(repositoryName string) (owner string, repository string, err error) { splits := strings.SplitN(repositoryName, "/", 2) if len(splits) != 2 { @@ -191,7 +192,7 @@ func splitRepositoryName(repositoryName string) (string, string, error) { return splits[0], splits[1], nil } -func getLicense(rI *github.Repository) string { +func getLicense(rI *githubLib.Repository) string { if licenseName := rI.GetLicense().GetName(); licenseName != "" { return licenseName } @@ -199,7 +200,7 @@ func getLicense(rI *github.Repository) string { return "None" } -func getTags(repositoryInfo *github.Repository) map[string]string { +func getTags(repositoryInfo *githubLib.Repository) map[string]string { return map[string]string{ "owner": repositoryInfo.GetOwner().GetLogin(), "name": repositoryInfo.GetName(), @@ -208,7 +209,7 @@ func getTags(repositoryInfo *github.Repository) map[string]string { } } -func getFields(repositoryInfo *github.Repository) map[string]interface{} { +func getFields(repositoryInfo *githubLib.Repository) map[string]interface{} { return map[string]interface{}{ "stars": repositoryInfo.GetStargazersCount(), "subscribers": repositoryInfo.GetSubscribersCount(), @@ -221,9 +222,9 @@ func getFields(repositoryInfo *github.Repository) map[string]interface{} { } func (g *GitHub) getPullRequestFields(ctx context.Context, owner, repo string) (map[string]interface{}, error) { - options := github.SearchOptions{ + options := githubLib.SearchOptions{ TextMatch: false, - ListOptions: github.ListOptions{ + ListOptions: githubLib.ListOptions{ PerPage: 100, Page: 1, }, diff --git a/plugins/inputs/gnmi/gnmi.go b/plugins/inputs/gnmi/gnmi.go index 34bea672d7925..a6a3c3a2c6ef3 100644 --- a/plugins/inputs/gnmi/gnmi.go +++ b/plugins/inputs/gnmi/gnmi.go @@ -14,16 +14,17 @@ import ( "sync" "time" + gnmiLib "github.com/openconfig/gnmi/proto/gnmi" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/metadata" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/metric" internaltls "github.com/influxdata/telegraf/plugins/common/tls" "github.com/influxdata/telegraf/plugins/inputs" jsonparser "github.com/influxdata/telegraf/plugins/parsers/json" - "github.com/openconfig/gnmi/proto/gnmi" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/metadata" ) // gNMI plugin instance @@ -51,10 +52,10 @@ type GNMI struct { internaltls.ClientConfig // Internal state - aliases map[string]string - acc telegraf.Accumulator - cancel context.CancelFunc - wg sync.WaitGroup + internalAliases map[string]string + acc telegraf.Accumulator + cancel context.CancelFunc + wg sync.WaitGroup Log telegraf.Logger } @@ -79,7 +80,7 @@ func (c *GNMI) Start(acc telegraf.Accumulator) error { var err error var ctx context.Context var tlscfg *tls.Config - var request *gnmi.SubscribeRequest + var request *gnmiLib.SubscribeRequest c.acc = acc ctx, c.cancel = context.WithCancel(context.Background()) @@ -102,9 +103,9 @@ func (c *GNMI) Start(acc telegraf.Accumulator) error { } // Invert explicit alias list and prefill subscription names - c.aliases = make(map[string]string, len(c.Subscriptions)+len(c.Aliases)) + c.internalAliases = make(map[string]string, len(c.Subscriptions)+len(c.Aliases)) for _, subscription := range c.Subscriptions { - var gnmiLongPath, gnmiShortPath *gnmi.Path + var gnmiLongPath, gnmiShortPath *gnmiLib.Path // Build the subscription path without keys if gnmiLongPath, err = parsePath(subscription.Origin, subscription.Path, ""); err != nil { @@ -129,12 +130,12 @@ func (c *GNMI) Start(acc telegraf.Accumulator) error { name = path.Base(shortPath) } if len(name) > 0 { - c.aliases[longPath] = name - c.aliases[shortPath] = name + c.internalAliases[longPath] = name + c.internalAliases[shortPath] = name } } - for alias, path := range c.Aliases { - c.aliases[path] = alias + for alias, encodingPath := range c.Aliases { + c.internalAliases[encodingPath] = alias } // Create a goroutine for each device, dial and subscribe @@ -158,21 +159,21 @@ func (c *GNMI) Start(acc telegraf.Accumulator) error { } // Create a new gNMI SubscribeRequest -func (c *GNMI) newSubscribeRequest() (*gnmi.SubscribeRequest, error) { +func (c *GNMI) newSubscribeRequest() (*gnmiLib.SubscribeRequest, error) { // Create subscription objects - subscriptions := make([]*gnmi.Subscription, len(c.Subscriptions)) + subscriptions := make([]*gnmiLib.Subscription, len(c.Subscriptions)) for i, subscription := range c.Subscriptions { gnmiPath, err := parsePath(subscription.Origin, subscription.Path, "") if err != nil { return nil, err } - mode, ok := gnmi.SubscriptionMode_value[strings.ToUpper(subscription.SubscriptionMode)] + mode, ok := gnmiLib.SubscriptionMode_value[strings.ToUpper(subscription.SubscriptionMode)] if !ok { return nil, fmt.Errorf("invalid subscription mode %s", subscription.SubscriptionMode) } - subscriptions[i] = &gnmi.Subscription{ + subscriptions[i] = &gnmiLib.Subscription{ Path: gnmiPath, - Mode: gnmi.SubscriptionMode(mode), + Mode: gnmiLib.SubscriptionMode(mode), SampleInterval: uint64(time.Duration(subscription.SampleInterval).Nanoseconds()), SuppressRedundant: subscription.SuppressRedundant, HeartbeatInterval: uint64(time.Duration(subscription.HeartbeatInterval).Nanoseconds()), @@ -189,12 +190,12 @@ func (c *GNMI) newSubscribeRequest() (*gnmi.SubscribeRequest, error) { return nil, fmt.Errorf("unsupported encoding %s", c.Encoding) } - return &gnmi.SubscribeRequest{ - Request: &gnmi.SubscribeRequest_Subscribe{ - Subscribe: &gnmi.SubscriptionList{ + return &gnmiLib.SubscribeRequest{ + Request: &gnmiLib.SubscribeRequest_Subscribe{ + Subscribe: &gnmiLib.SubscriptionList{ Prefix: gnmiPath, - Mode: gnmi.SubscriptionList_STREAM, - Encoding: gnmi.Encoding(gnmi.Encoding_value[strings.ToUpper(c.Encoding)]), + Mode: gnmiLib.SubscriptionList_STREAM, + Encoding: gnmiLib.Encoding(gnmiLib.Encoding_value[strings.ToUpper(c.Encoding)]), Subscription: subscriptions, UpdatesOnly: c.UpdatesOnly, }, @@ -203,7 +204,7 @@ func (c *GNMI) newSubscribeRequest() (*gnmi.SubscribeRequest, error) { } // SubscribeGNMI and extract telemetry data -func (c *GNMI) subscribeGNMI(ctx context.Context, address string, tlscfg *tls.Config, request *gnmi.SubscribeRequest) error { +func (c *GNMI) subscribeGNMI(ctx context.Context, address string, tlscfg *tls.Config, request *gnmiLib.SubscribeRequest) error { var opt grpc.DialOption if tlscfg != nil { opt = grpc.WithTransportCredentials(credentials.NewTLS(tlscfg)) @@ -217,7 +218,7 @@ func (c *GNMI) subscribeGNMI(ctx context.Context, address string, tlscfg *tls.Co } defer client.Close() - subscribeClient, err := gnmi.NewGNMIClient(client).Subscribe(ctx) + subscribeClient, err := gnmiLib.NewGNMIClient(client).Subscribe(ctx) if err != nil { return fmt.Errorf("failed to setup subscription: %v", err) } @@ -233,7 +234,7 @@ func (c *GNMI) subscribeGNMI(ctx context.Context, address string, tlscfg *tls.Co c.Log.Debugf("Connection to gNMI device %s established", address) defer c.Log.Debugf("Connection to gNMI device %s closed", address) for ctx.Err() == nil { - var reply *gnmi.SubscribeResponse + var reply *gnmiLib.SubscribeResponse if reply, err = subscribeClient.Recv(); err != nil { if err != io.EOF && ctx.Err() == nil { return fmt.Errorf("aborted gNMI subscription: %v", err) @@ -246,17 +247,17 @@ func (c *GNMI) subscribeGNMI(ctx context.Context, address string, tlscfg *tls.Co return nil } -func (c *GNMI) handleSubscribeResponse(address string, reply *gnmi.SubscribeResponse) { +func (c *GNMI) handleSubscribeResponse(address string, reply *gnmiLib.SubscribeResponse) { switch response := reply.Response.(type) { - case *gnmi.SubscribeResponse_Update: + case *gnmiLib.SubscribeResponse_Update: c.handleSubscribeResponseUpdate(address, response) - case *gnmi.SubscribeResponse_Error: + case *gnmiLib.SubscribeResponse_Error: c.Log.Errorf("Subscribe error (%d), %q", response.Error.Code, response.Error.Message) } } // Handle SubscribeResponse_Update message from gNMI and parse contained telemetry data -func (c *GNMI) handleSubscribeResponseUpdate(address string, response *gnmi.SubscribeResponse_Update) { +func (c *GNMI) handleSubscribeResponseUpdate(address string, response *gnmiLib.SubscribeResponse_Update) { var prefix, prefixAliasPath string grouper := metric.NewSeriesGrouper() timestamp := time.Unix(0, response.Update.Timestamp) @@ -289,7 +290,7 @@ func (c *GNMI) handleSubscribeResponseUpdate(address string, response *gnmi.Subs // Lookup alias if alias-path has changed if aliasPath != lastAliasPath { name = prefix - if alias, ok := c.aliases[aliasPath]; ok { + if alias, ok := c.internalAliases[aliasPath]; ok { name = alias } else { c.Log.Debugf("No measurement alias for gNMI path: %s", name) @@ -325,13 +326,13 @@ func (c *GNMI) handleSubscribeResponseUpdate(address string, response *gnmi.Subs } // Add grouped measurements - for _, metric := range grouper.Metrics() { - c.acc.AddMetric(metric) + for _, metricToAdd := range grouper.Metrics() { + c.acc.AddMetric(metricToAdd) } } // HandleTelemetryField and add it to a measurement -func (c *GNMI) handleTelemetryField(update *gnmi.Update, tags map[string]string, prefix string) (string, map[string]interface{}) { +func (c *GNMI) handleTelemetryField(update *gnmiLib.Update, tags map[string]string, prefix string) (string, map[string]interface{}) { gpath, aliasPath, err := c.handlePath(update.Path, tags, prefix) if err != nil { c.Log.Errorf("handling path %q failed: %v", update.Path, err) @@ -347,25 +348,25 @@ func (c *GNMI) handleTelemetryField(update *gnmi.Update, tags map[string]string, } switch val := update.Val.Value.(type) { - case *gnmi.TypedValue_AsciiVal: + case *gnmiLib.TypedValue_AsciiVal: value = val.AsciiVal - case *gnmi.TypedValue_BoolVal: + case *gnmiLib.TypedValue_BoolVal: value = val.BoolVal - case *gnmi.TypedValue_BytesVal: + case *gnmiLib.TypedValue_BytesVal: value = val.BytesVal - case *gnmi.TypedValue_DecimalVal: + case *gnmiLib.TypedValue_DecimalVal: value = float64(val.DecimalVal.Digits) / math.Pow(10, float64(val.DecimalVal.Precision)) - case *gnmi.TypedValue_FloatVal: + case *gnmiLib.TypedValue_FloatVal: value = val.FloatVal - case *gnmi.TypedValue_IntVal: + case *gnmiLib.TypedValue_IntVal: value = val.IntVal - case *gnmi.TypedValue_StringVal: + case *gnmiLib.TypedValue_StringVal: value = val.StringVal - case *gnmi.TypedValue_UintVal: + case *gnmiLib.TypedValue_UintVal: value = val.UintVal - case *gnmi.TypedValue_JsonIetfVal: + case *gnmiLib.TypedValue_JsonIetfVal: jsondata = val.JsonIetfVal - case *gnmi.TypedValue_JsonVal: + case *gnmiLib.TypedValue_JsonVal: jsondata = val.JsonVal } @@ -387,13 +388,12 @@ func (c *GNMI) handleTelemetryField(update *gnmi.Update, tags map[string]string, } // Parse path to path-buffer and tag-field -func (c *GNMI) handlePath(path *gnmi.Path, tags map[string]string, prefix string) (string, string, error) { - var aliasPath string +func (c *GNMI) handlePath(gnmiPath *gnmiLib.Path, tags map[string]string, prefix string) (pathBuffer string, aliasPath string, err error) { builder := bytes.NewBufferString(prefix) // Prefix with origin - if len(path.Origin) > 0 { - if _, err := builder.WriteString(path.Origin); err != nil { + if len(gnmiPath.Origin) > 0 { + if _, err := builder.WriteString(gnmiPath.Origin); err != nil { return "", "", err } if _, err := builder.WriteRune(':'); err != nil { @@ -402,7 +402,7 @@ func (c *GNMI) handlePath(path *gnmi.Path, tags map[string]string, prefix string } // Parse generic keys from prefix - for _, elem := range path.Elem { + for _, elem := range gnmiPath.Elem { if len(elem.Name) > 0 { if _, err := builder.WriteRune('/'); err != nil { return "", "", err @@ -413,7 +413,7 @@ func (c *GNMI) handlePath(path *gnmi.Path, tags map[string]string, prefix string } name := builder.String() - if _, exists := c.aliases[name]; exists { + if _, exists := c.internalAliases[name]; exists { aliasPath = name } @@ -435,21 +435,21 @@ func (c *GNMI) handlePath(path *gnmi.Path, tags map[string]string, prefix string } //ParsePath from XPath-like string to gNMI path structure -func parsePath(origin string, path string, target string) (*gnmi.Path, error) { +func parsePath(origin string, pathToParse string, target string) (*gnmiLib.Path, error) { var err error - gnmiPath := gnmi.Path{Origin: origin, Target: target} + gnmiPath := gnmiLib.Path{Origin: origin, Target: target} - if len(path) > 0 && path[0] != '/' { - return nil, fmt.Errorf("path does not start with a '/': %s", path) + if len(pathToParse) > 0 && pathToParse[0] != '/' { + return nil, fmt.Errorf("path does not start with a '/': %s", pathToParse) } - elem := &gnmi.PathElem{} + elem := &gnmiLib.PathElem{} start, name, value, end := 0, -1, -1, -1 - path = path + "/" + pathToParse = pathToParse + "/" - for i := 0; i < len(path); i++ { - if path[i] == '[' { + for i := 0; i < len(pathToParse); i++ { + if pathToParse[i] == '[' { if name >= 0 { break } @@ -458,37 +458,37 @@ func parsePath(origin string, path string, target string) (*gnmi.Path, error) { elem.Key = make(map[string]string) } name = i + 1 - } else if path[i] == '=' { + } else if pathToParse[i] == '=' { if name <= 0 || value >= 0 { break } value = i + 1 - } else if path[i] == ']' { + } else if pathToParse[i] == ']' { if name <= 0 || value <= name { break } - elem.Key[path[name:value-1]] = strings.Trim(path[value:i], "'\"") + elem.Key[pathToParse[name:value-1]] = strings.Trim(pathToParse[value:i], "'\"") name, value = -1, -1 - } else if path[i] == '/' { + } else if pathToParse[i] == '/' { if name < 0 { if end < 0 { end = i } if end > start { - elem.Name = path[start:end] + elem.Name = pathToParse[start:end] gnmiPath.Elem = append(gnmiPath.Elem, elem) - gnmiPath.Element = append(gnmiPath.Element, path[start:i]) + gnmiPath.Element = append(gnmiPath.Element, pathToParse[start:i]) } start, name, value, end = i+1, -1, -1, -1 - elem = &gnmi.PathElem{} + elem = &gnmiLib.PathElem{} } } } if name >= 0 || value >= 0 { - err = fmt.Errorf("Invalid gNMI path: %s", path) + err = fmt.Errorf("Invalid gNMI path: %s", pathToParse) } if err != nil { diff --git a/plugins/inputs/gnmi/gnmi_test.go b/plugins/inputs/gnmi/gnmi_test.go index cfc43e8246186..17a955c4875dc 100644 --- a/plugins/inputs/gnmi/gnmi_test.go +++ b/plugins/inputs/gnmi/gnmi_test.go @@ -9,54 +9,54 @@ import ( "testing" "time" - "github.com/influxdata/telegraf" - "github.com/influxdata/telegraf/config" - "github.com/influxdata/telegraf/testutil" - "github.com/openconfig/gnmi/proto/gnmi" - "github.com/stretchr/testify/assert" + gnmiLib "github.com/openconfig/gnmi/proto/gnmi" "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/metadata" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/config" + "github.com/influxdata/telegraf/testutil" ) func TestParsePath(t *testing.T) { path := "/foo/bar/bla[shoo=woo][shoop=/woop/]/z" parsed, err := parsePath("theorigin", path, "thetarget") - assert.NoError(t, err) - assert.Equal(t, parsed.Origin, "theorigin") - assert.Equal(t, parsed.Target, "thetarget") - assert.Equal(t, parsed.Element, []string{"foo", "bar", "bla[shoo=woo][shoop=/woop/]", "z"}) - assert.Equal(t, parsed.Elem, []*gnmi.PathElem{{Name: "foo"}, {Name: "bar"}, - {Name: "bla", Key: map[string]string{"shoo": "woo", "shoop": "/woop/"}}, {Name: "z"}}) + require.NoError(t, err) + require.Equal(t, "theorigin", parsed.Origin) + require.Equal(t, "thetarget", parsed.Target) + require.Equal(t, []string{"foo", "bar", "bla[shoo=woo][shoop=/woop/]", "z"}, parsed.Element) + require.Equal(t, []*gnmiLib.PathElem{{Name: "foo"}, {Name: "bar"}, + {Name: "bla", Key: map[string]string{"shoo": "woo", "shoop": "/woop/"}}, {Name: "z"}}, parsed.Elem) parsed, err = parsePath("", "", "") - assert.NoError(t, err) - assert.Equal(t, *parsed, gnmi.Path{}) + require.NoError(t, err) + require.Equal(t, gnmiLib.Path{}, *parsed) parsed, err = parsePath("", "/foo[[", "") - assert.Nil(t, parsed) - assert.Equal(t, errors.New("Invalid gNMI path: /foo[[/"), err) + require.Nil(t, parsed) + require.Equal(t, errors.New("Invalid gNMI path: /foo[[/"), err) } type MockServer struct { - SubscribeF func(gnmi.GNMI_SubscribeServer) error + SubscribeF func(gnmiLib.GNMI_SubscribeServer) error GRPCServer *grpc.Server } -func (s *MockServer) Capabilities(context.Context, *gnmi.CapabilityRequest) (*gnmi.CapabilityResponse, error) { +func (s *MockServer) Capabilities(context.Context, *gnmiLib.CapabilityRequest) (*gnmiLib.CapabilityResponse, error) { return nil, nil } -func (s *MockServer) Get(context.Context, *gnmi.GetRequest) (*gnmi.GetResponse, error) { +func (s *MockServer) Get(context.Context, *gnmiLib.GetRequest) (*gnmiLib.GetResponse, error) { return nil, nil } -func (s *MockServer) Set(context.Context, *gnmi.SetRequest) (*gnmi.SetResponse, error) { +func (s *MockServer) Set(context.Context, *gnmiLib.SetRequest) (*gnmiLib.SetResponse, error) { return nil, nil } -func (s *MockServer) Subscribe(server gnmi.GNMI_SubscribeServer) error { +func (s *MockServer) Subscribe(server gnmiLib.GNMI_SubscribeServer) error { return s.SubscribeF(server) } @@ -66,12 +66,12 @@ func TestWaitError(t *testing.T) { grpcServer := grpc.NewServer() gnmiServer := &MockServer{ - SubscribeF: func(server gnmi.GNMI_SubscribeServer) error { + SubscribeF: func(server gnmiLib.GNMI_SubscribeServer) error { return fmt.Errorf("testerror") }, GRPCServer: grpcServer, } - gnmi.RegisterGNMIServer(grpcServer, gnmiServer) + gnmiLib.RegisterGNMIServer(grpcServer, gnmiServer) plugin := &GNMI{ Log: testutil.Logger{}, @@ -107,7 +107,7 @@ func TestUsernamePassword(t *testing.T) { grpcServer := grpc.NewServer() gnmiServer := &MockServer{ - SubscribeF: func(server gnmi.GNMI_SubscribeServer) error { + SubscribeF: func(server gnmiLib.GNMI_SubscribeServer) error { metadata, ok := metadata.FromIncomingContext(server.Context()) if !ok { return errors.New("failed to get metadata") @@ -127,7 +127,7 @@ func TestUsernamePassword(t *testing.T) { }, GRPCServer: grpcServer, } - gnmi.RegisterGNMIServer(grpcServer, gnmiServer) + gnmiLib.RegisterGNMIServer(grpcServer, gnmiServer) plugin := &GNMI{ Log: testutil.Logger{}, @@ -159,12 +159,12 @@ func TestUsernamePassword(t *testing.T) { errors.New("aborted gNMI subscription: rpc error: code = Unknown desc = success")) } -func mockGNMINotification() *gnmi.Notification { - return &gnmi.Notification{ +func mockGNMINotification() *gnmiLib.Notification { + return &gnmiLib.Notification{ Timestamp: 1543236572000000000, - Prefix: &gnmi.Path{ + Prefix: &gnmiLib.Path{ Origin: "type", - Elem: []*gnmi.PathElem{ + Elem: []*gnmiLib.PathElem{ { Name: "model", Key: map[string]string{"foo": "bar"}, @@ -172,35 +172,35 @@ func mockGNMINotification() *gnmi.Notification { }, Target: "subscription", }, - Update: []*gnmi.Update{ + Update: []*gnmiLib.Update{ { - Path: &gnmi.Path{ - Elem: []*gnmi.PathElem{ + Path: &gnmiLib.Path{ + Elem: []*gnmiLib.PathElem{ {Name: "some"}, { Name: "path", Key: map[string]string{"name": "str", "uint64": "1234"}}, }, }, - Val: &gnmi.TypedValue{Value: &gnmi.TypedValue_IntVal{IntVal: 5678}}, + Val: &gnmiLib.TypedValue{Value: &gnmiLib.TypedValue_IntVal{IntVal: 5678}}, }, { - Path: &gnmi.Path{ - Elem: []*gnmi.PathElem{ + Path: &gnmiLib.Path{ + Elem: []*gnmiLib.PathElem{ {Name: "other"}, {Name: "path"}, }, }, - Val: &gnmi.TypedValue{Value: &gnmi.TypedValue_StringVal{StringVal: "foobar"}}, + Val: &gnmiLib.TypedValue{Value: &gnmiLib.TypedValue_StringVal{StringVal: "foobar"}}, }, { - Path: &gnmi.Path{ - Elem: []*gnmi.PathElem{ + Path: &gnmiLib.Path{ + Elem: []*gnmiLib.PathElem{ {Name: "other"}, {Name: "this"}, }, }, - Val: &gnmi.TypedValue{Value: &gnmi.TypedValue_StringVal{StringVal: "that"}}, + Val: &gnmiLib.TypedValue{Value: &gnmiLib.TypedValue_StringVal{StringVal: "that"}}, }, }, } @@ -229,20 +229,20 @@ func TestNotification(t *testing.T) { }, }, server: &MockServer{ - SubscribeF: func(server gnmi.GNMI_SubscribeServer) error { + SubscribeF: func(server gnmiLib.GNMI_SubscribeServer) error { notification := mockGNMINotification() - err := server.Send(&gnmi.SubscribeResponse{Response: &gnmi.SubscribeResponse_Update{Update: notification}}) + err := server.Send(&gnmiLib.SubscribeResponse{Response: &gnmiLib.SubscribeResponse_Update{Update: notification}}) if err != nil { return err } - err = server.Send(&gnmi.SubscribeResponse{Response: &gnmi.SubscribeResponse_SyncResponse{SyncResponse: true}}) + err = server.Send(&gnmiLib.SubscribeResponse{Response: &gnmiLib.SubscribeResponse_SyncResponse{SyncResponse: true}}) if err != nil { return err } notification.Prefix.Elem[0].Key["foo"] = "bar2" notification.Update[0].Path.Elem[1].Key["name"] = "str2" - notification.Update[0].Val = &gnmi.TypedValue{Value: &gnmi.TypedValue_JsonVal{JsonVal: []byte{'"', '1', '2', '3', '"'}}} - return server.Send(&gnmi.SubscribeResponse{Response: &gnmi.SubscribeResponse_Update{Update: notification}}) + notification.Update[0].Val = &gnmiLib.TypedValue{Value: &gnmiLib.TypedValue_JsonVal{JsonVal: []byte{'"', '1', '2', '3', '"'}}} + return server.Send(&gnmiLib.SubscribeResponse{Response: &gnmiLib.SubscribeResponse_Update{Update: notification}}) }, }, expected: []telegraf.Metric{ @@ -318,14 +318,14 @@ func TestNotification(t *testing.T) { }, }, server: &MockServer{ - SubscribeF: func(server gnmi.GNMI_SubscribeServer) error { - response := &gnmi.SubscribeResponse{ - Response: &gnmi.SubscribeResponse_Update{ - Update: &gnmi.Notification{ + SubscribeF: func(server gnmiLib.GNMI_SubscribeServer) error { + response := &gnmiLib.SubscribeResponse{ + Response: &gnmiLib.SubscribeResponse_Update{ + Update: &gnmiLib.Notification{ Timestamp: 1543236572000000000, - Prefix: &gnmi.Path{ + Prefix: &gnmiLib.Path{ Origin: "type", - Elem: []*gnmi.PathElem{ + Elem: []*gnmiLib.PathElem{ { Name: "state", }, @@ -342,11 +342,11 @@ func TestNotification(t *testing.T) { }, Target: "subscription", }, - Update: []*gnmi.Update{ + Update: []*gnmiLib.Update{ { - Path: &gnmi.Path{}, - Val: &gnmi.TypedValue{ - Value: &gnmi.TypedValue_IntVal{IntVal: 42}, + Path: &gnmiLib.Path{}, + Val: &gnmiLib.TypedValue{ + Value: &gnmiLib.TypedValue_IntVal{IntVal: 42}, }, }, }, @@ -382,7 +382,7 @@ func TestNotification(t *testing.T) { grpcServer := grpc.NewServer() tt.server.GRPCServer = grpcServer - gnmi.RegisterGNMIServer(grpcServer, tt.server) + gnmiLib.RegisterGNMIServer(grpcServer, tt.server) var acc testutil.Accumulator err = tt.plugin.Start(&acc) @@ -424,10 +424,10 @@ func TestSubscribeResponseError(t *testing.T) { ml := &MockLogger{} plugin := &GNMI{Log: ml} // TODO: FIX SA1019: gnmi.Error is deprecated: Do not use. - errorResponse := &gnmi.SubscribeResponse_Error{Error: &gnmi.Error{Message: me, Code: mc}} - plugin.handleSubscribeResponse("127.0.0.1:0", &gnmi.SubscribeResponse{Response: errorResponse}) + errorResponse := &gnmiLib.SubscribeResponse_Error{Error: &gnmiLib.Error{Message: me, Code: mc}} + plugin.handleSubscribeResponse("127.0.0.1:0", &gnmiLib.SubscribeResponse{Response: errorResponse}) require.NotEmpty(t, ml.lastFormat) - require.Equal(t, ml.lastArgs, []interface{}{mc, me}) + require.Equal(t, []interface{}{mc, me}, ml.lastArgs) } func TestRedial(t *testing.T) { @@ -443,13 +443,13 @@ func TestRedial(t *testing.T) { grpcServer := grpc.NewServer() gnmiServer := &MockServer{ - SubscribeF: func(server gnmi.GNMI_SubscribeServer) error { + SubscribeF: func(server gnmiLib.GNMI_SubscribeServer) error { notification := mockGNMINotification() - return server.Send(&gnmi.SubscribeResponse{Response: &gnmi.SubscribeResponse_Update{Update: notification}}) + return server.Send(&gnmiLib.SubscribeResponse{Response: &gnmiLib.SubscribeResponse_Update{Update: notification}}) }, GRPCServer: grpcServer, } - gnmi.RegisterGNMIServer(grpcServer, gnmiServer) + gnmiLib.RegisterGNMIServer(grpcServer, gnmiServer) var wg sync.WaitGroup wg.Add(1) @@ -473,16 +473,16 @@ func TestRedial(t *testing.T) { grpcServer = grpc.NewServer() gnmiServer = &MockServer{ - SubscribeF: func(server gnmi.GNMI_SubscribeServer) error { + SubscribeF: func(server gnmiLib.GNMI_SubscribeServer) error { notification := mockGNMINotification() notification.Prefix.Elem[0].Key["foo"] = "bar2" notification.Update[0].Path.Elem[1].Key["name"] = "str2" - notification.Update[0].Val = &gnmi.TypedValue{Value: &gnmi.TypedValue_BoolVal{BoolVal: false}} - return server.Send(&gnmi.SubscribeResponse{Response: &gnmi.SubscribeResponse_Update{Update: notification}}) + notification.Update[0].Val = &gnmiLib.TypedValue{Value: &gnmiLib.TypedValue_BoolVal{BoolVal: false}} + return server.Send(&gnmiLib.SubscribeResponse{Response: &gnmiLib.SubscribeResponse_Update{Update: notification}}) }, GRPCServer: grpcServer, } - gnmi.RegisterGNMIServer(grpcServer, gnmiServer) + gnmiLib.RegisterGNMIServer(grpcServer, gnmiServer) wg.Add(1) go func() { From f13d7d7329bcb878ac80765f0373036198809f7a Mon Sep 17 00:00:00 2001 From: Marcus Ilgner Date: Tue, 27 Jul 2021 23:32:00 +0200 Subject: [PATCH 50/85] Fix handling bool in sql input plugin (#9540) (cherry picked from commit ecf27ab9560cfa0be55af3cc857d836daf50bcd0) --- internal/type_conversions.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/type_conversions.go b/internal/type_conversions.go index ed4ed374a3ffd..e2506a9068de3 100644 --- a/internal/type_conversions.go +++ b/internal/type_conversions.go @@ -191,6 +191,8 @@ func ToBool(value interface{}) (bool, error) { return v > 0, nil case float64: return v > 0, nil + case bool: + return v, nil case nil: return false, nil } From a6b60399180b72128188f84d8f1d9bb7e995bde3 Mon Sep 17 00:00:00 2001 From: Sven Rebhan <36194019+srebhan@users.noreply.github.com> Date: Tue, 27 Jul 2021 23:39:43 +0200 Subject: [PATCH 51/85] Fix attempt to connect to an empty list of servers. (#9503) (cherry picked from commit 80829b3b5afbd173adf0692be2144015c0508c91) --- plugins/inputs/nsq_consumer/nsq_consumer.go | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/nsq_consumer/nsq_consumer.go b/plugins/inputs/nsq_consumer/nsq_consumer.go index 718a2ed3e321c..34360472ab0b9 100644 --- a/plugins/inputs/nsq_consumer/nsq_consumer.go +++ b/plugins/inputs/nsq_consumer/nsq_consumer.go @@ -2,6 +2,7 @@ package nsq_consumer import ( "context" + "fmt" "sync" "github.com/influxdata/telegraf" @@ -134,15 +135,28 @@ func (n *NSQConsumer) Start(ac telegraf.Accumulator) error { return nil })) + // For backward compatibility + if n.Server != "" { + n.Nsqd = append(n.Nsqd, n.Server) + } + + // Check if we have anything to connect to + if len(n.Nsqlookupd) == 0 && len(n.Nsqd) == 0 { + return fmt.Errorf("either 'nsqd' or 'nsqlookupd' needs to be specified") + } + if len(n.Nsqlookupd) > 0 { err := n.consumer.ConnectToNSQLookupds(n.Nsqlookupd) if err != nil && err != nsq.ErrAlreadyConnected { return err } } - err := n.consumer.ConnectToNSQDs(append(n.Nsqd, n.Server)) - if err != nil && err != nsq.ErrAlreadyConnected { - return err + + if len(n.Nsqd) > 0 { + err := n.consumer.ConnectToNSQDs(n.Nsqd) + if err != nil && err != nsq.ErrAlreadyConnected { + return err + } } n.wg.Add(1) From d77b244787eefa22d94ab310eac3694f14d5c59a Mon Sep 17 00:00:00 2001 From: Alexander Krantz Date: Wed, 28 Jul 2021 13:50:18 -0700 Subject: [PATCH 52/85] Prevent segfault in persistent volume claims (#9549) (cherry picked from commit fdec5f1f3147cac65064852d14c326ae61cf4c99) --- .../kube_inventory/persistentvolumeclaim.go | 8 ++-- .../persistentvolumeclaim_test.go | 46 +++++++++++++++++++ 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/kube_inventory/persistentvolumeclaim.go b/plugins/inputs/kube_inventory/persistentvolumeclaim.go index 10a6abbf72e39..a5d30d6dca6f4 100644 --- a/plugins/inputs/kube_inventory/persistentvolumeclaim.go +++ b/plugins/inputs/kube_inventory/persistentvolumeclaim.go @@ -39,9 +39,11 @@ func (ki *KubernetesInventory) gatherPersistentVolumeClaim(pvc corev1.Persistent "phase": string(pvc.Status.Phase), "storageclass": *pvc.Spec.StorageClassName, } - for key, val := range pvc.Spec.Selector.MatchLabels { - if ki.selectorFilter.Match(key) { - tags["selector_"+key] = val + if pvc.Spec.Selector != nil { + for key, val := range pvc.Spec.Selector.MatchLabels { + if ki.selectorFilter.Match(key) { + tags["selector_"+key] = val + } } } diff --git a/plugins/inputs/kube_inventory/persistentvolumeclaim_test.go b/plugins/inputs/kube_inventory/persistentvolumeclaim_test.go index 796b055f90d9c..b4e468acd71e7 100644 --- a/plugins/inputs/kube_inventory/persistentvolumeclaim_test.go +++ b/plugins/inputs/kube_inventory/persistentvolumeclaim_test.go @@ -88,6 +88,52 @@ func TestPersistentVolumeClaim(t *testing.T) { }, hasError: false, }, + { + name: "no label selectors", + hasError: false, + handler: &mockHandler{ + responseMap: map[string]interface{}{ + "/persistentvolumeclaims/": &corev1.PersistentVolumeClaimList{ + Items: []corev1.PersistentVolumeClaim{ + { + Status: corev1.PersistentVolumeClaimStatus{ + Phase: "bound", + }, + Spec: corev1.PersistentVolumeClaimSpec{ + VolumeName: "pvc-dc870fd6-1e08-11e8-b226-02aa4bc06eb8", + StorageClassName: toStrPtr("ebs-1"), + Selector: nil, + }, + ObjectMeta: metav1.ObjectMeta{ + Namespace: "ns1", + Name: "pc1", + Labels: map[string]string{ + "lab1": "v1", + "lab2": "v2", + }, + CreationTimestamp: metav1.Time{Time: now}, + }, + }, + }, + }, + }, + }, + output: []telegraf.Metric{ + testutil.MustMetric( + "kubernetes_persistentvolumeclaim", + map[string]string{ + "pvc_name": "pc1", + "namespace": "ns1", + "storageclass": "ebs-1", + "phase": "bound", + }, + map[string]interface{}{ + "phase_type": 0, + }, + time.Unix(0, 0), + ), + }, + }, } for _, v := range tests { From a9a95b4db498db3394b17a8fa24bd3796592f413 Mon Sep 17 00:00:00 2001 From: Mya Date: Wed, 28 Jul 2021 14:55:23 -0600 Subject: [PATCH 53/85] Fix metrics reported as written but not actually written (#9526) (cherry picked from commit 8d2b1e8dc1899685657ccb99d72327dd29d8978e) --- plugins/outputs/influxdb/http_test.go | 17 +++++++++++++++++ plugins/outputs/influxdb/influxdb.go | 24 ++++++++++++++---------- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/plugins/outputs/influxdb/http_test.go b/plugins/outputs/influxdb/http_test.go index 39ac2b108da91..e19d8d2e580c9 100644 --- a/plugins/outputs/influxdb/http_test.go +++ b/plugins/outputs/influxdb/http_test.go @@ -1077,6 +1077,19 @@ func TestDBRPTagsCreateDatabaseCalledOnDatabaseNotFound(t *testing.T) { handlers := &MockHandlerChain{ handlers: []http.HandlerFunc{ + func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/query": + if r.FormValue("q") != `CREATE DATABASE "telegraf"` { + w.WriteHeader(http.StatusInternalServerError) + return + } + w.WriteHeader(http.StatusForbidden) + w.Write([]byte(`{"results": [{"error": "error authorizing query"}]}`)) + default: + w.WriteHeader(http.StatusInternalServerError) + } + }, func(w http.ResponseWriter, r *http.Request) { switch r.URL.Path { case "/write": @@ -1133,8 +1146,12 @@ func TestDBRPTagsCreateDatabaseCalledOnDatabaseNotFound(t *testing.T) { err = output.Connect() require.NoError(t, err) + + // this write fails, but we're expecting it to drop the metrics and not retry, so no error. err = output.Write(metrics) require.NoError(t, err) + + // expects write to succeed err = output.Write(metrics) require.NoError(t, err) diff --git a/plugins/outputs/influxdb/influxdb.go b/plugins/outputs/influxdb/influxdb.go index 36b38a9c906c5..1ea39a5e56505 100644 --- a/plugins/outputs/influxdb/influxdb.go +++ b/plugins/outputs/influxdb/influxdb.go @@ -1,3 +1,4 @@ +//nolint package influxdb import ( @@ -224,17 +225,20 @@ func (i *InfluxDB) Write(metrics []telegraf.Metric) error { switch apiError := err.(type) { case *DatabaseNotFoundError: - if !i.SkipDatabaseCreation { - allErrorsAreDatabaseNotFoundErrors = false - err := client.CreateDatabase(ctx, apiError.Database) - if err != nil { - i.Log.Errorf("When writing to [%s]: database %q not found and failed to recreate", - client.URL(), apiError.Database) - } else { - // try another client, if all clients fail with this error, do not return error - continue - } + if i.SkipDatabaseCreation { + continue } + // retry control + // error so the write is retried + err := client.CreateDatabase(ctx, apiError.Database) + if err != nil { + i.Log.Errorf("When writing to [%s]: database %q not found and failed to recreate", + client.URL(), apiError.Database) + } else { + return errors.New("database created; retry write") + } + default: + allErrorsAreDatabaseNotFoundErrors = false } } From baf84f0e83c4d2d0c4f00577dcdbba3d2fc68388 Mon Sep 17 00:00:00 2001 From: Daniel Dyla Date: Tue, 15 Jun 2021 17:13:34 -0400 Subject: [PATCH 54/85] Update dynatrace output (#9363) - export timestamps - enrich dimensions with OneAgent data - Add default dimensions feature --- plugins/outputs/dynatrace/README.md | 32 ++-- plugins/outputs/dynatrace/dynatrace.go | 24 ++- plugins/outputs/dynatrace/dynatrace_test.go | 158 ++++++++++++++++++-- 3 files changed, 183 insertions(+), 31 deletions(-) diff --git a/plugins/outputs/dynatrace/README.md b/plugins/outputs/dynatrace/README.md index 5f25c70026177..666f821f6356c 100644 --- a/plugins/outputs/dynatrace/README.md +++ b/plugins/outputs/dynatrace/README.md @@ -16,7 +16,7 @@ The Dynatrace exporter may be enabled by adding an `[[outputs.dynatrace]]` secti All configurations are optional, but if a `url` other than the OneAgent metric ingestion endpoint is specified then an `api_token` is required. To see all available options, see [Configuration](#configuration) below. -### Running alongside Dynatrace OneAgent +### Running alongside Dynatrace OneAgent (preferred) If you run the Telegraf agent on a host or VM that is monitored by the Dynatrace OneAgent then you only need to enable the plugin, but need no further configuration. The Dynatrace Telegraf output plugin will send all metrics to the OneAgent which will use its secure and load balanced connection to send the metrics to your Dynatrace SaaS or Managed environment. Depending on your environment, you might have to enable metrics ingestion on the OneAgent first as described in the [Dynatrace documentation](https://www.dynatrace.com/support/help/how-to-use-dynatrace/metrics/metric-ingestion/ingestion-methods/telegraf/). @@ -28,7 +28,7 @@ Note: The name and identifier of the host running Telegraf will be added as a di ## No options are required. By default, metrics will be exported via the OneAgent on the local host. ``` -## Running standalone +### Running standalone If you run the Telegraf agent on a host or VM without a OneAgent you will need to configure the environment API endpoint to send the metrics to and an API token for security. @@ -55,14 +55,6 @@ You can learn more about how to use the Dynatrace API [here](https://www.dynatra ## Configuration -### `url` - -*required*: `false` - -*default*: Local OneAgent endpoint - -Set your Dynatrace environment URL (e.g.: `https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/ingest`) if you do not use a OneAgent or wish to export metrics directly to a Dynatrace metrics v2 endpoint. If a URL is set to anything other than the local OneAgent endpoint, then an API token is required. - ```toml [[outputs.dynatrace]] ## Leave empty or use the local ingest endpoint of your OneAgent monitored host (e.g.: http://127.0.0.1:14499/metrics/ingest). @@ -75,6 +67,21 @@ Set your Dynatrace environment URL (e.g.: `https://{your-environment-id}.live.dy insecure_skip_verify = false ## If you want to convert values represented as gauges to counters, add the metric names here additional_counters = [ ] + + ## Optional dimensions to be added to every metric + [outputs.dynatrace.default_dimensions] + default_key = "default value" +``` + +### `url` + +*required*: `false` + +*default*: Local OneAgent endpoint + +Set your Dynatrace environment URL (e.g.: `https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/ingest`, see the [Dynatrace documentation](https://www.dynatrace.com/support/help/dynatrace-api/environment-api/metric-v2/post-ingest-metrics/) for details) if you do not use a OneAgent or wish to export metrics directly to a Dynatrace metrics v2 endpoint. If a URL is set to anything other than the local OneAgent endpoint, then an API token is required. + +```toml url = "https://{your-environment-id}.live.dynatrace.com/api/v2/metrics/ingest" ``` @@ -125,9 +132,8 @@ additional_counters = [ ] Default dimensions that will be added to every exported metric. ```toml -default_dimensions = { - key = "value" -} +[outputs.dynatrace.default_dimensions] +default_key = "default value" ``` ## Limitations diff --git a/plugins/outputs/dynatrace/dynatrace.go b/plugins/outputs/dynatrace/dynatrace.go index f9a00b4b02b2b..c66bc8da2171e 100644 --- a/plugins/outputs/dynatrace/dynatrace.go +++ b/plugins/outputs/dynatrace/dynatrace.go @@ -20,12 +20,16 @@ import ( // Dynatrace Configuration for the Dynatrace output plugin type Dynatrace struct { - URL string `toml:"url"` - APIToken string `toml:"api_token"` - Prefix string `toml:"prefix"` - Log telegraf.Logger `toml:"-"` - Timeout config.Duration `toml:"timeout"` - AddCounterMetrics []string `toml:"additional_counters"` + URL string `toml:"url"` + APIToken string `toml:"api_token"` + Prefix string `toml:"prefix"` + Log telegraf.Logger `toml:"-"` + Timeout config.Duration `toml:"timeout"` + AddCounterMetrics []string `toml:"additional_counters"` + DefaultDimensions map[string]string `toml:"default_dimensions"` + + normalizedDefaultDimensions dimensions.NormalizedDimensionList + normalizedStaticDimensions dimensions.NormalizedDimensionList tls.ClientConfig @@ -67,6 +71,10 @@ const sampleConfig = ` ## If you want to convert values represented as gauges to counters, add the metric names here additional_counters = [ ] + + ## Optional dimensions to be added to every metric + # [outputs.dynatrace.default_dimensions] + # default_key = "default value" ` // Connect Connects the Dynatrace output plugin to the Telegraf stream @@ -140,10 +148,12 @@ func (d *Dynatrace) Write(metrics []telegraf.Metric) error { dtMetric.WithPrefix(d.Prefix), dtMetric.WithDimensions( dimensions.MergeLists( - // dimensions.NewNormalizedDimensionList(e.opts.DefaultDimensions...), + d.normalizedDefaultDimensions, dimensions.NewNormalizedDimensionList(dims...), + d.normalizedStaticDimensions, ), ), + dtMetric.WithTimestamp(tm.Time()), typeOpt, ) diff --git a/plugins/outputs/dynatrace/dynatrace_test.go b/plugins/outputs/dynatrace/dynatrace_test.go index fc0f58107896f..d9076906c1020 100644 --- a/plugins/outputs/dynatrace/dynatrace_test.go +++ b/plugins/outputs/dynatrace/dynatrace_test.go @@ -10,6 +10,7 @@ import ( "time" "github.com/dynatrace-oss/dynatrace-metric-utils-go/metric/apiconstants" + "github.com/dynatrace-oss/dynatrace-metric-utils-go/metric/dimensions" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/config" "github.com/influxdata/telegraf/metric" @@ -121,13 +122,13 @@ func TestMissingAPIToken(t *testing.T) { require.Error(t, err) } -func TestSendMetric(t *testing.T) { +func TestSendMetrics(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { // check the encoded result bodyBytes, err := ioutil.ReadAll(r.Body) require.NoError(t, err) bodyString := string(bodyBytes) - expected := "mymeasurement.myfield,host=192.168.0.1 gauge,3.14\nmymeasurement.value,host=192.168.0.2 count,3.14" + expected := "mymeasurement.myfield,dt.metrics.source=telegraf gauge,3.14 1289430000000\nmymeasurement.value,dt.metrics.source=telegraf count,3.14 1289430000000" if bodyString != expected { t.Errorf("Metric encoding failed. expected: %#v but got: %#v", expected, bodyString) } @@ -151,14 +152,14 @@ func TestSendMetric(t *testing.T) { m1 := metric.New( "mymeasurement", - map[string]string{"host": "192.168.0.1"}, + map[string]string{}, map[string]interface{}{"myfield": float64(3.14)}, time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC), ) m2 := metric.New( "mymeasurement", - map[string]string{"host": "192.168.0.2"}, + map[string]string{}, map[string]interface{}{"value": float64(3.14)}, time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC), telegraf.Counter, @@ -176,11 +177,14 @@ func TestSendSingleMetricWithUnorderedTags(t *testing.T) { bodyBytes, err := ioutil.ReadAll(r.Body) require.NoError(t, err) bodyString := string(bodyBytes) + // use regex because dimension order isn't guaranteed + require.Equal(t, len(bodyString), 94) require.Regexp(t, regexp.MustCompile(`^mymeasurement\.myfield`), bodyString) require.Regexp(t, regexp.MustCompile(`a=test`), bodyString) require.Regexp(t, regexp.MustCompile(`b=test`), bodyString) require.Regexp(t, regexp.MustCompile(`c=test`), bodyString) - require.Regexp(t, regexp.MustCompile(`gauge,3.14$`), bodyString) + require.Regexp(t, regexp.MustCompile(`dt.metrics.source=telegraf`), bodyString) + require.Regexp(t, regexp.MustCompile(`gauge,3.14 1289430000000$`), bodyString) w.WriteHeader(http.StatusOK) err = json.NewEncoder(w).Encode(`{"linesOk":1,"linesInvalid":0,"error":null}`) require.NoError(t, err) @@ -219,7 +223,7 @@ func TestSendMetricWithoutTags(t *testing.T) { bodyBytes, err := ioutil.ReadAll(r.Body) require.NoError(t, err) bodyString := string(bodyBytes) - expected := "mymeasurement.myfield gauge,3.14" + expected := "mymeasurement.myfield,dt.metrics.source=telegraf gauge,3.14 1289430000000" if bodyString != expected { t.Errorf("Metric encoding failed. expected: %#v but got: %#v", expected, bodyString) } @@ -261,13 +265,14 @@ func TestSendMetricWithUpperCaseTagKeys(t *testing.T) { require.NoError(t, err) bodyString := string(bodyBytes) - // expected := "mymeasurement.myfield,b_b=test,ccc=test,aaa=test gauge,3.14" // use regex because dimension order isn't guaranteed + require.Equal(t, len(bodyString), 100) require.Regexp(t, regexp.MustCompile(`^mymeasurement\.myfield`), bodyString) require.Regexp(t, regexp.MustCompile(`aaa=test`), bodyString) require.Regexp(t, regexp.MustCompile(`b_b=test`), bodyString) require.Regexp(t, regexp.MustCompile(`ccc=test`), bodyString) - require.Regexp(t, regexp.MustCompile(`gauge,3.14$`), bodyString) + require.Regexp(t, regexp.MustCompile(`dt.metrics.source=telegraf`), bodyString) + require.Regexp(t, regexp.MustCompile(`gauge,3.14 1289430000000$`), bodyString) err = json.NewEncoder(w).Encode(`{"linesOk":1,"linesInvalid":0,"error":null}`) require.NoError(t, err) @@ -307,8 +312,9 @@ func TestSendBooleanMetricWithoutTags(t *testing.T) { require.NoError(t, err) bodyString := string(bodyBytes) // use regex because field order isn't guaranteed - require.Contains(t, bodyString, "mymeasurement.yes gauge,1") - require.Contains(t, bodyString, "mymeasurement.no gauge,0") + require.Equal(t, len(bodyString), 132) + require.Contains(t, bodyString, "mymeasurement.yes,dt.metrics.source=telegraf gauge,1 1289430000000") + require.Contains(t, bodyString, "mymeasurement.no,dt.metrics.source=telegraf gauge,0 1289430000000") err = json.NewEncoder(w).Encode(`{"linesOk":1,"linesInvalid":0,"error":null}`) require.NoError(t, err) })) @@ -339,6 +345,136 @@ func TestSendBooleanMetricWithoutTags(t *testing.T) { require.NoError(t, err) } +func TestSendMetricWithDefaultDimensions(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + // check the encoded result + bodyBytes, err := ioutil.ReadAll(r.Body) + require.NoError(t, err) + bodyString := string(bodyBytes) + // use regex because field order isn't guaranteed + require.Equal(t, len(bodyString), 79) + require.Regexp(t, regexp.MustCompile("^mymeasurement.value"), bodyString) + require.Regexp(t, regexp.MustCompile("dt.metrics.source=telegraf"), bodyString) + require.Regexp(t, regexp.MustCompile("dim=value"), bodyString) + require.Regexp(t, regexp.MustCompile("gauge,32 1289430000000$"), bodyString) + err = json.NewEncoder(w).Encode(`{"linesOk":1,"linesInvalid":0,"error":null}`) + require.NoError(t, err) + })) + defer ts.Close() + + d := &Dynatrace{DefaultDimensions: map[string]string{"dim": "value"}} + + d.URL = ts.URL + d.APIToken = "123" + d.Log = testutil.Logger{} + err := d.Init() + require.NoError(t, err) + err = d.Connect() + require.NoError(t, err) + + // Init metrics + + m1 := metric.New( + "mymeasurement", + map[string]string{}, + map[string]interface{}{"value": 32}, + time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC), + ) + + metrics := []telegraf.Metric{m1} + + err = d.Write(metrics) + require.NoError(t, err) +} + +func TestMetricDimensionsOverrideDefault(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + // check the encoded result + bodyBytes, err := ioutil.ReadAll(r.Body) + require.NoError(t, err) + bodyString := string(bodyBytes) + // use regex because field order isn't guaranteed + require.Equal(t, len(bodyString), 80) + require.Regexp(t, regexp.MustCompile("^mymeasurement.value"), bodyString) + require.Regexp(t, regexp.MustCompile("dt.metrics.source=telegraf"), bodyString) + require.Regexp(t, regexp.MustCompile("dim=metric"), bodyString) + require.Regexp(t, regexp.MustCompile("gauge,32 1289430000000$"), bodyString) + err = json.NewEncoder(w).Encode(`{"linesOk":1,"linesInvalid":0,"error":null}`) + require.NoError(t, err) + })) + defer ts.Close() + + d := &Dynatrace{DefaultDimensions: map[string]string{"dim": "default"}} + + d.URL = ts.URL + d.APIToken = "123" + d.Log = testutil.Logger{} + err := d.Init() + require.NoError(t, err) + err = d.Connect() + require.NoError(t, err) + + // Init metrics + + m1 := metric.New( + "mymeasurement", + map[string]string{"dim": "metric"}, + map[string]interface{}{"value": 32}, + time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC), + ) + + metrics := []telegraf.Metric{m1} + + err = d.Write(metrics) + require.NoError(t, err) +} + +func TestStaticDimensionsOverrideMetric(t *testing.T) { + ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + // check the encoded result + bodyBytes, err := ioutil.ReadAll(r.Body) + require.NoError(t, err) + bodyString := string(bodyBytes) + // use regex because field order isn't guaranteed + require.Equal(t, len(bodyString), 53) + require.Regexp(t, regexp.MustCompile("^mymeasurement.value"), bodyString) + require.Regexp(t, regexp.MustCompile("dim=static"), bodyString) + require.Regexp(t, regexp.MustCompile("gauge,32 1289430000000$"), bodyString) + err = json.NewEncoder(w).Encode(`{"linesOk":1,"linesInvalid":0,"error":null}`) + require.NoError(t, err) + })) + defer ts.Close() + + d := &Dynatrace{DefaultDimensions: map[string]string{"dim": "default"}} + + d.URL = ts.URL + d.APIToken = "123" + d.Log = testutil.Logger{} + err := d.Init() + require.NoError(t, err) + err = d.Connect() + require.NoError(t, err) + + d.normalizedStaticDimensions = dimensions.NewNormalizedDimensionList(dimensions.NewDimension("dim", "static")) + + // Init metrics + + m1 := metric.New( + "mymeasurement", + map[string]string{"dim": "metric"}, + map[string]interface{}{"value": 32}, + time.Date(2010, time.November, 10, 23, 0, 0, 0, time.UTC), + ) + + metrics := []telegraf.Metric{m1} + + err = d.Write(metrics) + require.NoError(t, err) +} + func TestSendCounterMetricWithoutTags(t *testing.T) { ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusOK) @@ -346,7 +482,7 @@ func TestSendCounterMetricWithoutTags(t *testing.T) { bodyBytes, err := ioutil.ReadAll(r.Body) require.NoError(t, err) bodyString := string(bodyBytes) - expected := "mymeasurement.value gauge,32" + expected := "mymeasurement.value,dt.metrics.source=telegraf gauge,32 1289430000000" if bodyString != expected { t.Errorf("Metric encoding failed. expected: %#v but got: %#v", expected, bodyString) } From 17a0a6430c2e30bb4b89975df922da9079a2277d Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 28 Jul 2021 16:47:33 -0600 Subject: [PATCH 55/85] update build version --- build_version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_version.txt b/build_version.txt index 66e2ae6c25cd6..836ae4eda2992 100644 --- a/build_version.txt +++ b/build_version.txt @@ -1 +1 @@ -1.19.1 +1.19.2 From 0e5741eda7c819b3089aefd2fda6662ed499a837 Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 28 Jul 2021 17:10:26 -0600 Subject: [PATCH 56/85] Update changelog --- CHANGELOG.md | 33 +++++++++++++++++++++++++++++++++ etc/telegraf.conf | 7 ++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dcf1617400e1..f7ecd8d59ed24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,36 @@ +## v1.19.2 [2021-07-28] + +#### Release Notes + + - [#9542](https://github.com/influxdata/telegraf/pull/9542) Update Go to v1.16.6 + +#### Bugfixes + + - [#9363](https://github.com/influxdata/telegraf/pull/9363) `outputs.dynatrace` Update dynatrace output to allow optional default dimensions + - [#9526](https://github.com/influxdata/telegraf/pull/9526) `outputs.influxdb` Fix metrics reported as written but not actually written + - [#9549](https://github.com/influxdata/telegraf/pull/9549) `inputs.kube_inventory` Prevent segfault in persistent volume claims + - [#9503](https://github.com/influxdata/telegraf/pull/9503) `inputs.nsq_consumer` Fix connection error when not using server setting + - [#9540](https://github.com/influxdata/telegraf/pull/9540) `inputs.sql` Fix handling bool column + - [#9387](https://github.com/influxdata/telegraf/pull/9387) Linter fixes for plugins/inputs/[fg]* + - [#9438](https://github.com/influxdata/telegraf/pull/9438) `inputs.kubernetes` Attach the pod labels to kubernetes_pod_volume and kubernetes_pod_network metrics + - [#9519](https://github.com/influxdata/telegraf/pull/9519) `processors.ifname` Fix SNMP empty metric name + - [#8587](https://github.com/influxdata/telegraf/pull/8587) `inputs.sqlserver` Add tempdb troubleshooting stats and missing V2 query metrics + - [#9323](https://github.com/influxdata/telegraf/pull/9323) `inputs.x509_cert` Prevent x509_cert from hanging on UDP connection + - [#9504](https://github.com/influxdata/telegraf/pull/9504) `parsers.json_v2` Simplify how nesting is handled + - [#9493](https://github.com/influxdata/telegraf/pull/9493) `inputs.mongodb` Switch to official mongo-go-driver module to fix SSL auth failure + - [#9491](https://github.com/influxdata/telegraf/pull/9491) `outputs.dynatrace` Fix panic caused by uninitialized loggedMetrics map + - [#9497](https://github.com/influxdata/telegraf/pull/9497) `inputs.prometheus` Fix prometheus cadvisor authentication + - [#9520](https://github.com/influxdata/telegraf/pull/9520) `parsers.json_v2` Add support for large uint64 and int64 numbers + - [#9447](https://github.com/influxdata/telegraf/pull/9447) `inputs.statsd` Fix regression that didn't allow integer percentiles + - [#9466](https://github.com/influxdata/telegraf/pull/9466) `inputs.sqlserver` Provide detailed error message in telegraf log + - [#9399](https://github.com/influxdata/telegraf/pull/9399) Update dynatrace-metric-utils-go module to v0.2.0 + - [#8108](https://github.com/influxdata/telegraf/pull/8108) `inputs.cgroup` Allow multiple keys when parsing cgroups + - [#9479](https://github.com/influxdata/telegraf/pull/9479) `parsers.json_v2` Fix json_v2 parser to handle nested objects in arrays properly + +#### Features + + - [#9485](https://github.com/influxdata/telegraf/pull/9485) Add option to automatically reload settings when config file is modified + ## v1.19.1 [2021-07-07] #### Bugfixes diff --git a/etc/telegraf.conf b/etc/telegraf.conf index 6d11fa692706d..6c3c0e98b36bb 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -562,6 +562,10 @@ # # ## If you want to convert values represented as gauges to counters, add the metric names here # additional_counters = [ ] +# +# ## Optional dimensions to be added to every metric +# # [outputs.dynatrace.default_dimensions] +# # default_key = "default value" # # Configuration for Elasticsearch to send metrics to. @@ -6317,7 +6321,8 @@ # [[inputs.x509_cert]] # ## List certificate sources # ## Prefix your entry with 'file://' if you intend to use relative paths -# sources = ["/etc/ssl/certs/ssl-cert-snakeoil.pem", "tcp://example.org:443", +# sources = ["tcp://example.org:443", "https://influxdata.com:443", +# "udp://127.0.0.1:4433", "/etc/ssl/certs/ssl-cert-snakeoil.pem", # "/etc/mycerts/*.mydomain.org.pem", "file:///path/to/*.pem"] # # ## Timeout for SSL connection From 3cb135b6a24320815385ad4a4a8dc7031a1d3c2d Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 28 Jul 2021 17:11:15 -0600 Subject: [PATCH 57/85] Telegraf v1.19.2 From 98f7510d8ab55be70b582754698f7ceffe4f2108 Mon Sep 17 00:00:00 2001 From: Helen Weller <38860767+helenosheaa@users.noreply.github.com> Date: Fri, 30 Jul 2021 15:14:23 -0400 Subject: [PATCH 58/85] fix test so it hits a fake service (#9564) (cherry picked from commit 9fcd5a5b54636a1fcadda7e476741aa0a6a2c5e8) --- plugins/inputs/phpfpm/phpfpm_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/phpfpm/phpfpm_test.go b/plugins/inputs/phpfpm/phpfpm_test.go index c3a3f29f570f5..50d8d604efb5b 100644 --- a/plugins/inputs/phpfpm/phpfpm_test.go +++ b/plugins/inputs/phpfpm/phpfpm_test.go @@ -274,7 +274,7 @@ func TestPhpFpmGeneratesMetrics_From_Socket_Custom_Status_Path(t *testing.T) { //When not passing server config, we default to localhost //We just want to make sure we did request stat from localhost func TestPhpFpmDefaultGetFromLocalhost(t *testing.T) { - r := &phpfpm{} + r := &phpfpm{Urls: []string{"http://bad.localhost:62001/status"}} require.NoError(t, r.Init()) @@ -282,7 +282,7 @@ func TestPhpFpmDefaultGetFromLocalhost(t *testing.T) { err := acc.GatherError(r.Gather) require.Error(t, err) - assert.Contains(t, err.Error(), "127.0.0.1/status") + assert.Contains(t, err.Error(), "/status") } func TestPhpFpmGeneratesMetrics_Throw_Error_When_Fpm_Status_Is_Not_Responding(t *testing.T) { From d1d568d229532ce8a9266b717cd9dab09f4e7e58 Mon Sep 17 00:00:00 2001 From: R290 <46033588+R290@users.noreply.github.com> Date: Fri, 30 Jul 2021 22:26:47 +0200 Subject: [PATCH 59/85] Do not skip good quality nodes after a bad quality node is encountered (#9550) (cherry picked from commit 3633853235151ece94fc52ae463409b55812b10b) --- plugins/inputs/opcua/opcua_client.go | 28 +++++++++++++---------- plugins/inputs/opcua/opcua_client_test.go | 10 ++++++-- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/plugins/inputs/opcua/opcua_client.go b/plugins/inputs/opcua/opcua_client.go index ac7becbe09e4d..7654887387ef2 100644 --- a/plugins/inputs/opcua/opcua_client.go +++ b/plugins/inputs/opcua/opcua_client.go @@ -31,6 +31,7 @@ type OpcUA struct { RequestTimeout config.Duration `toml:"request_timeout"` RootNodes []NodeSettings `toml:"nodes"` Groups []GroupSettings `toml:"group"` + Log telegraf.Logger `toml:"-"` nodes []Node nodeData []OPCData @@ -470,15 +471,16 @@ func (o *OpcUA) getData() error { } o.ReadSuccess.Incr(1) for i, d := range resp.Results { + o.nodeData[i].Quality = d.Status if d.Status != ua.StatusOK { - return fmt.Errorf("status not OK: %v", d.Status) + o.Log.Errorf("status not OK for node %v: %v", o.nodes[i].tag.FieldName, d.Status) + continue } o.nodeData[i].TagName = o.nodes[i].tag.FieldName if d.Value != nil { o.nodeData[i].Value = d.Value.Value() o.nodeData[i].DataType = d.Value.Type() } - o.nodeData[i].Quality = d.Status o.nodeData[i].TimeStamp = d.ServerTimestamp.String() o.nodeData[i].Time = d.SourceTimestamp.String() } @@ -532,17 +534,19 @@ func (o *OpcUA) Gather(acc telegraf.Accumulator) error { } for i, n := range o.nodes { - fields := make(map[string]interface{}) - tags := map[string]string{ - "id": n.idStr, - } - for k, v := range n.metricTags { - tags[k] = v - } + if o.nodeData[i].Quality == ua.StatusOK { + fields := make(map[string]interface{}) + tags := map[string]string{ + "id": n.idStr, + } + for k, v := range n.metricTags { + tags[k] = v + } - fields[o.nodeData[i].TagName] = o.nodeData[i].Value - fields["Quality"] = strings.TrimSpace(fmt.Sprint(o.nodeData[i].Quality)) - acc.AddFields(n.metricName, fields, tags) + fields[o.nodeData[i].TagName] = o.nodeData[i].Value + fields["Quality"] = strings.TrimSpace(fmt.Sprint(o.nodeData[i].Quality)) + acc.AddFields(n.metricName, fields, tags) + } } return nil } diff --git a/plugins/inputs/opcua/opcua_client_test.go b/plugins/inputs/opcua/opcua_client_test.go index ffa8521dd05a8..b509d2eaf67a3 100644 --- a/plugins/inputs/opcua/opcua_client_test.go +++ b/plugins/inputs/opcua/opcua_client_test.go @@ -7,6 +7,7 @@ import ( "time" "github.com/influxdata/telegraf/config" + "github.com/influxdata/telegraf/testutil" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -16,7 +17,7 @@ type OPCTags struct { Namespace string IdentifierType string Identifier string - Want string + Want interface{} } func TestClient1Integration(t *testing.T) { @@ -28,6 +29,8 @@ func TestClient1Integration(t *testing.T) { {"ProductName", "0", "i", "2261", "open62541 OPC UA Server"}, {"ProductUri", "0", "i", "2262", "http://open62541.org"}, {"ManufacturerName", "0", "i", "2263", "open62541"}, + {"badnode", "1", "i", "1337", nil}, + {"goodnode", "1", "s", "the.answer", "42"}, } var o OpcUA @@ -40,6 +43,8 @@ func TestClient1Integration(t *testing.T) { o.RequestTimeout = config.Duration(1 * time.Second) o.SecurityPolicy = "None" o.SecurityMode = "None" + o.Log = testutil.Logger{} + for _, tags := range testopctags { o.RootNodes = append(o.RootNodes, MapOPCTag(tags)) } @@ -60,7 +65,7 @@ func TestClient1Integration(t *testing.T) { if compare != testopctags[i].Want { t.Errorf("Tag %s: Values %v for type %s does not match record", o.nodes[i].tag.FieldName, value.Interface(), types) } - } else { + } else if testopctags[i].Want != nil { t.Errorf("Tag: %s has value: %v", o.nodes[i].tag.FieldName, v.Value) } } @@ -250,6 +255,7 @@ func TestValidateOPCTags(t *testing.T) { t.Run(tt.name, func(t *testing.T) { o := OpcUA{ nodes: tt.nodes, + Log: testutil.Logger{}, } require.Equal(t, tt.err, o.validateOPCTags()) }) From 358180295c7b66ba076810c562505d9d3a55f721 Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Fri, 30 Jul 2021 15:49:49 -0500 Subject: [PATCH 60/85] Update vmware/govmomi to v0.26.0 (#9552) (cherry picked from commit c9bbb3241c07b5e930e895de86948da372823a83) --- go.mod | 2 +- go.sum | 7 +++++-- plugins/inputs/vsphere/README.md | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 3241c36981280..421b2f2041b3a 100644 --- a/go.mod +++ b/go.mod @@ -125,7 +125,7 @@ require ( github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/vapourismo/knx-go v0.0.0-20201122213738-75fe09ace330 github.com/vjeantet/grok v1.0.1 - github.com/vmware/govmomi v0.19.0 + github.com/vmware/govmomi v0.26.0 github.com/wavefronthq/wavefront-sdk-go v0.9.7 github.com/wvanbergen/kafka v0.0.0-20171203153745-e2edea948ddf github.com/wvanbergen/kazoo-go v0.0.0-20180202103751-f72d8611297a // indirect diff --git a/go.sum b/go.sum index 2e47bcb1d80b6..4603180668332 100644 --- a/go.sum +++ b/go.sum @@ -159,6 +159,7 @@ github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrU github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 h1:5sXbqlSomvdjlRbWyNqkPsJ3Fg+tQZCbgeX1VGljbQY= github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= +github.com/a8m/tree v0.0.0-20210115125333-10a5fd5b637d/go.mod h1:FSdwKX97koS5efgm8WevNf7XS3PqtyFkKDDXrz778cg= github.com/aerospike/aerospike-client-go v1.27.0 h1:VC6/Wqqm3Qlp4/utM7Zts3cv4A2HPn8rVFp/XZKTWgE= github.com/aerospike/aerospike-client-go v1.27.0/go.mod h1:zj8LBEnWBDOVEIJt8LvaRvDG5ARAoa5dBeHaB472NRc= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= @@ -415,6 +416,7 @@ github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhr github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-xdr v0.0.0-20161123171359-e6a2ba005892/go.mod h1:CTDl0pzVzE5DEzZhPfvhY/9sPFMQIxaJ9VAMs9AagrE= github.com/denisenkom/go-mssqldb v0.10.0 h1:QykgLZBorFE95+gO3u9esLd0BmbvpWp0/waNNZfHBM8= github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= @@ -1471,8 +1473,9 @@ github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df h1:OviZH7qLw/7Zo github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vjeantet/grok v1.0.1 h1:2rhIR7J4gThTgcZ1m2JY4TrJZNgjn985U28kT2wQrJ4= github.com/vjeantet/grok v1.0.1/go.mod h1:ax1aAchzC6/QMXMcyzHQGZWaW1l195+uMYIkCWPCNIo= -github.com/vmware/govmomi v0.19.0 h1:CR6tEByWCPOnRoRyhLzuHaU+6o2ybF3qufNRWS/MGrY= -github.com/vmware/govmomi v0.19.0/go.mod h1:URlwyTFZX72RmxtxuaFL2Uj3fD1JTvZdx59bHWk6aFU= +github.com/vmware/govmomi v0.26.0 h1:JMZR5c7MHH3nCEAVYS3WyRIA35W3+b3tLwAqxVzq1Rw= +github.com/vmware/govmomi v0.26.0/go.mod h1:daTuJEcQosNMXYJOeku0qdBJP9SOLLWB3Mqz8THtv6o= +github.com/vmware/vmw-guestinfo v0.0.0-20170707015358-25eff159a728/go.mod h1:x9oS4Wk2s2u4tS29nEaDLdzvuHdB19CvSGJjPgkZJNk= github.com/wavefronthq/wavefront-sdk-go v0.9.7 h1:SrtABcXXeKCW5SerQYsnCzHo15GeggjZmL+DjtTy6CI= github.com/wavefronthq/wavefront-sdk-go v0.9.7/go.mod h1:JTGsu+KKgxx+GitC65VVdftN2iep1nVpQi/8EGR6v4Y= github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= diff --git a/plugins/inputs/vsphere/README.md b/plugins/inputs/vsphere/README.md index d43f559b16eb8..7d73ea7e35855 100644 --- a/plugins/inputs/vsphere/README.md +++ b/plugins/inputs/vsphere/README.md @@ -8,7 +8,10 @@ The VMware vSphere plugin uses the vSphere API to gather metrics from multiple v * Datastores ## Supported versions of vSphere -This plugin supports vSphere version 5.5 through 6.7. + +This plugin supports vSphere version 6.5, 6.7 and 7.0. It may work with versions 5.1, 5.5 and 6.0, but neither are officially supported. + +Compatibility information was found [here](https://github.com/vmware/govmomi/tree/v0.26.0#compatibility) ## Configuration From 2c995bdacb2598b9828f846dd8c4c93a9648e6c2 Mon Sep 17 00:00:00 2001 From: Helen Weller <38860767+helenosheaa@users.noreply.github.com> Date: Fri, 30 Jul 2021 16:54:36 -0400 Subject: [PATCH 61/85] Upgrade hashicorp/consul/api to 1.9.1 (#9565) (cherry picked from commit 83984c57fdc7add0c1812b2a2e219fbaa3c78ecc) --- go.mod | 2 +- go.sum | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 421b2f2041b3a..59d0e4a028b62 100644 --- a/go.mod +++ b/go.mod @@ -71,7 +71,7 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect github.com/harlow/kinesis-consumer v0.3.1-0.20181230152818-2f58b136fee0 - github.com/hashicorp/consul/api v1.8.1 + github.com/hashicorp/consul/api v1.9.1 github.com/hashicorp/go-msgpack v0.5.5 // indirect github.com/influxdata/go-syslog/v2 v2.0.1 github.com/influxdata/influxdb-observability/common v0.0.0-20210429174543-86ae73cafd31 diff --git a/go.sum b/go.sum index 4603180668332..19b4cb31f26fd 100644 --- a/go.sum +++ b/go.sum @@ -786,12 +786,12 @@ github.com/harlow/kinesis-consumer v0.3.1-0.20181230152818-2f58b136fee0 h1:U0KvG github.com/harlow/kinesis-consumer v0.3.1-0.20181230152818-2f58b136fee0/go.mod h1:dk23l2BruuUzRP8wbybQbPn3J7sZga2QHICCeaEy5rQ= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/api v1.6.0/go.mod h1:1NSuaUUkFaJzMasbfq/11wKYWSR67Xn6r2DXKhuDNFg= -github.com/hashicorp/consul/api v1.8.1 h1:BOEQaMWoGMhmQ29fC26bi0qb7/rId9JzZP2V0Xmx7m8= -github.com/hashicorp/consul/api v1.8.1/go.mod h1:sDjTOq0yUyv5G4h+BqSea7Fn6BU+XbolEz1952UB+mk= +github.com/hashicorp/consul/api v1.9.1 h1:SngrdG2L62qqLsUz85qcPhFZ78rPf8tcD5qjMgs6MME= +github.com/hashicorp/consul/api v1.9.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/consul/sdk v0.6.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= -github.com/hashicorp/consul/sdk v0.7.0 h1:H6R9d008jDcHPQPAqPNuydAshJ4v5/8URdFnUvK/+sc= -github.com/hashicorp/consul/sdk v0.7.0/go.mod h1:fY08Y9z5SvJqevyZNy6WWPXiG3KwBPAvlcdx16zZ0fM= +github.com/hashicorp/consul/sdk v0.8.0 h1:OJtKBtEjboEZvG6AOUdh4Z1Zbyu0WcxQ0qatRrZHTVU= +github.com/hashicorp/consul/sdk v0.8.0/go.mod h1:GBvyrGALthsZObzUGsfgHZQDXjg4lOjagTIwIR1vPms= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= From b0478d05518b1bda4789c30bddeb7fb7a12bf189 Mon Sep 17 00:00:00 2001 From: Anatoly Ivanov Date: Mon, 2 Aug 2021 16:32:32 -0700 Subject: [PATCH 62/85] docs: Adding links to net_irtt and dht_sensor external plugins (#9569) (cherry picked from commit 1872037eb759d5ca82506592e53bd0d2c3df28d8) --- EXTERNAL_PLUGINS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/EXTERNAL_PLUGINS.md b/EXTERNAL_PLUGINS.md index 225497e84ef53..fc71044d6172d 100644 --- a/EXTERNAL_PLUGINS.md +++ b/EXTERNAL_PLUGINS.md @@ -20,6 +20,8 @@ Pull requests welcome. - [ldap_org and ds389](https://github.com/falon/CSI-telegraf-plugins) - Gather statistics from 389ds and from LDAP trees. - [x509_crl](https://github.com/jcgonnard/telegraf-input-x590crl) - Gather information from your X509 CRL files - [s7comm](https://github.com/nicolasme/s7comm) - Gather information from Siemens PLC +- [net_irtt](https://github.com/iAnatoly/telegraf-input-net_irtt) - Gather information from IRTT network test +- [dht_sensor](https://github.com/iAnatoly/telegraf-input-dht_sensor) - Gather temperature and humidity from DHTXX sensors ## Outputs - [kinesis](https://github.com/morfien101/telegraf-output-kinesis) - Aggregation and compression of metrics to send Amazon Kinesis. From 7d10f8b55473284170aec190e54c63e1343fe613 Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Tue, 3 Aug 2021 16:03:33 -0500 Subject: [PATCH 63/85] docs: Add logo (#9574) (cherry picked from commit 4928d5b30e3c6bef4007bab11fdafb919fc6e5c1) --- README.md | 7 ++++++- TelegrafTiger.png | Bin 0 -> 7748 bytes 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 TelegrafTiger.png diff --git a/README.md b/README.md index d0d67cb1932dd..ebd3b9a663c95 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,9 @@ -# Telegraf [![Circle CI](https://circleci.com/gh/influxdata/telegraf.svg?style=svg)](https://circleci.com/gh/influxdata/telegraf) [![Docker pulls](https://img.shields.io/docker/pulls/library/telegraf.svg)](https://hub.docker.com/_/telegraf/) [![Total alerts](https://img.shields.io/lgtm/alerts/g/influxdata/telegraf.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/influxdata/telegraf/alerts/) + +# Telegraf + +![tiger](TelegrafTiger.png "tiger") + +[![Circle CI](https://circleci.com/gh/influxdata/telegraf.svg?style=svg)](https://circleci.com/gh/influxdata/telegraf) [![Docker pulls](https://img.shields.io/docker/pulls/library/telegraf.svg)](https://hub.docker.com/_/telegraf/) [![Total alerts](https://img.shields.io/lgtm/alerts/g/influxdata/telegraf.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/influxdata/telegraf/alerts/) [![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://www.influxdata.com/slack) Telegraf is an agent for collecting, processing, aggregating, and writing metrics. diff --git a/TelegrafTiger.png b/TelegrafTiger.png new file mode 100644 index 0000000000000000000000000000000000000000..f6765a8d77b42c8e246f64e7883d28491e2bcf10 GIT binary patch literal 7748 zcmai3MN}J((?p5}ha$zHc#0M&T3m}ug1bY3;>EQ<(L%7|#VrslxVyVkT!R+3?|1(n zzW4Uc?#y8?bDG^Kbyay>?048mNJzMf3No5VNXWqd<`GQP|8P6Sc<8_O#zyjsBob0h zJmAR;?LUtEO;cV9scM|+@IRuguA(h_VF>!)l6O)0U-AD{YMho>|65DpuBoc^LKeG= zfr5v0b~~exT|K-;%iZB5?8l;Q>N$|fg@i=yrYIw+?Y+Eec$o30gh=+ig8J&hZQ%6C z7J7)LKZjFs`U{VVRfau*>sBxNLoerY%#n496ejST+dVIEO;qh_RuJp{34<*9iRMr? zI>5}8Sx-MjsQ9%4niQP3VN`Ljxj~}KAoOsZ^5vWhJH|Ys9a{UE;Vg^g@Dg1?z&;SD z2J*O}2GesMbT9*X&$+Mwg)<$@6-81e27Q4_^#q3)@IAJ(OyLVrVf70!FuiyVPxkxk z#hn>Z91zY}rXNx_$HGn$JE?hEMh49xzaL}T~Rlxrx>tH~CYTn*V^{z{~K%zIJ? zjIdjMqnmnAUd|`TpgpWu$F^O?Z33*2H3#$T)cfLM=C+Wq8@xORp6BpiGJA-VEGdSj z__is7!u?oR_wRw%9mx+J681Vc{%d;l4{L%W?4u@SrDvm$wQ!UC0&N`cXM8>6hsg00+!c{b|rHH?zwXq=T73x+HLQ5l4hY2+jl&!X*sy zKb-T`M5Jtv@BFQQ4bf=?3_isoiXpg76f3Ki&LR)Zc6Jhye&hF}G=!dj& zaJ)1}0YCNjUgty@3wx(RKdQCM->yC`CdmQ+M7^CRjl~aR#ByReYI6fps~vxf5DiR+ zl1wK5`+3?x7@aFN2{-Jm2U8x#yj^G^kRpy0|4n3oJwL6-gTV%5b^o}ZUyfKUk9kk^ z5fJ+qTx=^u5oynow>kQP>#v@fHusen60N&RM3e5+_l`3da+5i=S=s}r;+vWQaA>|+ zYexHR^clcKJTH%2dK_y$xt33;b=doz`GYGM)Ab;JTF>0=TN~fW{GIP1K>{^ zjECHyzee}zvLJW$QmYjdpnLoyTducO-ylblfICYHlfNEG8>aGOPaAKprOlbwd$*HB zFGoI&1aVezVx@1-MrOz<*^$?h?(t8h(sLDsHNyuk8!73{gXaumAy^24oW<*~vM5>b z3~}Db55Ks!!94t9X;yFA^&(IVRNJ=Zqztv$_J^MnU9$)@&0Uzj;Yw+X>h^s@vWP0B zccC@Ks}1&{Dxa?C+)#Sy>p@A9{K#VI*1Lj zQ>c9#+wm}t@9X#I&BLcI+4+(YXj~4~NXN=CErDO}MF zjgG`(qgd$fA`CA>*@txE`JXocQVErT=B1u;Yc0F)g|k-oQ|eA0ejG9QY3dFogbUm7 z@x=f83C8on@9X~D-=AIiuTK!*4^3m6)CfWDecwRilpU;Z=ur*BR#UEii{1Ac;LalE z%wadvR~LAa|7a647LP-hE(2EN?)-GGXnq{bPud7e+|B*QWvdn5E$Owv5xWAUHnHKz z8}}PGJsdHz@-DIFp1P~WS3Nj4_fdr3PQ{^@7SN~D7K54nhu zHCfzbe-h(~B$Oo)mRu%=o2A*kZVlYu*Dl!}M8{*t{QPbTBA00675%v6M zAoqT7#QlA`5csK>}n1oyQPc4Ov;-d1jf*;~F^dymUkUAH76OvWE zG1chi@%w+G?`#)zJLrVlydZ=p8ikbf`*EzgOE({p&0;0eZAk}HH7@0>756TR4?Ujc zDeZW&cs^d0#{Tm0%O?@2p|vOdt?$$pyB=jz#?dxJKz_%SF3-}IUD{mC)d2wG)twW0 zU9IBgtH1}S^CwCv%Fm0Rl7jlJJ%l2{*#4%qWnAao;s06=JOO0Qmzil36NJ52lpv{U zttBj#cR%7Fm?z?TZd!y-2Gw_1;#yqW^qre9;F+&Tsq+aKB`$->cQ(iK{`{i7=FB3! zlfU(#A95fSpz~`1FXnlto8k>^7CG z=-6>B)y9kJ$VEPsP^epqp%w9`t6XAtYKoKRU!H#aM^iFEA!_&qLXssjdELjP4iAfl zh?N-k*r^)tBdbB4vcDb86=y`+wxLmaJwu1k8NS=VbjO&oQc+D;?r|(M0pTE_`?7ZCQFDz;Y_r|MTrTn^EIKGn!F?tIP~1 zUZ1${cLBd3Srg4sYZ|QJ!Dw!}4`ZMqW7-R9hhT@yw3ry@Ag2RPX7&di{fuY24`He^ zYb_t56F%Ier!e8m#ESgsvR$_CHl8Msx>gTpqPEFuvO{fB$|dVg|>Ui}DpS3-Yn+?XAF}57UH2id0h1gCl$NEUg-T|AkN>s{YSRSJfd*$NY!gWpK_j2 zGHucBjhKfq@^wz@sPJ*F>`C3+N%P2P6r(CuwZARz%u+#l0*248-J)I`BELpy30;Ga zW1z7_Fr~E%r`OWn*JV^e@&XPlotlzq`eMG_8dAez!4vi!$@S53VLIgRIGP^%EB2wM zy-_dh8$*$Q*#Ml5rds;5oC2!MFE-oQuZ>VDkych+C!>$CuL_Kd`0Vz@VR79K^w~Ws zOQjUfb}_llBM!km_8|Uwgo@9p%+~?D7^uW**e`Ga!k|OhQEcZuKeBP{%e`x%@!?1fI~-0OhGEaNXV#)FR#j60+6oD)3D#)?3S}v299}uT7lmw z7SuOqR>D&0YbSqmS=Rn5*Z7;A62#_4nK3Xa*FJ@~*sUNt;d}S7{tEmnGN>@shKYoGa}8xhxrkgW8+@A?qCP1>7@krDN2LFt*AiuP)uaDk*P~&_z7d;E6G$~fd1YP7Q;%4R8dUe>r(PF z{GjacB%ZDe4=x7rmoBPu&6>!rpD}t5tIqhT)d)5`Ect`B(6FNa6?iS!bMkGuh#3nQ z`Plh1zkC?+L&s4fnh4M4!kyYO@vF$hnU9?7B|_O=rGBKJ<*QxCWjbC{RtJYuE3x=` z=UG+9kwKY{h@4(ztK>-$CvtCVvB89i)I@RD6w^Er64R{`iPQ)O=-;lj9NBzcn=73C zPRW%TC;c6h{-FgarY*uNfr7RjlU=Vwr=D8GjL2=FZkD`4tN-_=Zmd_m^mo42lk75m z$Z|!O>GOyBPg!UJ<(@&ZZ8}-PFc*IK5yctHY$`;+7+Vb*Ao6WBC1hk-A2)0SV*H*2 zsJYxi^UeBGh(!W)bj_4a0KfwWX`g$S(DIdcm#Y3si^S;P*IJRw^o>+$!Z#9v)$MT? z+QX>s*&sURk{Q^M8jJIp!m z{jn*mu;;Aj9-aE?C1A3yz5IL7dU~PnA|(iUG$h?*qvApO z7+j&WKFSX_M{oAQa#6KSA^?nBgZL@$7HgL5; zU5?fpD zo67ADCH7k1&X0wh2Nc7;6_$+<7{+329iL zq9VaK+XHpaW(`S5W-!Y&JXOS{k@g(Yh1HJ<=XWsujf?7xT`%%gRLrd5M}yBVv?vBL zHo7;>Ha0QydMEK>O;>*9?A7fSOP7={e-SLkEE0Cok!lE@R}MOK^H#oPGd zBR5C2)c{3+qfe@+9Dvhfeh#}y1jbvVktavADv%#^_cC(K3&tsx*mxVJE0#KCx{3Mg z2jjsggZ5sFk8h;T4<1yl>hx9Gi7)g%NP0l&iag>&JseV6Xm}?>e~aiU_Kzz8AGxhA zhF^BJA>$QUaujR>w{+~iHzW)rgGp_-S>3Lj=@cHQ=aITC)cWlB;NoRWGgp`;QYQhJr2a#)dKfsOf&`5+jAhM9#(``xRXCzSAG2G+kV+zxc2nk7ns6R-Yb^N z9_|OSQzTqb4|mKJjUqUfIT6600xa$;YZ^M z0tv->OgCGknEvkBwO&IxCE0s2jgWJj@l|T-`8dwm-dP}_0D;Yij@WZXSZYve#-f&x zFo*hVqZ4Bb)AkLXJSsptA0I4#R;*=Asz&kS-e)~KI-YKW$dCWLgnueeHPlV)KPD3r z>C;(a0E&+Vt0*0Hi9ojhQfe*orwhdB*7FJ#CynyPWPj9MjKz?Z^v!9k8OC9e`T?vH z)w-nc;x!c{twU`!?rF(ahCgX9+ZO05wJnWZlTU(*;g8UMgGJ!1t8vzmv@yE%uD2Z# z@oPv48mER5?%Y`EWxm2UkH<;t3+j%Ntin659tz{7%k-e=R%z+3h6<&>HK<%PsMv z#taW;9X@PT%1b6;ke7pQ-?2j0Us)d3hXcY|O6o=#ZQ0Z@tSWDC zzw@Py0x*~K;5va(85PD{~NJ?v;xQ;O9{uF}~t;!hmOS#)wD5k%q>X&sc) z2_G9?_})~U&E>74RPg2rrG#c`ACHz5q@l%I404)6nB1RBJsM?`O9GlT1Cjd~QvzL$ zk=#Ey!T@Qq6>VUN+EW1xeXDtM1uE6OmXNNa?b}Hg>&@=5YS3*TY1zs3plQ+7kLB&i z^^T$zBA`^+^@#1;8w*Dp1w}1d&{P+Ku27Q*Ch)rXtkc5Z%IAP%h}Cpfsi>}+6F$rR zs(=Do0QUGdi9ILn+An*!g%RM6O66stZOqB=#2Dg|ejR%Xi6Fl(GxRAo64R+dKv}CG zo@X|ngu5BxG=$xzgrgl^Nn_3Cf}+2VX~sLObZWV~FUG4+o~n$CdGCjRRT*4c!cxKC zhMk2h0~dk|fu0NxN+<{+lzp$a`x3VuDVQ1U6Q$GdoM8m7nw`<(5wgK(M1nJ{)zu!- z8n6@wi$YsQniW@hofTQ(Lg^shdkbjpb9do3#$1&U!|&2CkPoLkoP%AHeIjLTqtG)6BEyo;ahmt2;gp5JHxYY$;)Tjuo_L-dwN0DhkgLmB)#Xu8gkr*_FQ^7#)U3> zU%+rt{R0(%gD5PR7ff|N>jO(zQ^?S34H&G?MgDeO&HT%cpt36o=ZP|*O*E~99vZLC z24pNa`>WYt`FrGC{TF;E6zZYXtX^nF<`_|pt*)k$j7eKZ*#nN*fbJlEoPp+%F^#x= zp%Uul3w`S@nt!1~kcIl=h&cZX^GF3Kovu`%XxwckSr|9xph9Nomw1-@uU$#m(mwnk z7nkqP9it($>nc^~4)EtrpQalkyB^^eANdfbwhj76lNyxU{l^F3an!Th{-!Xrd0Qxe z2jsHc;XOZ%FVK_M{2M$iTD2P(O={Ul{6Hwr2cQ{^mm@QQQV6WaeKN7oRk62}s7o$f zq2#)b`Mtgw+TtM%whGpcT-Liz>qO-H}GL6l-o}Kqv4J zxrInEgJ6zXn}x>|46m^CJ({a0*~R~}LpB;xTRAW5JsZAKbreWSXu1?YH+{FmIUTe= z`TUFmB-ojcL#TUth02vTSh3Q&Z~I*VrT?h7Gk-U3?44D82kQkd^N(XpBYKp?tPIp6 zHumGnZ%#TuVtXZ7L1p8A(w(qOgAcx44=fm){&j2#o@L&Mx@MQvoJA%*T@CbdF%GJK zLI);L2t}~=Y&D~Tboty+M#g6Zeu8Ch&mpLvNAtX2`a7k08pZIqJdVADsKEHNq$P~YSW*n|=kHUqv#JcR)Aby|w?Dw;u|h7KuRp;k6&l>j>+)(4g_$G4QIy?? zZFkmGv-)O4rlZfcrS4x|NBJ&E3|Qxq8g@)EH=sefMTQ*bDGGe*KjWhbuz?T|f11wd zMs~dH*a%`;Xq(FlzS=f}`Hi|^Ewu>%()g2&ttEqsvIE~h9C0o1bC|e~&xozjLeZRc zf4jUeLS+;N%YKV^O6QEBY^G#_gGbautX^Fcn$?c!6HrJk*G~?iHiW~#8p?nuaA7={ zE}F96WCc8#J)Lm@e8b3T9FTHDJ8SBBoJ0V6cEG zo|k0hQynUDIs-ltlULh6dQK)Yxo$bU1DP+>+;_=DXY5kx#>iIwIhnpL$t#3diG*=F zc~KD5gtyYGWGwozVgYThO#!vYCJ&l%ef6NkTv7n9`d4w@prPefH}J6edhv)_2zY2T zgfoJ)0IiP)UhQq*DeYdKQ^-2nWFs{jUMbe7fr6$kAAkiZ{;{v!P50e$-AK~di-|pv z$+W0I#IZ^6)X*bNpju~A?NJxucjjbI2ui|FPy^+;#lt zS8#uLTjO+!X%|eOK_|plupgBIoBxoV$wJgsnPEWYpfX@5a9PA@NZ22t3Z_UgE=s|K z?1V|uqQ?7v?fc;HL1fMT%Rp8y@sRV>=MW1*DTxPv_9`m1nSTZMk%hz@6cw6fe%u=a z#zRsgX1`;LBon?7wekcNOnj?M9!a#wjq8+~cl~Ocg#p$9w6T@E5CNBxzey_}-f+}B z=&iylIWSQ)gu-~xHAJ@`CG57=UDbJhwb!n&x#HR}ADgJnhlq{y-*&r=!vpMQUGIxQ z!YUHSPOBx)7`@xr(VIT(ma)nO9N+GmL2=8~%v-`@OC)?Popb%U=cA7(pBXRSrZ6|H z)xA6SWXXl;CNGdVZa47rqPrSxt!GY=FUgk(4+8ev#eD9tT?|h(?XS-%~4vJoME`i$avlD7Qj@W2Z{yUr2F-!cql(35l=51sA4k>OD;qfJDC1= r)W|CfnsBizzSUymj_diCh(O+T^__llv_=2#MT?{;t143^Wg7B-hxs2Q literal 0 HcmV?d00001 From 41f81ec8c30f79246a32c31a5351de610ecf059b Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Tue, 3 Aug 2021 16:05:22 -0500 Subject: [PATCH 64/85] docs: information on new conventional commit format (#9573) (cherry picked from commit 8bf97809a8f304b8db340626b3af7ee39edf410f) --- .github/PULL_REQUEST_TEMPLATE.md | 1 + CONTRIBUTING.md | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 822d809c46255..1c717ddbb1a15 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -5,6 +5,7 @@ show completion. --> - [ ] Updated associated README.md. - [ ] Wrote appropriate unit tests. +- [ ] Pull request title or commits are in [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/#summary) (e.g. feat: or fix:) - - Nom - - - + Nom String + - - Code - String - - - Cur - String - + + + + Code + String + + + + Cur + String + @@ -40,8 +40,8 @@ LIFETIME(MIN 300 MAX 600); 3306 - wrong - wrong + default + 127.0.0.1 1 @@ -56,8 +56,7 @@ LIFETIME(MIN 300 MAX 600); - - - + + 300 From ddba1a9c02547f5fa0155fb63e1b1e6730c96419 Mon Sep 17 00:00:00 2001 From: Alexander Krantz Date: Tue, 10 Aug 2021 14:48:02 -0700 Subject: [PATCH 75/85] fix: CrateDB replace dots in tag keys with underscores (#9566) (cherry picked from commit eb41218fe07a0855f79845bdd559b3e2ce66d0d1) --- plugins/outputs/cratedb/README.md | 2 + plugins/outputs/cratedb/cratedb.go | 46 +++++++++++------- plugins/outputs/cratedb/cratedb_test.go | 62 +++++++++++++++---------- 3 files changed, 69 insertions(+), 41 deletions(-) diff --git a/plugins/outputs/cratedb/README.md b/plugins/outputs/cratedb/README.md index 50386fbbc94d1..11214092d26c2 100644 --- a/plugins/outputs/cratedb/README.md +++ b/plugins/outputs/cratedb/README.md @@ -35,4 +35,6 @@ config option, see below. table = "metrics" # If true, and the metrics table does not exist, create it automatically. table_create = true + # The character(s) to replace any '.' in an object key with + key_separator = "_" ``` diff --git a/plugins/outputs/cratedb/cratedb.go b/plugins/outputs/cratedb/cratedb.go index a28e29dc0e47c..b56787114d709 100644 --- a/plugins/outputs/cratedb/cratedb.go +++ b/plugins/outputs/cratedb/cratedb.go @@ -20,11 +20,12 @@ import ( const MaxInt64 = int64(^uint64(0) >> 1) type CrateDB struct { - URL string - Timeout config.Duration - Table string - TableCreate bool `toml:"table_create"` - DB *sql.DB + URL string + Timeout config.Duration + Table string + TableCreate bool `toml:"table_create"` + KeySeparator string `toml:"key_separator"` + DB *sql.DB } var sampleConfig = ` @@ -37,6 +38,8 @@ var sampleConfig = ` table = "metrics" # If true, and the metrics table does not exist, create it automatically. table_create = true + # The character(s) to replace any '.' in an object key with + key_separator = "_" ` func (c *CrateDB) Connect() error { @@ -68,15 +71,21 @@ CREATE TABLE IF NOT EXISTS ` + c.Table + ` ( func (c *CrateDB) Write(metrics []telegraf.Metric) error { ctx, cancel := context.WithTimeout(context.Background(), time.Duration(c.Timeout)) defer cancel() - if sql, err := insertSQL(c.Table, metrics); err != nil { + + generatedSQL, err := insertSQL(c.Table, c.KeySeparator, metrics) + if err != nil { return err - } else if _, err := c.DB.ExecContext(ctx, sql); err != nil { + } + + _, err = c.DB.ExecContext(ctx, generatedSQL) + if err != nil { return err } + return nil } -func insertSQL(table string, metrics []telegraf.Metric) (string, error) { +func insertSQL(table string, keyReplacement string, metrics []telegraf.Metric) (string, error) { rows := make([]string, len(metrics)) for i, m := range metrics { cols := []interface{}{ @@ -89,7 +98,7 @@ func insertSQL(table string, metrics []telegraf.Metric) (string, error) { escapedCols := make([]string, len(cols)) for i, col := range cols { - escaped, err := escapeValue(col) + escaped, err := escapeValue(col, keyReplacement) if err != nil { return "", err } @@ -113,7 +122,7 @@ VALUES // inputs. // // [1] https://github.com/influxdata/telegraf/pull/3210#issuecomment-339273371 -func escapeValue(val interface{}) (string, error) { +func escapeValue(val interface{}, keyReplacement string) (string, error) { switch t := val.(type) { case string: return escapeString(t, `'`), nil @@ -131,11 +140,11 @@ func escapeValue(val interface{}) (string, error) { return strconv.FormatBool(t), nil case time.Time: // see https://crate.io/docs/crate/reference/sql/data_types.html#timestamp - return escapeValue(t.Format("2006-01-02T15:04:05.999-0700")) + return escapeValue(t.Format("2006-01-02T15:04:05.999-0700"), keyReplacement) case map[string]string: - return escapeObject(convertMap(t)) + return escapeObject(convertMap(t), keyReplacement) case map[string]interface{}: - return escapeObject(t) + return escapeObject(t, keyReplacement) default: // This might be panic worthy under normal circumstances, but it's probably // better to not shut down the entire telegraf process because of one @@ -154,7 +163,7 @@ func convertMap(m map[string]string) map[string]interface{} { return c } -func escapeObject(m map[string]interface{}) (string, error) { +func escapeObject(m map[string]interface{}, keyReplacement string) (string, error) { // There is a decent chance that the implementation below doesn't catch all // edge cases, but it's hard to tell since the format seems to be a bit // underspecified. @@ -171,12 +180,15 @@ func escapeObject(m map[string]interface{}) (string, error) { // Now we build our key = val pairs pairs := make([]string, 0, len(m)) for _, k := range keys { - // escape the value of our key k (potentially recursive) - val, err := escapeValue(m[k]) + key := escapeString(strings.ReplaceAll(k, ".", keyReplacement), `"`) + + // escape the value of the value at k (potentially recursive) + val, err := escapeValue(m[k], keyReplacement) if err != nil { return "", err } - pairs = append(pairs, escapeString(k, `"`)+" = "+val) + + pairs = append(pairs, key+" = "+val) } return `{` + strings.Join(pairs, ", ") + `}`, nil } diff --git a/plugins/outputs/cratedb/cratedb_test.go b/plugins/outputs/cratedb/cratedb_test.go index 66a2bfa794cc9..0bdfd8d3e2652 100644 --- a/plugins/outputs/cratedb/cratedb_test.go +++ b/plugins/outputs/cratedb/cratedb_test.go @@ -2,7 +2,6 @@ package cratedb import ( "database/sql" - "fmt" "os" "strings" "testing" @@ -49,9 +48,9 @@ func TestConnectAndWriteIntegration(t *testing.T) { // the rows using their primary keys in order to take advantage of // read-after-write consistency in CrateDB. for _, m := range metrics { - hashIDVal, err := escapeValue(hashID(m)) + hashIDVal, err := escapeValue(hashID(m), "_") require.NoError(t, err) - timestamp, err := escapeValue(m.Time()) + timestamp, err := escapeValue(m.Time(), "_") require.NoError(t, err) var id int64 @@ -85,7 +84,7 @@ VALUES } for _, test := range tests { - if got, err := insertSQL("my_table", test.Metrics); err != nil { + if got, err := insertSQL("my_table", "_", test.Metrics); err != nil { t.Error(err) } else if got != test.Want { t.Errorf("got:\n%s\n\nwant:\n%s", got, test.Want) @@ -93,17 +92,13 @@ VALUES } } -func Test_escapeValueIntegration(t *testing.T) { - t.Skip("Skipping due to trust authentication failure") - - if os.Getenv("CIRCLE_PROJECT_REPONAME") != "" { - t.Skip("Skipping test on CircleCI due to docker failures") - } +type escapeValueTest struct { + Value interface{} + Want string +} - tests := []struct { - Val interface{} - Want string - }{ +func escapeValueTests() []escapeValueTest { + return []escapeValueTest{ // string {`foo`, `'foo'`}, {`foo'bar 'yeah`, `'foo''bar ''yeah'`}, @@ -122,6 +117,7 @@ func Test_escapeValueIntegration(t *testing.T) { {map[string]string(nil), `{}`}, {map[string]string{"foo": "bar"}, `{"foo" = 'bar'}`}, {map[string]string{"foo": "bar", "one": "more"}, `{"foo" = 'bar', "one" = 'more'}`}, + {map[string]string{"f.oo": "bar", "o.n.e": "more"}, `{"f_oo" = 'bar', "o_n_e" = 'more'}`}, // map[string]interface{} {map[string]interface{}{}, `{}`}, {map[string]interface{}(nil), `{}`}, @@ -130,29 +126,47 @@ func Test_escapeValueIntegration(t *testing.T) { {map[string]interface{}{"foo": map[string]interface{}{"one": "more"}}, `{"foo" = {"one" = 'more'}}`}, {map[string]interface{}{`fo"o`: `b'ar`, `ab'c`: `xy"z`, `on"""e`: `mo'''re`}, `{"ab'c" = 'xy"z', "fo""o" = 'b''ar', "on""""""e" = 'mo''''''re'}`}, } +} - url := testURL() - fmt.Println("url", url) - db, err := sql.Open("pgx", url) +func Test_escapeValueIntegration(t *testing.T) { + t.Skip("Skipping due to trust authentication failure") + + if os.Getenv("CIRCLE_PROJECT_REPONAME") != "" { + t.Skip("Skipping test on CircleCI due to docker failures") + } + + db, err := sql.Open("pgx", testURL()) require.NoError(t, err) defer db.Close() + tests := escapeValueTests() for _, test := range tests { - got, err := escapeValue(test.Val) - if err != nil { - t.Errorf("val: %#v: %s", test.Val, err) - } else if got != test.Want { - t.Errorf("got:\n%s\n\nwant:\n%s", got, test.Want) - } + got, err := escapeValue(test.Value, "_") + require.NoError(t, err, "value: %#v", test.Value) // This is a smoke test that will blow up if our escaping causing a SQL - // syntax error, which may allow for an attack. + // syntax error, which may allow for an attack.= var reply interface{} row := db.QueryRow("SELECT " + got) require.NoError(t, row.Scan(&reply)) } } +func Test_escapeValue(t *testing.T) { + tests := escapeValueTests() + for _, test := range tests { + got, err := escapeValue(test.Value, "_") + require.NoError(t, err, "value: %#v", test.Value) + require.Equal(t, got, test.Want) + } +} + +func Test_circumeventingStringEscape(t *testing.T) { + value, err := escapeObject(map[string]interface{}{"a.b": "c"}, `_"`) + require.NoError(t, err) + require.Equal(t, value, `{"a_""b" = 'c'}`) +} + func Test_hashID(t *testing.T) { tests := []struct { Name string From 8b28253ae508133661f40fb0cf8a2383db22802f Mon Sep 17 00:00:00 2001 From: Alexander Krantz Date: Tue, 17 Aug 2021 14:13:43 -0700 Subject: [PATCH 76/85] docs: improve redis commands documentation (#9606) (cherry picked from commit cfd7348e5c13612fe63bad3237e9e254eebc9c9b) --- plugins/inputs/redis/README.md | 12 ++++++++--- plugins/inputs/redis/redis.go | 38 +++++++++++++++++++++++++--------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/plugins/inputs/redis/README.md b/plugins/inputs/redis/README.md index 4327a28bb98ee..bd89ea75346b2 100644 --- a/plugins/inputs/redis/README.md +++ b/plugins/inputs/redis/README.md @@ -10,15 +10,21 @@ ## e.g. ## tcp://localhost:6379 ## tcp://:password@192.168.99.100 + ## unix:///var/run/redis.sock ## ## If no servers are specified, then localhost is used as the host. ## If no port is specified, 6379 is used servers = ["tcp://localhost:6379"] + ## Optional. Specify redis commands to retrieve values # [[inputs.redis.commands]] - # command = ["get", "sample-key"] - # field = "sample-key-value" - # type = "string" + # # The command to run where each argument is a separate element + # command = ["get", "sample-key"] + # # The field to store the result in + # field = "sample-key-value" + # # The type of the result + # # Can be "string", "integer", or "float" + # type = "string" ## specify server password # password = "s#cr@t%" diff --git a/plugins/inputs/redis/redis.go b/plugins/inputs/redis/redis.go index fdc5dcd14cb12..b66d4ea41d36b 100644 --- a/plugins/inputs/redis/redis.go +++ b/plugins/inputs/redis/redis.go @@ -32,8 +32,8 @@ type Redis struct { Log telegraf.Logger - clients []Client - initialized bool + clients []Client + connected bool } type Client interface { @@ -201,9 +201,13 @@ var sampleConfig = ` ## Optional. Specify redis commands to retrieve values # [[inputs.redis.commands]] - # command = ["get", "sample-key"] - # field = "sample-key-value" - # type = "string" + # # The command to run where each argument is a separate element + # command = ["get", "sample-key"] + # # The field to store the result in + # field = "sample-key-value" + # # The type of the result + # # Can be "string", "integer", or "float" + # type = "string" ## specify server password # password = "s#cr@t%" @@ -230,8 +234,18 @@ var Tracking = map[string]string{ "role": "replication_role", } -func (r *Redis) init() error { - if r.initialized { +func (r *Redis) Init() error { + for _, command := range r.Commands { + if command.Type != "string" && command.Type != "integer" && command.Type != "float" { + return fmt.Errorf(`unknown result type: expected one of "string", "integer", "float"; got %q`, command.Type) + } + } + + return nil +} + +func (r *Redis) connect() error { + if r.connected { return nil } @@ -299,15 +313,15 @@ func (r *Redis) init() error { } } - r.initialized = true + r.connected = true return nil } // Reads stats from all configured servers accumulates stats. // Returns one of the errors encountered while gather stats (if any). func (r *Redis) Gather(acc telegraf.Accumulator) error { - if !r.initialized { - err := r.init() + if !r.connected { + err := r.connect() if err != nil { return err } @@ -333,6 +347,10 @@ func (r *Redis) gatherCommandValues(client Client, acc telegraf.Accumulator) err for _, command := range r.Commands { val, err := client.Do(command.Type, command.Command...) if err != nil { + if strings.Contains(err.Error(), "unexpected type=") { + return fmt.Errorf("could not get command result: %s", err) + } + return err } From 303f005180751b9387c381a965482ca6ad46b262 Mon Sep 17 00:00:00 2001 From: Sebastian Spaink <3441183+sspaink@users.noreply.github.com> Date: Tue, 17 Aug 2021 16:14:15 -0500 Subject: [PATCH 77/85] fix: wireguard unknown revision when using direct (#9620) (cherry picked from commit 967e31e3036fa7a1fb9be83eb9249d8bca265ae8) --- go.mod | 6 ++++++ go.sum | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index c9074985e5dca..6717693adaf08 100644 --- a/go.mod +++ b/go.mod @@ -164,3 +164,9 @@ replace github.com/satori/go.uuid => github.com/gofrs/uuid v3.2.0+incompatible // replaced due to https//github.com/mdlayher/apcupsd/issues/10 replace github.com/mdlayher/apcupsd => github.com/influxdata/apcupsd v0.0.0-20210427145308-694d5caead0e + +//proxy.golang.org has versions of golang.zx2c4.com/wireguard with leading v's, whereas the git repo has tags without leading v's: https://git.zx2c4.com/wireguard-go/refs/tags +//So, fetching this module with version v0.0.20200121 (as done by the transitive dependency +//https://github.com/WireGuard/wgctrl-go/blob/e35592f146e40ce8057113d14aafcc3da231fbac/go.mod#L12 ) was not working when using GOPROXY=direct. +//Replacing with the pseudo-version works around this. +replace golang.zx2c4.com/wireguard v0.0.20200121 => golang.zx2c4.com/wireguard v0.0.0-20200121152719-05b03c675090 diff --git a/go.sum b/go.sum index 7bf0b56b6cb58..985b09432384e 100644 --- a/go.sum +++ b/go.sum @@ -1903,8 +1903,8 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.zx2c4.com/wireguard v0.0.20200121 h1:vcswa5Q6f+sylDfjqyrVNNrjsFUUbPsgAQTBCAg/Qf8= -golang.zx2c4.com/wireguard v0.0.20200121/go.mod h1:P2HsVp8SKwZEufsnezXZA4GRX/T49/HlU7DGuelXsU4= +golang.zx2c4.com/wireguard v0.0.0-20200121152719-05b03c675090 h1:LJ5Rrj8y0yBul+KpB2v9dFhYuHRs1s9caVu4VK6MgMo= +golang.zx2c4.com/wireguard v0.0.0-20200121152719-05b03c675090/go.mod h1:P2HsVp8SKwZEufsnezXZA4GRX/T49/HlU7DGuelXsU4= golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4 h1:KTi97NIQGgSMaN0v/oxniJV0MEzfzmrDUOAWxombQVc= golang.zx2c4.com/wireguard/wgctrl v0.0.0-20200205215550-e35592f146e4/go.mod h1:UdS9frhv65KTfwxME1xE8+rHYoFpbm36gOud1GhBe9c= gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= From ea391d4ea8b632d32cf1631174e53f39af8fb0a1 Mon Sep 17 00:00:00 2001 From: Grace Wehner Date: Tue, 17 Aug 2021 14:54:55 -0700 Subject: [PATCH 78/85] fix: issues with prometheus kubernetes pod discovery (#9605) (cherry picked from commit fe144e7c990e03bb4f32e8ae2a3eee24919eafd9) --- plugins/inputs/prometheus/kubernetes.go | 50 ++++++++++++++----------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/plugins/inputs/prometheus/kubernetes.go b/plugins/inputs/prometheus/kubernetes.go index c1fb3828114bc..33b9e793278b4 100644 --- a/plugins/inputs/prometheus/kubernetes.go +++ b/plugins/inputs/prometheus/kubernetes.go @@ -114,35 +114,43 @@ func (p *Prometheus) watchPod(ctx context.Context, client *kubernetes.Clientset) LabelSelector: p.KubernetesLabelSelector, FieldSelector: p.KubernetesFieldSelector, }) + defer watcher.Stop() if err != nil { return err } - pod := &corev1.Pod{} - go func() { - for event := range watcher.ResultChan() { - pod = &corev1.Pod{} - // If the pod is not "ready", there will be no ip associated with it. - if pod.Annotations["prometheus.io/scrape"] != "true" || - !podReady(pod.Status.ContainerStatuses) { - continue - } - switch event.Type { - case watch.Added: - registerPod(pod, p) - case watch.Modified: - // To avoid multiple actions for each event, unregister on the first event - // in the delete sequence, when the containers are still "ready". - if pod.GetDeletionTimestamp() != nil { - unregisterPod(pod, p) - } else { + for { + select { + case <-ctx.Done(): + return nil + default: + for event := range watcher.ResultChan() { + pod, ok := event.Object.(*corev1.Pod) + if !ok { + return fmt.Errorf("Unexpected object when getting pods") + } + + // If the pod is not "ready", there will be no ip associated with it. + if pod.Annotations["prometheus.io/scrape"] != "true" || + !podReady(pod.Status.ContainerStatuses) { + continue + } + + switch event.Type { + case watch.Added: registerPod(pod, p) + case watch.Modified: + // To avoid multiple actions for each event, unregister on the first event + // in the delete sequence, when the containers are still "ready". + if pod.GetDeletionTimestamp() != nil { + unregisterPod(pod, p) + } else { + registerPod(pod, p) + } } } } - }() - - return nil + } } func (p *Prometheus) cAdvisor(ctx context.Context, bearerToken string) error { From b420cf76732090c3fac3e4bf208d9ca42d507545 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Aug 2021 15:20:17 -0600 Subject: [PATCH 79/85] fix: Bump github.com/aws/aws-sdk-go-v2 from 1.3.2 to 1.8.0 (#9636) (cherry picked from commit ee5c50988a5a09ad1da5362f89c4de04823bb6f0) --- docs/LICENSE_OF_DEPENDENCIES.md | 1 + go.mod | 5 +++-- go.sum | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/LICENSE_OF_DEPENDENCIES.md b/docs/LICENSE_OF_DEPENDENCIES.md index 6fdae959e8168..83192618960dc 100644 --- a/docs/LICENSE_OF_DEPENDENCIES.md +++ b/docs/LICENSE_OF_DEPENDENCIES.md @@ -35,6 +35,7 @@ following works: - github.com/aws/aws-sdk-go-v2/credentials [Apache License 2.0](https://github.com/aws/aws-sdk-go-v2/blob/main/credentials/LICENSE.txt) - github.com/aws/aws-sdk-go-v2/feature/ec2/imds [Apache License 2.0](https://github.com/aws/aws-sdk-go-v2/blob/main/feature/ec2/imds/LICENSE.txt) - github.com/aws/aws-sdk-go-v2/feature/s3/manager [Apache License 2.0](https://github.com/aws/aws-sdk-go-v2/blob/main/LICENSE.txt) +- github.com/aws/aws-sdk-go-v2/internal/ini [Apache License 2.0](https://github.com/aws/aws-sdk-go-v2/blob/main/config/LICENSE.txt) - github.com/aws/aws-sdk-go-v2/service/ec2 [Apache License 2.0](https://github.com/aws/aws-sdk-go-v2/blob/main/service/ec2/LICENSE.txt) - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding [Apache License 2.0](https://github.com/aws/aws-sdk-go-v2/blob/main/service/internal/accept-encoding/LICENSE.txt) - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url [Apache License 2.0](https://github.com/aws/aws-sdk-go-v2/blob/main/service/internal/presigned-url/LICENSE.txt) diff --git a/go.mod b/go.mod index 6717693adaf08..3a6bb282a9fda 100644 --- a/go.mod +++ b/go.mod @@ -27,11 +27,12 @@ require ( github.com/aristanetworks/glog v0.0.0-20191112221043-67e8567f59f3 // indirect github.com/aristanetworks/goarista v0.0.0-20190325233358-a123909ec740 github.com/aws/aws-sdk-go v1.38.69 - github.com/aws/aws-sdk-go-v2 v1.3.2 + github.com/aws/aws-sdk-go-v2 v1.8.0 github.com/aws/aws-sdk-go-v2/config v1.1.5 github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.6 + github.com/aws/aws-sdk-go-v2/internal/ini v1.2.0 // indirect github.com/aws/aws-sdk-go-v2/service/ec2 v1.1.0 - github.com/aws/smithy-go v1.3.1 + github.com/aws/smithy-go v1.7.0 github.com/benbjohnson/clock v1.0.3 github.com/bitly/go-hostpool v0.1.0 // indirect github.com/bmatcuk/doublestar/v3 v3.0.0 diff --git a/go.sum b/go.sum index 985b09432384e..f9d586107f46f 100644 --- a/go.sum +++ b/go.sum @@ -212,8 +212,9 @@ github.com/aws/aws-sdk-go v1.38.69 h1:V489lmrdkIQSfF6OAGZZ1Cavcm7eczCm2JcGvX+yHR github.com/aws/aws-sdk-go v1.38.69/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/aws/aws-sdk-go-v2 v1.1.0/go.mod h1:smfAbmpW+tcRVuNUjo3MOArSZmW72t62rkCzc2i0TWM= -github.com/aws/aws-sdk-go-v2 v1.3.2 h1:RQj8l98yKUm0UV2Wd3w/Ms+TXV9Rs1E6Kr5tRRMfyU4= github.com/aws/aws-sdk-go-v2 v1.3.2/go.mod h1:7OaACgj2SX3XGWnrIjGlJM22h6yD6MEWKvm7levnnM8= +github.com/aws/aws-sdk-go-v2 v1.8.0 h1:HcN6yDnHV9S7D69E7To0aUppJhiJNEzQSNcUxc7r3qo= +github.com/aws/aws-sdk-go-v2 v1.8.0/go.mod h1:xEFuWz+3TYdlPRuo+CqATbeDWIWyaT5uAPwPaWtgse0= github.com/aws/aws-sdk-go-v2/config v1.1.5 h1:imDWOGwlIrRpHLallJ9mli2SIQ4egtGKtFUFsuGRIaQ= github.com/aws/aws-sdk-go-v2/config v1.1.5/go.mod h1:P3F1hku7qzC81txjwXnwOM6Ex6ezkU6+/557Teyb64E= github.com/aws/aws-sdk-go-v2/credentials v1.1.5 h1:R9v/eN5cXv5yMLC619xRYl5PgCSuy5SarizmM7+qqSA= @@ -222,6 +223,8 @@ github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.6 h1:zoOz5V56jO/rGixsCDnrQtAz github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.6/go.mod h1:0+fWMitrmIpENiY8/1DyhdYPUCAPvd9UNz9mtCsEoLQ= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.1.2 h1:Doa5wabOIDA0XZzBX5yCTAPGwDCVZ8Ux0wh29AUDmN4= github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.1.2/go.mod h1:Azf567f5wBUfUbwpyJJnLM/geFFIzEulGR30L+nQZOE= +github.com/aws/aws-sdk-go-v2/internal/ini v1.2.0 h1:xu45foJnwMwBqSkIMKyJP9kbyHi5hdhZ/WiJ7D2sHZ0= +github.com/aws/aws-sdk-go-v2/internal/ini v1.2.0/go.mod h1:Q5jATQc+f1MfZp3PDMhn6ry18hGvE0i8yvbXoKbnZaE= github.com/aws/aws-sdk-go-v2/service/ec2 v1.1.0 h1:+VnEgB1yp+7KlOsk6FXX/v/fU9uL5oSujIMkKQBBmp8= github.com/aws/aws-sdk-go-v2/service/ec2 v1.1.0/go.mod h1:/6514fU/SRcY3+ousB1zjUqiXjruSuti2qcfE70osOc= github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.0.4 h1:8yeByqOL6UWBsOOXsHnW93/ukwL66O008tRfxXxnTwA= @@ -238,8 +241,9 @@ github.com/aws/aws-sdk-go-v2/service/sso v1.1.5/go.mod h1:bpGz0tidC4y39sZkQSkpO/ github.com/aws/aws-sdk-go-v2/service/sts v1.2.2 h1:fKw6QSGcFlvZCBPYx3fo4sL0HfTmaT06ZtMHJfQQNQQ= github.com/aws/aws-sdk-go-v2/service/sts v1.2.2/go.mod h1:ssRzzJ2RZOVuKj2Vx1YE7ypfil/BIlgmQnCSW4DistU= github.com/aws/smithy-go v1.0.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= -github.com/aws/smithy-go v1.3.1 h1:xJFO4pK0y9J8fCl34uGsSJX5KNnGbdARDlA5BPhXnwE= github.com/aws/smithy-go v1.3.1/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= +github.com/aws/smithy-go v1.7.0 h1:+cLHMRrDZvQ4wk+KuQ9yH6eEg6KZEJ9RI2IkDqnygCg= +github.com/aws/smithy-go v1.7.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAmR5n+E= github.com/benbjohnson/clock v1.0.3 h1:vkLuvpK4fmtSCuo60+yC63p7y0BmQ8gm5ZXGuBCJyXg= github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM= github.com/beorn7/perks v0.0.0-20160804104726-4c0e84591b9a/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= From 638c073538bcf65319b7fdd29950e8b1a4b10572 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Aug 2021 15:22:45 -0600 Subject: [PATCH 80/85] fix: Bump github.com/golang/snappy from 0.0.3 to 0.0.4 (#9637) (cherry picked from commit 65a7fadaa92b28256517ca4b4d64389f1eac2180) --- go.mod | 4 ++-- go.sum | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 3a6bb282a9fda..b0a82f3fce618 100644 --- a/go.mod +++ b/go.mod @@ -61,8 +61,8 @@ require ( github.com/gogo/protobuf v1.3.2 github.com/golang/geo v0.0.0-20190916061304-5b978397cfec github.com/golang/protobuf v1.5.2 - github.com/golang/snappy v0.0.3 - github.com/google/go-cmp v0.5.5 + github.com/golang/snappy v0.0.4 + github.com/google/go-cmp v0.5.6 github.com/google/go-github/v32 v32.1.0 github.com/gopcua/opcua v0.1.13 github.com/gorilla/mux v1.7.3 diff --git a/go.sum b/go.sum index f9d586107f46f..9cd78a21e0618 100644 --- a/go.sum +++ b/go.sum @@ -705,8 +705,9 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.3 h1:fHPg5GQYlCeLIPB9BZqMVR5nR9A+IM5zcgeTdjMYmLA= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/addlicense v0.0.0-20190510175307-22550fa7c1b0/go.mod h1:QtPG26W17m+OIQgE6gQ24gC1M6pUaMBAbFrTIDtwG/E= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= @@ -723,8 +724,9 @@ github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= +github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github/v32 v32.1.0 h1:GWkQOdXqviCPx7Q7Fj+KyPoGm4SwHRh8rheoPhd27II= github.com/google/go-github/v32 v32.1.0/go.mod h1:rIEpZD9CTDQwDK9GDrtMTycQNA4JU3qBsCizh3q2WCI= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= From 0ac68368f2c06c1d230055c008cb665c0231a004 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Aug 2021 15:23:49 -0600 Subject: [PATCH 81/85] fix: Bump github.com/testcontainers/testcontainers-go from 0.11.0 to 0.11.1 (#9638) (cherry picked from commit 229b46eb682981375504464fc817a9b44aa28d46) --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index b0a82f3fce618..cdaaafc14cbac 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,7 @@ require ( github.com/denisenkom/go-mssqldb v0.10.0 github.com/dgrijalva/jwt-go/v4 v4.0.0-preview1 github.com/dimchansky/utfbom v1.1.1 - github.com/docker/docker v20.10.6+incompatible + github.com/docker/docker v20.10.7+incompatible github.com/dynatrace-oss/dynatrace-metric-utils-go v0.2.0 github.com/eclipse/paho.mqtt.golang v1.3.0 github.com/form3tech-oss/jwt-go v3.2.3+incompatible // indirect @@ -119,7 +119,7 @@ require ( github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 github.com/stretchr/testify v1.7.0 github.com/tbrandon/mbserver v0.0.0-20170611213546-993e1772cc62 - github.com/testcontainers/testcontainers-go v0.11.0 + github.com/testcontainers/testcontainers-go v0.11.1 github.com/tidwall/gjson v1.8.0 github.com/tinylib/msgp v1.1.5 github.com/tklauser/go-sysconf v0.3.5 // indirect diff --git a/go.sum b/go.sum index 9cd78a21e0618..36cb6075f442c 100644 --- a/go.sum +++ b/go.sum @@ -442,8 +442,8 @@ github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug= github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v17.12.0-ce-rc1.0.20200706150819-a40b877fbb9e+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v20.10.6+incompatible h1:oXI3Vas8TI8Eu/EjH4srKHJBVqraSzJybhxY7Om9faQ= -github.com/docker/docker v20.10.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v20.10.7+incompatible h1:Z6O9Nhsjv+ayUEeI1IojKbYcsGdgYSNqxe1s2MYzUhQ= +github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= @@ -1439,8 +1439,8 @@ github.com/tbrandon/mbserver v0.0.0-20170611213546-993e1772cc62 h1:Oj2e7Sae4XrOs github.com/tbrandon/mbserver v0.0.0-20170611213546-993e1772cc62/go.mod h1:qUzPVlSj2UgxJkVbH0ZwuuiR46U8RBMDT5KLY78Ifpw= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= github.com/tedsuo/ifrit v0.0.0-20180802180643-bea94bb476cc/go.mod h1:eyZnKCc955uh98WQvzOm0dgAeLnf2O0Rz0LPoC5ze+0= -github.com/testcontainers/testcontainers-go v0.11.0 h1:HO5YOx2DYBHqcg4MzVWPj3FuHAv7USWVu94vCSsgiaM= -github.com/testcontainers/testcontainers-go v0.11.0/go.mod h1:HztBCODzuA+YpMXGK8amjO8j50jz2gcT0BOzSKUiYIs= +github.com/testcontainers/testcontainers-go v0.11.1 h1:FiYsB83LSGbiawoV8TpAZGfcCUbtaeeg1SXqEKUxh08= +github.com/testcontainers/testcontainers-go v0.11.1/go.mod h1:/V0UVq+1e7NWYoqTPog179clf0Qp9TOyp4EcXaEFQz8= github.com/tidwall/gjson v1.8.0 h1:Qt+orfosKn0rbNTZqHYDqBrmm3UDA4KRkv70fDzG+PQ= github.com/tidwall/gjson v1.8.0/go.mod h1:5/xDoumyyDNerp2U36lyolv46b3uF/9Bu6OfyQ9GImk= github.com/tidwall/match v1.0.3 h1:FQUVvBImDutD8wJLN6c5eMzWtjgONK9MwIBCOrUJKeE= From 3b1438d7c68aedaa9ff2e6e7e0701be83562edaa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Aug 2021 15:24:30 -0600 Subject: [PATCH 82/85] fix: Bump github.com/sirupsen/logrus from 1.7.0 to 1.8.1 (#9639) (cherry picked from commit 47bf30cb1849af52d20d1ce08a3451e81c21bb0d) --- go.mod | 2 +- go.sum | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index cdaaafc14cbac..3bb4bcc6b7cac 100644 --- a/go.mod +++ b/go.mod @@ -114,7 +114,7 @@ require ( github.com/shirou/gopsutil v3.21.6-0.20210624221800-cb512c850043+incompatible github.com/shopspring/decimal v0.0.0-20200105231215-408a2507e114 // indirect github.com/signalfx/golib/v3 v3.3.34 - github.com/sirupsen/logrus v1.7.0 + github.com/sirupsen/logrus v1.8.1 github.com/snowflakedb/gosnowflake v1.5.0 github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 github.com/stretchr/testify v1.7.0 diff --git a/go.sum b/go.sum index 36cb6075f442c..a3d57f7a59a26 100644 --- a/go.sum +++ b/go.sum @@ -1388,8 +1388,9 @@ github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6Mwd github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= -github.com/sirupsen/logrus v1.7.0 h1:ShrD1U9pZB12TX0cVy0DtePoCH97K8EtX+mg7ZARUtM= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= +github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= From b1b160d7e38e725fe339251392b3d5a9ab78a6d7 Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 18 Aug 2021 18:09:11 -0600 Subject: [PATCH 83/85] update build version --- build_version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_version.txt b/build_version.txt index 836ae4eda2992..1b92e588b7943 100644 --- a/build_version.txt +++ b/build_version.txt @@ -1 +1 @@ -1.19.2 +1.19.3 From 25b04d4720926c47eef54e61ce79951fc8b34d49 Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 18 Aug 2021 18:27:27 -0600 Subject: [PATCH 84/85] Update changelog --- CHANGELOG.md | 23 +++++++++++++++++++++++ etc/telegraf.conf | 12 +++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f7ecd8d59ed24..053e9ee59bbf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +## v1.19.3 [2021-08-18] + +#### Bugfixes + + - [#9639](https://github.com/influxdata/telegraf/pull/9639) Update sirupsen/logrus module from 1.7.0 to 1.8.1 + - [#9638](https://github.com/influxdata/telegraf/pull/9638) Update testcontainers/testcontainers-go module from 0.11.0 to 0.11.1 + - [#9637](https://github.com/influxdata/telegraf/pull/9637) Update golang/snappy module from 0.0.3 to 0.0.4 + - [#9636](https://github.com/influxdata/telegraf/pull/9636) Update aws/aws-sdk-go-v2 module from 1.3.2 to 1.8.0 + - [#9605](https://github.com/influxdata/telegraf/pull/9605) `inputs.prometheus` Fix prometheus kubernetes pod discovery + - [#9606](https://github.com/influxdata/telegraf/pull/9606) `inputs.redis` Improve redis commands documentation + - [#9566](https://github.com/influxdata/telegraf/pull/9566) `outputs.cratedb` Replace dots in tag keys with underscores + - [#9401](https://github.com/influxdata/telegraf/pull/9401) `inputs.clickhouse` Fix panic, improve handling empty result set + - [#9583](https://github.com/influxdata/telegraf/pull/9583) `inputs.opcua` Avoid closing session on a closed connection + - [#9576](https://github.com/influxdata/telegraf/pull/9576) `processors.aws` Refactor ec2 init for config-api + - [#9571](https://github.com/influxdata/telegraf/pull/9571) `outputs.loki` Sort logs by timestamp before writing to Loki + - [#9524](https://github.com/influxdata/telegraf/pull/9524) `inputs.opcua` Fix reconnection regression introduced in 1.19.1 + - [#9581](https://github.com/influxdata/telegraf/pull/9581) `inputs.kube_inventory` Fix k8s nodes and pods parsing error + - [#9577](https://github.com/influxdata/telegraf/pull/9577) Update sensu/go module to v2.9.0 + - [#9554](https://github.com/influxdata/telegraf/pull/9554) `inputs.postgresql` Normalize unix socket path + - [#9565](https://github.com/influxdata/telegraf/pull/9565) Update hashicorp/consul/api module to 1.9.1 + - [#9552](https://github.com/influxdata/telegraf/pull/9552) `inputs.vsphere` Update vmware/govmomi module to v0.26.0 in order to support vSphere 7.0 + - [#9550](https://github.com/influxdata/telegraf/pull/9550) `inputs.opcua` Do not skip good quality nodes after a bad quality node is encountered + ## v1.19.2 [2021-07-28] #### Release Notes diff --git a/etc/telegraf.conf b/etc/telegraf.conf index 6c3c0e98b36bb..c49761c947bc4 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -506,6 +506,8 @@ # table = "metrics" # # If true, and the metrics table does not exist, create it automatically. # table_create = true +# # The character(s) to replace any '.' in an object key with +# key_separator = "_" # # Configuration for DataDog API to send metrics to. @@ -5741,9 +5743,13 @@ # # ## Optional. Specify redis commands to retrieve values # # [[inputs.redis.commands]] -# # command = ["get", "sample-key"] -# # field = "sample-key-value" -# # type = "string" +# # # The command to run where each argument is a separate element +# # command = ["get", "sample-key"] +# # # The field to store the result in +# # field = "sample-key-value" +# # # The type of the result +# # # Can be "string", "integer", or "float" +# # type = "string" # # ## specify server password # # password = "s#cr@t%" From a799489ff2417bdafe2bbe03af6172174a53d13b Mon Sep 17 00:00:00 2001 From: David Reimschussel Date: Wed, 18 Aug 2021 18:30:35 -0600 Subject: [PATCH 85/85] Telegraf v1.19.3