From 8c49ddccc3cb8f8fe020dc4e1f38b93a0f2ad467 Mon Sep 17 00:00:00 2001 From: Joshua Powers Date: Thu, 8 Sep 2022 12:49:36 -0600 Subject: [PATCH] chore: update to go1.19.1 (#11776) --- .circleci/config.yml | 2 +- Makefile | 4 +- agent/agent.go | 7 +- cmd/telegraf/printer.go | 1 + filter/filter.go | 9 ++- go.mod | 2 +- internal/snmp/translate.go | 4 +- internal/templating/node.go | 18 ++--- plugins/aggregators/basicstats/basicstats.go | 1 + plugins/aggregators/derivative/derivative.go | 1 + plugins/aggregators/final/final.go | 1 + plugins/aggregators/histogram/histogram.go | 1 + plugins/aggregators/merge/merge.go | 1 + plugins/aggregators/minmax/minmax.go | 1 + plugins/aggregators/quantile/quantile.go | 1 + plugins/aggregators/starlark/starlark.go | 1 + .../aggregators/valuecounter/valuecounter.go | 1 + plugins/common/shim/example/cmd/main.go | 8 +-- plugins/inputs/activemq/activemq.go | 1 + plugins/inputs/aerospike/aerospike.go | 1 + plugins/inputs/aliyuncms/aliyuncms.go | 3 +- plugins/inputs/aliyuncms/discovery.go | 16 ++--- plugins/inputs/amd_rocm_smi/amd_rocm_smi.go | 1 + plugins/inputs/amqp_consumer/amqp_consumer.go | 1 + plugins/inputs/apache/apache.go | 1 + plugins/inputs/apcupsd/apcupsd.go | 1 + plugins/inputs/aurora/aurora.go | 1 + .../azure_storage_queue.go | 1 + plugins/inputs/bcache/bcache.go | 1 + plugins/inputs/beanstalkd/beanstalkd.go | 1 + plugins/inputs/beat/beat.go | 1 + plugins/inputs/bind/bind.go | 1 + plugins/inputs/bond/bond.go | 1 + plugins/inputs/burrow/burrow.go | 1 + plugins/inputs/cassandra/cassandra.go | 1 + plugins/inputs/cassandra/cassandra_test.go | 8 ++- plugins/inputs/ceph/ceph.go | 1 + plugins/inputs/cgroup/cgroup.go | 1 + plugins/inputs/chrony/chrony.go | 27 +++---- .../cisco_telemetry_mdt.go | 1 + .../cisco_telemetry_util.go | 16 ++--- plugins/inputs/clickhouse/clickhouse.go | 1 + plugins/inputs/cloud_pubsub/cloud_pubsub.go | 1 + .../cloud_pubsub_push/cloud_pubsub_push.go | 1 + plugins/inputs/conntrack/conntrack.go | 1 + plugins/inputs/consul/consul.go | 1 + plugins/inputs/consul_agent/consul_agent.go | 1 + plugins/inputs/couchbase/couchbase.go | 1 + plugins/inputs/couchdb/couchdb.go | 1 + plugins/inputs/cpu/cpu.go | 1 + plugins/inputs/cpu/cpu_test.go | 17 ++--- plugins/inputs/csgo/csgo.go | 1 + plugins/inputs/dcos/dcos.go | 1 + plugins/inputs/disk/disk.go | 1 + plugins/inputs/diskio/diskio.go | 1 + plugins/inputs/disque/disque.go | 1 + plugins/inputs/dmcache/dmcache.go | 1 + plugins/inputs/dns_query/dns_query.go | 1 + plugins/inputs/docker/docker.go | 1 + plugins/inputs/docker_log/docker_log.go | 1 + plugins/inputs/dovecot/dovecot.go | 1 + plugins/inputs/dpdk/dpdk.go | 1 + plugins/inputs/ecs/ecs.go | 1 + plugins/inputs/elasticsearch/elasticsearch.go | 1 + .../elasticsearch_query.go | 1 + plugins/inputs/ethtool/ethtool.go | 1 + .../eventhub_consumer/eventhub_consumer.go | 1 + plugins/inputs/example/example.go | 1 + plugins/inputs/exec/exec.go | 1 + plugins/inputs/execd/execd.go | 1 + plugins/inputs/fail2ban/fail2ban.go | 1 + plugins/inputs/fibaro/fibaro.go | 1 + plugins/inputs/file/file.go | 1 + plugins/inputs/filecount/filecount.go | 1 + plugins/inputs/filestat/filestat.go | 1 + plugins/inputs/fireboard/fireboard.go | 1 + plugins/inputs/fluentd/fluentd.go | 9 ++- plugins/inputs/github/github.go | 1 + plugins/inputs/gnmi/gnmi.go | 3 +- plugins/inputs/graylog/graylog.go | 30 +++++--- plugins/inputs/graylog/graylog_test.go | 8 ++- plugins/inputs/haproxy/haproxy.go | 1 + plugins/inputs/haproxy/haproxy_test.go | 4 +- plugins/inputs/hddtemp/hddtemp.go | 1 + plugins/inputs/http/http.go | 9 ++- .../http_listener_v2/http_listener_v2.go | 1 + plugins/inputs/http_response/http_response.go | 1 + plugins/inputs/httpjson/httpjson.go | 19 +++-- plugins/inputs/httpjson/httpjson_test.go | 8 ++- plugins/inputs/hugepages/hugepages.go | 1 + plugins/inputs/icinga2/icinga2.go | 1 + plugins/inputs/infiniband/infiniband.go | 1 + .../influxdb_listener/influxdb_listener.go | 1 + .../influxdb_v2_listener.go | 1 + plugins/inputs/intel_pmu/intel_pmu.go | 1 + .../inputs/intel_powerstat/intel_powerstat.go | 1 + plugins/inputs/intel_rdt/intel_rdt.go | 1 + .../inputs/internet_speed/internet_speed.go | 1 + plugins/inputs/interrupts/interrupts.go | 1 + plugins/inputs/ipmi_sensor/ipmi_sensor.go | 1 + plugins/inputs/ipset/ipset.go | 1 + plugins/inputs/iptables/iptables.go | 1 + plugins/inputs/ipvs/ipvs.go | 1 + plugins/inputs/jenkins/jenkins.go | 1 + plugins/inputs/jolokia/jolokia.go | 1 + plugins/inputs/jolokia/jolokia_test.go | 8 ++- plugins/inputs/jolokia2/common/client.go | 42 +++++------ .../auth/authentication_service.pb.go | 1 - .../jti_openconfig_telemetry.go | 1 + .../jti_openconfig_telemetry/oc/oc.pb.go | 4 +- .../inputs/kafka_consumer/kafka_consumer.go | 1 + .../kafka_consumer_legacy.go | 1 + .../kafka_consumer_legacy_integration_test.go | 3 +- plugins/inputs/kapacitor/kapacitor.go | 9 ++- plugins/inputs/kernel/kernel.go | 1 + plugins/inputs/kernel_vmstat/kernel_vmstat.go | 1 + plugins/inputs/kibana/kibana.go | 1 + plugins/inputs/knx_listener/knx_listener.go | 1 + .../inputs/kube_inventory/kube_inventory.go | 1 + plugins/inputs/kubernetes/kubernetes.go | 3 +- plugins/inputs/lanz/lanz.go | 1 + plugins/inputs/leofs/leofs.go | 1 + plugins/inputs/leofs/leofs_test.go | 7 +- .../inputs/linux_sysctl_fs/linux_sysctl_fs.go | 1 + plugins/inputs/logparser/logparser.go | 1 + plugins/inputs/logstash/logstash.go | 1 + plugins/inputs/lustre2/lustre2.go | 8 ++- plugins/inputs/lvm/lvm.go | 1 + plugins/inputs/mailchimp/mailchimp.go | 1 + plugins/inputs/marklogic/marklogic.go | 1 + plugins/inputs/mcrouter/mcrouter.go | 1 + plugins/inputs/mdstat/mdstat.go | 1 + plugins/inputs/mem/mem.go | 1 + plugins/inputs/memcached/memcached.go | 1 + plugins/inputs/mesos/mesos.go | 1 + plugins/inputs/minecraft/minecraft.go | 1 + plugins/inputs/mock/mock.go | 1 + .../inputs/modbus/configuration_register.go | 1 + .../inputs/modbus/configuration_request.go | 1 + plugins/inputs/modbus/modbus.go | 2 + plugins/inputs/mongodb/mongodb.go | 1 + plugins/inputs/monit/monit.go | 1 + plugins/inputs/mqtt_consumer/mqtt_consumer.go | 1 + plugins/inputs/multifile/multifile.go | 1 + plugins/inputs/mysql/mysql.go | 1 + plugins/inputs/nats/nats.go | 1 + plugins/inputs/nats_consumer/nats_consumer.go | 1 + plugins/inputs/neptune_apex/neptune_apex.go | 6 +- plugins/inputs/net/net.go | 1 + plugins/inputs/net_response/net_response.go | 1 + plugins/inputs/netstat/netstat.go | 1 + plugins/inputs/nfsclient/nfsclient.go | 1 + plugins/inputs/nginx/nginx.go | 1 + plugins/inputs/nginx_plus/nginx_plus.go | 1 + .../inputs/nginx_plus_api/nginx_plus_api.go | 1 + plugins/inputs/nginx_sts/nginx_sts.go | 1 + .../nginx_upstream_check.go | 1 + plugins/inputs/nginx_vts/nginx_vts.go | 1 + plugins/inputs/nomad/nomad.go | 1 + plugins/inputs/nsd/nsd.go | 1 + plugins/inputs/nsq/nsq.go | 1 + plugins/inputs/nsq_consumer/nsq_consumer.go | 3 +- plugins/inputs/nstat/nstat.go | 1 + plugins/inputs/nvidia_smi/nvidia_smi.go | 1 + plugins/inputs/openldap/openldap.go | 1 + plugins/inputs/openntpd/openntpd.go | 1 + plugins/inputs/opensmtpd/opensmtpd.go | 2 +- plugins/inputs/openstack/openstack.go | 4 +- plugins/inputs/opentelemetry/opentelemetry.go | 1 + .../inputs/openweathermap/openweathermap.go | 1 + plugins/inputs/passenger/passenger.go | 1 + plugins/inputs/pf/pf.go | 1 + plugins/inputs/pgbouncer/pgbouncer.go | 1 + plugins/inputs/phpfpm/phpfpm.go | 1 + plugins/inputs/phpfpm/phpfpm_test.go | 4 +- plugins/inputs/ping/ping.go | 1 + plugins/inputs/ping/ping_notwindows.go | 12 ++-- plugins/inputs/postfix/postfix.go | 1 + plugins/inputs/postgresql/postgresql.go | 1 + .../postgresql_extensible.go | 1 + plugins/inputs/powerdns/powerdns.go | 1 + .../powerdns_recursor/powerdns_recursor.go | 1 + plugins/inputs/processes/processes.go | 1 + plugins/inputs/processes/processes_test.go | 4 +- plugins/inputs/procstat/native_finder.go | 10 +-- .../procstat/native_finder_notwindows.go | 2 +- plugins/inputs/procstat/procstat.go | 1 + plugins/inputs/prometheus/prometheus.go | 1 + plugins/inputs/proxmox/proxmox.go | 1 + plugins/inputs/puppetagent/puppetagent.go | 1 + plugins/inputs/rabbitmq/rabbitmq.go | 1 + plugins/inputs/raindrops/raindrops.go | 1 + plugins/inputs/ras/ras.go | 1 + plugins/inputs/ravendb/ravendb.go | 1 + plugins/inputs/redfish/redfish.go | 1 + plugins/inputs/redis/redis.go | 15 ++-- .../inputs/redis_sentinel/redis_sentinel.go | 1 + plugins/inputs/rethinkdb/rethinkdb.go | 1 + plugins/inputs/riak/riak.go | 1 + .../riemann_listener/riemann_listener.go | 1 + plugins/inputs/salesforce/salesforce.go | 1 + plugins/inputs/sensors/sensors.go | 5 +- plugins/inputs/sflow/sflow.go | 1 + plugins/inputs/slab/slab.go | 1 + plugins/inputs/smart/smart.go | 1 + plugins/inputs/snmp/gosmi.go | 1 + plugins/inputs/snmp/gosmi_test.go | 12 ++-- plugins/inputs/snmp/netsnmp.go | 6 +- plugins/inputs/snmp/snmp.go | 1 + plugins/inputs/snmp_legacy/snmp_legacy.go | 1 + plugins/inputs/snmp_trap/snmp_trap.go | 1 + .../inputs/socket_listener/socket_listener.go | 1 + plugins/inputs/socketstat/socketstat.go | 1 + plugins/inputs/solr/solr.go | 1 + plugins/inputs/sql/sql.go | 1 + plugins/inputs/sqlserver/azuresqldbqueries.go | 6 +- .../sqlserver/azuresqlmanagedqueries.go | 6 +- .../inputs/sqlserver/azuresqlpoolqueries.go | 6 +- plugins/inputs/sqlserver/sqlqueriesV2.go | 5 +- plugins/inputs/sqlserver/sqlserver.go | 1 + plugins/inputs/sqlserver/sqlserverqueries.go | 3 + plugins/inputs/stackdriver/stackdriver.go | 1 + plugins/inputs/statsd/running_stats.go | 3 +- plugins/inputs/statsd/statsd.go | 1 + plugins/inputs/supervisor/supervisor.go | 1 + plugins/inputs/suricata/suricata.go | 1 + plugins/inputs/swap/swap.go | 1 + plugins/inputs/synproxy/synproxy.go | 1 + plugins/inputs/syslog/syslog.go | 1 + plugins/inputs/sysstat/sysstat.go | 9 ++- plugins/inputs/system/system.go | 1 + plugins/inputs/systemd_units/systemd_units.go | 1 + plugins/inputs/tail/tail.go | 1 + plugins/inputs/tcp_listener/tcp_listener.go | 1 + plugins/inputs/teamspeak/teamspeak.go | 1 + plugins/inputs/temp/temp.go | 1 + plugins/inputs/tengine/tengine.go | 1 + plugins/inputs/tomcat/tomcat.go | 1 + plugins/inputs/trig/trig.go | 1 + plugins/inputs/twemproxy/twemproxy.go | 1 + plugins/inputs/udp_listener/udp_listener.go | 1 + plugins/inputs/unbound/unbound.go | 2 +- plugins/inputs/upsd/upsd.go | 1 + plugins/inputs/uwsgi/uwsgi.go | 4 +- plugins/inputs/varnish/varnish.go | 1 + plugins/inputs/vault/vault.go | 1 + plugins/inputs/vsphere/endpoint.go | 4 +- plugins/inputs/vsphere/vsphere.go | 1 + plugins/inputs/webhooks/webhooks.go | 1 + plugins/inputs/win_eventlog/event.go | 3 +- .../inputs/win_eventlog/syscall_windows.go | 3 +- plugins/inputs/win_eventlog/util.go | 3 +- plugins/inputs/win_eventlog/util_test.go | 3 +- plugins/inputs/win_eventlog/win_eventlog.go | 4 +- .../win_eventlog/win_eventlog_notwindows.go | 3 +- .../inputs/win_eventlog/win_eventlog_test.go | 3 +- .../inputs/win_eventlog/zsyscall_windows.go | 3 +- plugins/inputs/win_perf_counters/pdh.go | 71 +++++++++---------- plugins/inputs/win_perf_counters/pdh_386.go | 2 +- plugins/inputs/win_perf_counters/pdh_amd64.go | 2 +- .../win_perf_counters/performance_query.go | 12 ++-- .../win_perf_counters/win_perf_counters.go | 1 + .../win_perf_counters_test.go | 2 +- plugins/inputs/win_services/win_services.go | 3 +- .../win_services_integration_test.go | 2 +- .../inputs/win_services/win_services_test.go | 2 +- plugins/inputs/wireguard/wireguard.go | 1 + plugins/inputs/wireless/wireless.go | 1 + plugins/inputs/xtremio/xtremio.go | 1 + plugins/inputs/zfs/zfs.go | 1 + .../cmd/thrift_serialize/thrift_serialize.go | 2 - plugins/inputs/zipkin/codec/codec.go | 2 +- .../thrift/gen-go/zipkincore/zipkinCore.go | 55 +++++++------- plugins/inputs/zipkin/trace/trace.go | 2 +- plugins/inputs/zipkin/zipkin.go | 1 + plugins/inputs/zookeeper/zookeeper.go | 1 + plugins/outputs/amon/amon.go | 1 + .../application_insights.go | 1 + .../azure_data_explorer.go | 1 + .../outputs/azure_monitor/azure_monitor.go | 1 + plugins/outputs/bigquery/bigquery.go | 1 + plugins/outputs/cloud_pubsub/cloud_pubsub.go | 1 + plugins/outputs/cratedb/cratedb.go | 1 + plugins/outputs/datadog/datadog.go | 1 + plugins/outputs/discard/discard.go | 1 + plugins/outputs/dynatrace/dynatrace.go | 1 + .../outputs/elasticsearch/elasticsearch.go | 1 + plugins/outputs/event_hubs/event_hubs.go | 1 + plugins/outputs/exec/exec.go | 1 + plugins/outputs/execd/execd.go | 1 + plugins/outputs/file/file.go | 1 + plugins/outputs/graphite/graphite.go | 1 + plugins/outputs/graylog/graylog.go | 1 + plugins/outputs/groundwork/groundwork.go | 1 + plugins/outputs/health/health.go | 1 + plugins/outputs/influxdb/http_test.go | 2 +- plugins/outputs/influxdb/influxdb.go | 4 +- plugins/outputs/influxdb_v2/influxdb_v2.go | 1 + plugins/outputs/instrumental/instrumental.go | 1 + plugins/outputs/iotdb/iotdb.go | 1 + plugins/outputs/kafka/kafka.go | 1 + plugins/outputs/librato/librato.go | 3 +- plugins/outputs/logzio/logzio.go | 1 + plugins/outputs/loki/loki.go | 1 + plugins/outputs/mongodb/mongodb.go | 1 + plugins/outputs/mqtt/mqtt.go | 1 + plugins/outputs/nats/nats.go | 1 + plugins/outputs/newrelic/newrelic.go | 1 + plugins/outputs/nsq/nsq.go | 1 + .../outputs/opentelemetry/opentelemetry.go | 1 + plugins/outputs/opentsdb/opentsdb.go | 1 + plugins/outputs/postgresql/datatype_uint8.go | 2 +- plugins/outputs/postgresql/table_manager.go | 1 + .../prometheus_client/prometheus_client.go | 1 + plugins/outputs/riemann/riemann.go | 1 + .../outputs/riemann_legacy/riemann_legacy.go | 1 + plugins/outputs/sensu/sensu.go | 1 + plugins/outputs/signalfx/signalfx.go | 3 +- .../outputs/socket_writer/socket_writer.go | 1 + plugins/outputs/sql/sql.go | 1 + plugins/outputs/stackdriver/stackdriver.go | 1 + plugins/outputs/stomp/stomp.go | 1 + plugins/outputs/sumologic/sumologic.go | 1 + plugins/outputs/syslog/syslog.go | 1 + plugins/outputs/warp10/warp10.go | 1 + plugins/outputs/wavefront/wavefront.go | 1 + plugins/outputs/websocket/websocket.go | 1 + .../yandex_cloud_monitoring.go | 1 + plugins/parsers/graphite/parser.go | 1 + plugins/parsers/grok/parser.go | 10 +-- plugins/parsers/json/parser_test.go | 2 +- plugins/processors/aws/ec2/ec2.go | 1 + plugins/processors/clone/clone.go | 1 + plugins/processors/converter/converter.go | 1 + plugins/processors/date/date.go | 1 + plugins/processors/dedup/dedup.go | 1 + plugins/processors/defaults/defaults.go | 1 + plugins/processors/enum/enum.go | 1 + plugins/processors/execd/execd.go | 1 + plugins/processors/filepath/filepath.go | 1 + plugins/processors/ifname/ifname.go | 1 + plugins/processors/noise/noise.go | 1 + plugins/processors/override/override.go | 1 + plugins/processors/parser/parser.go | 1 + plugins/processors/parser/parser_test.go | 2 +- plugins/processors/pivot/pivot.go | 1 + plugins/processors/port_name/port_name.go | 1 + plugins/processors/printer/printer.go | 1 + plugins/processors/regex/regex.go | 1 + plugins/processors/rename/rename.go | 1 + plugins/processors/reverse_dns/reverse_dns.go | 1 + plugins/processors/s2geo/s2geo.go | 1 + plugins/processors/starlark/starlark.go | 1 + plugins/processors/strings/strings.go | 1 + plugins/processors/tag_limit/tag_limit.go | 1 + plugins/processors/template/template.go | 1 + plugins/processors/topk/test_sets.go | 4 +- plugins/processors/topk/topk.go | 1 + plugins/processors/topk/topk_test.go | 11 +-- plugins/processors/unpivot/unpivot.go | 1 + plugins/serializers/wavefront/wavefront.go | 3 +- scripts/ci.docker | 2 +- scripts/installgo_linux.sh | 5 +- scripts/installgo_mac.sh | 6 +- scripts/installgo_windows.sh | 2 +- testutil/file.go | 8 +-- testutil/testutil.go | 9 +-- tools/readme_config_includer/generator.go | 8 ++- tools/readme_linter/assert.go | 2 +- 369 files changed, 687 insertions(+), 309 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index a91776647dc4a..a26637817fa82 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,7 +8,7 @@ executors: working_directory: '/go/src/github.com/influxdata/telegraf' resource_class: large docker: - - image: 'quay.io/influxdb/telegraf-ci:1.18.5' + - image: 'quay.io/influxdb/telegraf-ci:1.19.1' environment: GOFLAGS: -p=4 mac: diff --git a/Makefile b/Makefile index 37b7ad7f11a1d..231c91ddbeb84 100644 --- a/Makefile +++ b/Makefile @@ -242,8 +242,8 @@ plugins/parsers/influx/machine.go: plugins/parsers/influx/machine.go.rl .PHONY: ci ci: - docker build -t quay.io/influxdb/telegraf-ci:1.18.5 - < scripts/ci.docker - docker push quay.io/influxdb/telegraf-ci:1.18.5 + docker build -t quay.io/influxdb/telegraf-ci:1.19.1 - < scripts/ci.docker + docker push quay.io/influxdb/telegraf-ci:1.19.1 .PHONY: install install: $(buildbin) diff --git a/agent/agent.go b/agent/agent.go index d5cd68ecc73e3..6a6005b794e01 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -50,6 +50,7 @@ type inputUnit struct { // ______ ┌───────────┐ ______ // ()_____)──▶ │ Processor │──▶ ()_____) // └───────────┘ + type processorUnit struct { src <-chan telegraf.Metric dst chan<- telegraf.Metric @@ -59,7 +60,7 @@ type processorUnit struct { // aggregatorUnit is a group of Aggregators and their source and sink channels. // Typically the aggregators write to a processor channel and pass the original // metrics to the output channel. The sink channels may be the same channel. -// + // ┌────────────┐ // ┌──▶ │ Aggregator │───┐ // │ └────────────┘ │ @@ -71,6 +72,7 @@ type processorUnit struct { // │ └────────────┘ // │ ______ // └────────────────────────▶ ()_____) + type aggregatorUnit struct { src <-chan telegraf.Metric aggC chan<- telegraf.Metric @@ -80,7 +82,7 @@ type aggregatorUnit struct { // outputUnit is a group of Outputs and their source channel. Metrics on the // channel are written to all outputs. -// + // ┌────────┐ // ┌──▶ │ Output │ // │ └────────┘ @@ -90,6 +92,7 @@ type aggregatorUnit struct { // │ ┌────────┐ // └──▶ │ Output │ // └────────┘ + type outputUnit struct { src <-chan telegraf.Metric outputs []*models.RunningOutput diff --git a/cmd/telegraf/printer.go b/cmd/telegraf/printer.go index 4bf03734b3f89..38d4524651542 100644 --- a/cmd/telegraf/printer.go +++ b/cmd/telegraf/printer.go @@ -54,6 +54,7 @@ var globalTagsConfig = ` ` // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the agentConfig data. +// //go:embed agent.conf var agentConfig string diff --git a/filter/filter.go b/filter/filter.go index 2af93ec8de267..3e3798a47d2d8 100644 --- a/filter/filter.go +++ b/filter/filter.go @@ -14,11 +14,10 @@ type Filter interface { // for matching a given string against the filter list. The filter list // supports glob matching too, ie: // -// f, _ := Compile([]string{"cpu", "mem", "net*"}) -// f.Match("cpu") // true -// f.Match("network") // true -// f.Match("memory") // false -// +// f, _ := Compile([]string{"cpu", "mem", "net*"}) +// f.Match("cpu") // true +// f.Match("network") // true +// f.Match("memory") // false func Compile(filters []string) (Filter, error) { // return if there is nothing to compile if len(filters) == 0 { diff --git a/go.mod b/go.mod index bd79f8b7134e4..449904f5bd978 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/influxdata/telegraf -go 1.18 +go 1.19 // Workaround for https://github.com/lxc/lxd/issues/10745 (failing "go list -m all") replace google.golang.org/grpc/naming => google.golang.org/grpc v1.29.1 diff --git a/internal/snmp/translate.go b/internal/snmp/translate.go index 603dc27129e31..309ab5db022ee 100644 --- a/internal/snmp/translate.go +++ b/internal/snmp/translate.go @@ -49,7 +49,7 @@ func ClearCache() { cache = make(map[string]bool) } -//will give all found folders to gosmi and load in all modules found in the folders +// will give all found folders to gosmi and load in all modules found in the folders func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) error { folders, err := walkPaths(paths, log) if err != nil { @@ -89,7 +89,7 @@ func LoadMibsFromPath(paths []string, log telegraf.Logger, loader MibLoader) err return nil } -//should walk the paths given and find all folders +// should walk the paths given and find all folders func walkPaths(paths []string, log telegraf.Logger) ([]string, error) { once.Do(gosmi.Init) folders := []string{} diff --git a/internal/templating/node.go b/internal/templating/node.go index bf68509a0fe66..8466fa7b39ae9 100644 --- a/internal/templating/node.go +++ b/internal/templating/node.go @@ -105,16 +105,18 @@ type nodes []*node // less than a non-wildcard value. // // For example, the filters: -// "*.*" -// "servers.*" -// "servers.localhost" -// "*.localhost" +// +// "*.*" +// "servers.*" +// "servers.localhost" +// "*.localhost" // // Would be sorted as: -// "servers.localhost" -// "servers.*" -// "*.localhost" -// "*.*" +// +// "servers.localhost" +// "servers.*" +// "*.localhost" +// "*.*" func (n *nodes) Less(j, k int) bool { if (*n)[j].value == "*" && (*n)[k].value != "*" { return false diff --git a/plugins/aggregators/basicstats/basicstats.go b/plugins/aggregators/basicstats/basicstats.go index 7e912fe48aa21..0d8e3db5c25d2 100644 --- a/plugins/aggregators/basicstats/basicstats.go +++ b/plugins/aggregators/basicstats/basicstats.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/derivative/derivative.go b/plugins/aggregators/derivative/derivative.go index 3e86d71322c38..f2c4e91b40f59 100644 --- a/plugins/aggregators/derivative/derivative.go +++ b/plugins/aggregators/derivative/derivative.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/final/final.go b/plugins/aggregators/final/final.go index c67695a36d0a7..78b7fd3ea46e9 100644 --- a/plugins/aggregators/final/final.go +++ b/plugins/aggregators/final/final.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/histogram/histogram.go b/plugins/aggregators/histogram/histogram.go index bacab1a1c1d0e..f40e92ce59d33 100644 --- a/plugins/aggregators/histogram/histogram.go +++ b/plugins/aggregators/histogram/histogram.go @@ -13,6 +13,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/merge/merge.go b/plugins/aggregators/merge/merge.go index a9735f26c16cd..365fa5b8558bc 100644 --- a/plugins/aggregators/merge/merge.go +++ b/plugins/aggregators/merge/merge.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/minmax/minmax.go b/plugins/aggregators/minmax/minmax.go index 076fae73c982d..8bd7080d6ce40 100644 --- a/plugins/aggregators/minmax/minmax.go +++ b/plugins/aggregators/minmax/minmax.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/quantile/quantile.go b/plugins/aggregators/quantile/quantile.go index 551b6772e0d04..7d132aa18d8da 100644 --- a/plugins/aggregators/quantile/quantile.go +++ b/plugins/aggregators/quantile/quantile.go @@ -10,6 +10,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/starlark/starlark.go b/plugins/aggregators/starlark/starlark.go index 5c536fa33768a..c1b413eb0ad47 100644 --- a/plugins/aggregators/starlark/starlark.go +++ b/plugins/aggregators/starlark/starlark.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/aggregators/valuecounter/valuecounter.go b/plugins/aggregators/valuecounter/valuecounter.go index 0ddbe43b16b21..4672a6f60c004 100644 --- a/plugins/aggregators/valuecounter/valuecounter.go +++ b/plugins/aggregators/valuecounter/valuecounter.go @@ -10,6 +10,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/common/shim/example/cmd/main.go b/plugins/common/shim/example/cmd/main.go index 27c5b8741adc3..6f6c5549b24a5 100644 --- a/plugins/common/shim/example/cmd/main.go +++ b/plugins/common/shim/example/cmd/main.go @@ -22,16 +22,16 @@ var err error // However, if you want to do all your config in code, you can like so: // // // initialize your plugin with any settings you want -// myInput := &mypluginname.MyPlugin{ -// DefaultSettingHere: 3, -// } +// +// myInput := &mypluginname.MyPlugin{ +// DefaultSettingHere: 3, +// } // // shim := shim.New() // // shim.AddInput(myInput) // // // now the shim.Run() call as below. Note the shim is only intended to run a single plugin. -// func main() { // parse command line options flag.Parse() diff --git a/plugins/inputs/activemq/activemq.go b/plugins/inputs/activemq/activemq.go index 11dcb78f4f64a..48771165883c5 100644 --- a/plugins/inputs/activemq/activemq.go +++ b/plugins/inputs/activemq/activemq.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/aerospike/aerospike.go b/plugins/inputs/aerospike/aerospike.go index bd5724c3ebd22..98e4f67b93cc2 100644 --- a/plugins/inputs/aerospike/aerospike.go +++ b/plugins/inputs/aerospike/aerospike.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/aliyuncms/aliyuncms.go b/plugins/inputs/aliyuncms/aliyuncms.go index ef5ae4a9d852e..977c900662b61 100644 --- a/plugins/inputs/aliyuncms/aliyuncms.go +++ b/plugins/inputs/aliyuncms/aliyuncms.go @@ -24,6 +24,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -341,7 +342,7 @@ func (s *AliyunCMS) gatherMetric(acc telegraf.Accumulator, metricName string, me return nil } -//tag helper +// tag helper func parseTag(tagSpec string, data interface{}) (tagKey string, tagValue string, err error) { var ( ok bool diff --git a/plugins/inputs/aliyuncms/discovery.go b/plugins/inputs/aliyuncms/discovery.go index 2298f82b494a7..9d4aff17b4965 100644 --- a/plugins/inputs/aliyuncms/discovery.go +++ b/plugins/inputs/aliyuncms/discovery.go @@ -52,8 +52,8 @@ type parsedDResp struct { pageNumber int } -//getRPCReqFromDiscoveryRequest - utility function to map between aliyun request primitives -//discoveryRequest represents different type of discovery requests +// getRPCReqFromDiscoveryRequest - utility function to map between aliyun request primitives +// discoveryRequest represents different type of discovery requests func getRPCReqFromDiscoveryRequest(req discoveryRequest) (*requests.RpcRequest, error) { if reflect.ValueOf(req).Type().Kind() != reflect.Ptr || reflect.ValueOf(req).IsNil() { @@ -80,12 +80,12 @@ func getRPCReqFromDiscoveryRequest(req discoveryRequest) (*requests.RpcRequest, return nil, errors.Errorf("didn't find *requests.RpcRequest embedded struct in %q", ptrV.Type()) } -//newDiscoveryTool function returns discovery tool object. -//The object is used to periodically get data about aliyun objects and send this -//data into channel. The intention is to enrich reported metrics with discovery data. -//Discovery is supported for a limited set of object types (defined by project) and can be extended in future. -//Discovery can be limited by region if not set, then all regions is queried. -//Request against API can inquire additional costs, consult with aliyun API documentation. +// newDiscoveryTool function returns discovery tool object. +// The object is used to periodically get data about aliyun objects and send this +// data into channel. The intention is to enrich reported metrics with discovery data. +// Discovery is supported for a limited set of object types (defined by project) and can be extended in future. +// Discovery can be limited by region if not set, then all regions is queried. +// Request against API can inquire additional costs, consult with aliyun API documentation. func newDiscoveryTool(regions []string, project string, lg telegraf.Logger, credential auth.Credential, rateLimit int, discoveryInterval time.Duration) (*discoveryTool, error) { var ( dscReq = map[string]discoveryRequest{} diff --git a/plugins/inputs/amd_rocm_smi/amd_rocm_smi.go b/plugins/inputs/amd_rocm_smi/amd_rocm_smi.go index 53157d31dbcee..069b767d2054a 100644 --- a/plugins/inputs/amd_rocm_smi/amd_rocm_smi.go +++ b/plugins/inputs/amd_rocm_smi/amd_rocm_smi.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/amqp_consumer/amqp_consumer.go b/plugins/inputs/amqp_consumer/amqp_consumer.go index 4c6d366121d07..80950423b8dd5 100644 --- a/plugins/inputs/amqp_consumer/amqp_consumer.go +++ b/plugins/inputs/amqp_consumer/amqp_consumer.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/apache/apache.go b/plugins/inputs/apache/apache.go index 761c25d31e620..50087a0a2356a 100644 --- a/plugins/inputs/apache/apache.go +++ b/plugins/inputs/apache/apache.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/apcupsd/apcupsd.go b/plugins/inputs/apcupsd/apcupsd.go index 1122df7e4bc94..6af82177e96eb 100644 --- a/plugins/inputs/apcupsd/apcupsd.go +++ b/plugins/inputs/apcupsd/apcupsd.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/aurora/aurora.go b/plugins/inputs/aurora/aurora.go index 131fd8882669b..a49b27ac46a5f 100644 --- a/plugins/inputs/aurora/aurora.go +++ b/plugins/inputs/aurora/aurora.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/azure_storage_queue/azure_storage_queue.go b/plugins/inputs/azure_storage_queue/azure_storage_queue.go index ca80a16b7cd9b..ad924c94b3dd4 100644 --- a/plugins/inputs/azure_storage_queue/azure_storage_queue.go +++ b/plugins/inputs/azure_storage_queue/azure_storage_queue.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/bcache/bcache.go b/plugins/inputs/bcache/bcache.go index 67cb714193cb7..e21a464015f21 100644 --- a/plugins/inputs/bcache/bcache.go +++ b/plugins/inputs/bcache/bcache.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/beanstalkd/beanstalkd.go b/plugins/inputs/beanstalkd/beanstalkd.go index 68c189f345cfb..aed14c83679bc 100644 --- a/plugins/inputs/beanstalkd/beanstalkd.go +++ b/plugins/inputs/beanstalkd/beanstalkd.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/beat/beat.go b/plugins/inputs/beat/beat.go index 7558d8e58c8c8..4483f9556a8dd 100644 --- a/plugins/inputs/beat/beat.go +++ b/plugins/inputs/beat/beat.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/bind/bind.go b/plugins/inputs/bind/bind.go index 321822d63f4bf..daedc8251cf33 100644 --- a/plugins/inputs/bind/bind.go +++ b/plugins/inputs/bind/bind.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/bond/bond.go b/plugins/inputs/bond/bond.go index c8a6b7c848703..be7ff2467cd69 100644 --- a/plugins/inputs/bond/bond.go +++ b/plugins/inputs/bond/bond.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/burrow/burrow.go b/plugins/inputs/burrow/burrow.go index b5415ae2f22f3..68552bf001d12 100644 --- a/plugins/inputs/burrow/burrow.go +++ b/plugins/inputs/burrow/burrow.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cassandra/cassandra.go b/plugins/inputs/cassandra/cassandra.go index 13f76c92b2d54..c6d3ea57eb0eb 100644 --- a/plugins/inputs/cassandra/cassandra.go +++ b/plugins/inputs/cassandra/cassandra.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cassandra/cassandra_test.go b/plugins/inputs/cassandra/cassandra_test.go index 35551cf847970..791686297f41e 100644 --- a/plugins/inputs/cassandra/cassandra_test.go +++ b/plugins/inputs/cassandra/cassandra_test.go @@ -114,11 +114,13 @@ func (c jolokiaClientStub) MakeRequest(_ *http.Request) (*http.Response, error) // Generates a pointer to an HttpJson object that uses a mock HTTP client. // Parameters: -// response : Body of the response that the mock HTTP client should return -// statusCode: HTTP status code the mock HTTP client should return +// +// response : Body of the response that the mock HTTP client should return +// statusCode: HTTP status code the mock HTTP client should return // // Returns: -// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client +// +// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client func genJolokiaClientStub(response string, statusCode int, servers []string, metrics []string) *Cassandra { return &Cassandra{ jClient: jolokiaClientStub{responseBody: response, statusCode: statusCode}, diff --git a/plugins/inputs/ceph/ceph.go b/plugins/inputs/ceph/ceph.go index 8b1ac3b38c32a..b338dd8efcdcc 100644 --- a/plugins/inputs/ceph/ceph.go +++ b/plugins/inputs/ceph/ceph.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cgroup/cgroup.go b/plugins/inputs/cgroup/cgroup.go index f5ded195ef324..f62a531d43285 100644 --- a/plugins/inputs/cgroup/cgroup.go +++ b/plugins/inputs/cgroup/cgroup.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/chrony/chrony.go b/plugins/inputs/chrony/chrony.go index 7052ae538baba..a6829426d4751 100644 --- a/plugins/inputs/chrony/chrony.go +++ b/plugins/inputs/chrony/chrony.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -63,19 +64,19 @@ func (c *Chrony) Gather(acc telegraf.Accumulator) error { // processChronycOutput takes in a string output from the chronyc command, like: // -// Reference ID : 192.168.1.22 (ntp.example.com) -// Stratum : 3 -// Ref time (UTC) : Thu May 12 14:27:07 2016 -// System time : 0.000020390 seconds fast of NTP time -// Last offset : +0.000012651 seconds -// RMS offset : 0.000025577 seconds -// Frequency : 16.001 ppm slow -// Residual freq : -0.000 ppm -// Skew : 0.006 ppm -// Root delay : 0.001655 seconds -// Root dispersion : 0.003307 seconds -// Update interval : 507.2 seconds -// Leap status : Normal +// Reference ID : 192.168.1.22 (ntp.example.com) +// Stratum : 3 +// Ref time (UTC) : Thu May 12 14:27:07 2016 +// System time : 0.000020390 seconds fast of NTP time +// Last offset : +0.000012651 seconds +// RMS offset : 0.000025577 seconds +// Frequency : 16.001 ppm slow +// Residual freq : -0.000 ppm +// Skew : 0.006 ppm +// Root delay : 0.001655 seconds +// Root dispersion : 0.003307 seconds +// Update interval : 507.2 seconds +// Leap status : Normal // // The value on the left side of the colon is used as field name, if the first field on // the right side is a float. If it cannot be parsed as float, it is a tag name. diff --git a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go index 28b300bbe7217..87ee5cd573ee6 100644 --- a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go +++ b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go @@ -32,6 +32,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go index 1d7d95a95a757..7454d60f99402 100644 --- a/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go +++ b/plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_util.go @@ -7,7 +7,7 @@ import ( telemetry "github.com/cisco-ie/nx-telemetry-proto/telemetry_bis" ) -//xform Field to string +// xform Field to string func xformValueString(field *telemetry.TelemetryField) string { var str string switch val := field.ValueByType.(type) { @@ -31,7 +31,7 @@ func xformValueString(field *telemetry.TelemetryField) string { return "" } -//xform Uint64 to int64 +// xform Uint64 to int64 func nxosValueXformUint64Toint64(field *telemetry.TelemetryField, value interface{}) interface{} { if field.GetUint64Value() != 0 { return int64(value.(uint64)) @@ -39,7 +39,7 @@ func nxosValueXformUint64Toint64(field *telemetry.TelemetryField, value interfac return nil } -//xform string to float +// xform string to float func nxosValueXformStringTofloat(field *telemetry.TelemetryField, _ interface{}) interface{} { //convert property to float from string. vals := field.GetStringValue() @@ -51,7 +51,7 @@ func nxosValueXformStringTofloat(field *telemetry.TelemetryField, _ interface{}) return nil } -//xform string to uint64 +// xform string to uint64 func nxosValueXformStringToUint64(field *telemetry.TelemetryField, _ interface{}) interface{} { //string to uint64 vals := field.GetStringValue() @@ -63,7 +63,7 @@ func nxosValueXformStringToUint64(field *telemetry.TelemetryField, _ interface{} return nil } -//xform string to int64 +// xform string to int64 func nxosValueXformStringToInt64(field *telemetry.TelemetryField, _ interface{}) interface{} { //string to int64 vals := field.GetStringValue() @@ -75,7 +75,7 @@ func nxosValueXformStringToInt64(field *telemetry.TelemetryField, _ interface{}) return nil } -//auto-xform float properties +// auto-xform float properties func nxosValueAutoXformFloatProp(field *telemetry.TelemetryField, _ interface{}) interface{} { //check if we want auto xformation vals := field.GetStringValue() @@ -87,7 +87,7 @@ func nxosValueAutoXformFloatProp(field *telemetry.TelemetryField, _ interface{}) return nil } -//xform uint64 to string +// xform uint64 to string func nxosValueXformUint64ToString(field *telemetry.TelemetryField, _ interface{}) interface{} { switch val := field.ValueByType.(type) { case *telemetry.TelemetryField_StringValue: @@ -100,7 +100,7 @@ func nxosValueXformUint64ToString(field *telemetry.TelemetryField, _ interface{} return nil } -//Xform value field. +// Xform value field. func (c *CiscoTelemetryMDT) nxosValueXform(field *telemetry.TelemetryField, value interface{}, path string) interface{} { if strings.ContainsRune(path, ':') { // not NXOS diff --git a/plugins/inputs/clickhouse/clickhouse.go b/plugins/inputs/clickhouse/clickhouse.go index d444d6035f0ba..a0c7e09578be7 100644 --- a/plugins/inputs/clickhouse/clickhouse.go +++ b/plugins/inputs/clickhouse/clickhouse.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cloud_pubsub/cloud_pubsub.go b/plugins/inputs/cloud_pubsub/cloud_pubsub.go index 98858cfc9f599..978dabc1fc8f7 100644 --- a/plugins/inputs/cloud_pubsub/cloud_pubsub.go +++ b/plugins/inputs/cloud_pubsub/cloud_pubsub.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cloud_pubsub_push/cloud_pubsub_push.go b/plugins/inputs/cloud_pubsub_push/cloud_pubsub_push.go index f81adb508d1b2..1facd23ef798c 100644 --- a/plugins/inputs/cloud_pubsub_push/cloud_pubsub_push.go +++ b/plugins/inputs/cloud_pubsub_push/cloud_pubsub_push.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/conntrack/conntrack.go b/plugins/inputs/conntrack/conntrack.go index 57db11bfd2905..072e5a03db136 100644 --- a/plugins/inputs/conntrack/conntrack.go +++ b/plugins/inputs/conntrack/conntrack.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/consul/consul.go b/plugins/inputs/consul/consul.go index 4a3da718ff11c..498c6187e6bc0 100644 --- a/plugins/inputs/consul/consul.go +++ b/plugins/inputs/consul/consul.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/consul_agent/consul_agent.go b/plugins/inputs/consul_agent/consul_agent.go index d82c2f7f7d7c5..1426d900cf5f4 100644 --- a/plugins/inputs/consul_agent/consul_agent.go +++ b/plugins/inputs/consul_agent/consul_agent.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/couchbase/couchbase.go b/plugins/inputs/couchbase/couchbase.go index e3af5bbfeb232..915e089ea0a08 100644 --- a/plugins/inputs/couchbase/couchbase.go +++ b/plugins/inputs/couchbase/couchbase.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/couchdb/couchdb.go b/plugins/inputs/couchdb/couchdb.go index a17523a3a8bc8..2c67093a36f4e 100644 --- a/plugins/inputs/couchdb/couchdb.go +++ b/plugins/inputs/couchdb/couchdb.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cpu/cpu.go b/plugins/inputs/cpu/cpu.go index b71a4012318d9..a29559bf35d48 100644 --- a/plugins/inputs/cpu/cpu.go +++ b/plugins/inputs/cpu/cpu.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/cpu/cpu_test.go b/plugins/inputs/cpu/cpu_test.go index 3dc3242a6ed94..235c08f255901 100644 --- a/plugins/inputs/cpu/cpu_test.go +++ b/plugins/inputs/cpu/cpu_test.go @@ -103,14 +103,15 @@ func TestCPUStats(t *testing.T) { // if the measurement is of the wrong type, or if no matching measurements are found // // Parameters: -// t *testing.T : Testing object to use -// acc testutil.Accumulator: Accumulator to examine -// field string : Name of field to examine -// expectedValue float64 : Value to search for within the measurement -// delta float64 : Maximum acceptable distance of an accumulated value -// from the expectedValue parameter. Useful when -// floating-point arithmetic imprecision makes looking -// for an exact match impractical +// +// t *testing.T : Testing object to use +// acc testutil.Accumulator: Accumulator to examine +// field string : Name of field to examine +// expectedValue float64 : Value to search for within the measurement +// delta float64 : Maximum acceptable distance of an accumulated value +// from the expectedValue parameter. Useful when +// floating-point arithmetic imprecision makes looking +// for an exact match impractical func assertContainsTaggedFloat( t *testing.T, acc *testutil.Accumulator, diff --git a/plugins/inputs/csgo/csgo.go b/plugins/inputs/csgo/csgo.go index 1c05f467859e0..51c1eb6fe2329 100644 --- a/plugins/inputs/csgo/csgo.go +++ b/plugins/inputs/csgo/csgo.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dcos/dcos.go b/plugins/inputs/dcos/dcos.go index 34014d0c5a5b8..d0f9029a383ef 100644 --- a/plugins/inputs/dcos/dcos.go +++ b/plugins/inputs/dcos/dcos.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/disk/disk.go b/plugins/inputs/disk/disk.go index 11c13189b9a84..3ed5037bf459b 100644 --- a/plugins/inputs/disk/disk.go +++ b/plugins/inputs/disk/disk.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/diskio/diskio.go b/plugins/inputs/diskio/diskio.go index a129b7a09dc28..936b482e85b17 100644 --- a/plugins/inputs/diskio/diskio.go +++ b/plugins/inputs/diskio/diskio.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/disque/disque.go b/plugins/inputs/disque/disque.go index 3414ed6ee67af..465d55ac98c18 100644 --- a/plugins/inputs/disque/disque.go +++ b/plugins/inputs/disque/disque.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dmcache/dmcache.go b/plugins/inputs/dmcache/dmcache.go index 1cfab4d263ade..125cdba956b1c 100644 --- a/plugins/inputs/dmcache/dmcache.go +++ b/plugins/inputs/dmcache/dmcache.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dns_query/dns_query.go b/plugins/inputs/dns_query/dns_query.go index 60e0712c488a7..43f37d4c9cdef 100644 --- a/plugins/inputs/dns_query/dns_query.go +++ b/plugins/inputs/dns_query/dns_query.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/docker/docker.go b/plugins/inputs/docker/docker.go index 4ecc448e2b9a0..7904f0204f4a6 100644 --- a/plugins/inputs/docker/docker.go +++ b/plugins/inputs/docker/docker.go @@ -28,6 +28,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/docker_log/docker_log.go b/plugins/inputs/docker_log/docker_log.go index 14441029d17e4..57f4c7e6df884 100644 --- a/plugins/inputs/docker_log/docker_log.go +++ b/plugins/inputs/docker_log/docker_log.go @@ -27,6 +27,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dovecot/dovecot.go b/plugins/inputs/dovecot/dovecot.go index 3494ed8434f9a..2cfb83c4320bd 100644 --- a/plugins/inputs/dovecot/dovecot.go +++ b/plugins/inputs/dovecot/dovecot.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/dpdk/dpdk.go b/plugins/inputs/dpdk/dpdk.go index f6e7b4ecd7b9c..afba20dce7d71 100644 --- a/plugins/inputs/dpdk/dpdk.go +++ b/plugins/inputs/dpdk/dpdk.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ecs/ecs.go b/plugins/inputs/ecs/ecs.go index 7c93f18f4bd17..647a5159e447a 100644 --- a/plugins/inputs/ecs/ecs.go +++ b/plugins/inputs/ecs/ecs.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/elasticsearch/elasticsearch.go b/plugins/inputs/elasticsearch/elasticsearch.go index 00aae60f2db72..21635e5895fc6 100644 --- a/plugins/inputs/elasticsearch/elasticsearch.go +++ b/plugins/inputs/elasticsearch/elasticsearch.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/elasticsearch_query/elasticsearch_query.go b/plugins/inputs/elasticsearch_query/elasticsearch_query.go index b6bbcf36c3fca..69474ca22c827 100644 --- a/plugins/inputs/elasticsearch_query/elasticsearch_query.go +++ b/plugins/inputs/elasticsearch_query/elasticsearch_query.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ethtool/ethtool.go b/plugins/inputs/ethtool/ethtool.go index a6db2d6f3e18b..40e6f8d76013c 100644 --- a/plugins/inputs/ethtool/ethtool.go +++ b/plugins/inputs/ethtool/ethtool.go @@ -8,6 +8,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/eventhub_consumer/eventhub_consumer.go b/plugins/inputs/eventhub_consumer/eventhub_consumer.go index a96a8c06bbf53..b54589d5a1220 100644 --- a/plugins/inputs/eventhub_consumer/eventhub_consumer.go +++ b/plugins/inputs/eventhub_consumer/eventhub_consumer.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/example/example.go b/plugins/inputs/example/example.go index 83e0a51d70242..647ee902a73db 100644 --- a/plugins/inputs/example/example.go +++ b/plugins/inputs/example/example.go @@ -13,6 +13,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/exec/exec.go b/plugins/inputs/exec/exec.go index 96a8fe0722dc9..061436c855594 100644 --- a/plugins/inputs/exec/exec.go +++ b/plugins/inputs/exec/exec.go @@ -25,6 +25,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/execd/execd.go b/plugins/inputs/execd/execd.go index 582837219d202..79b42b39d1f1a 100644 --- a/plugins/inputs/execd/execd.go +++ b/plugins/inputs/execd/execd.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/fail2ban/fail2ban.go b/plugins/inputs/fail2ban/fail2ban.go index 819c15797ecce..495139b6a06ec 100644 --- a/plugins/inputs/fail2ban/fail2ban.go +++ b/plugins/inputs/fail2ban/fail2ban.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/fibaro/fibaro.go b/plugins/inputs/fibaro/fibaro.go index a5b523f52e55d..8eb6ba1ad828c 100644 --- a/plugins/inputs/fibaro/fibaro.go +++ b/plugins/inputs/fibaro/fibaro.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/file/file.go b/plugins/inputs/file/file.go index c75fc94723cd3..37d8a86727e5a 100644 --- a/plugins/inputs/file/file.go +++ b/plugins/inputs/file/file.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/filecount/filecount.go b/plugins/inputs/filecount/filecount.go index 8e317198867c0..f8eed2ff37944 100644 --- a/plugins/inputs/filecount/filecount.go +++ b/plugins/inputs/filecount/filecount.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/filestat/filestat.go b/plugins/inputs/filestat/filestat.go index 1983dbd4f6ee5..1bd472c859f1e 100644 --- a/plugins/inputs/filestat/filestat.go +++ b/plugins/inputs/filestat/filestat.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/fireboard/fireboard.go b/plugins/inputs/fireboard/fireboard.go index 11ca858848165..fe7e760bd4cd1 100644 --- a/plugins/inputs/fireboard/fireboard.go +++ b/plugins/inputs/fireboard/fireboard.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/fluentd/fluentd.go b/plugins/inputs/fluentd/fluentd.go index 1a5d667b198e9..5165e44fc587d 100644 --- a/plugins/inputs/fluentd/fluentd.go +++ b/plugins/inputs/fluentd/fluentd.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -53,11 +54,13 @@ type pluginData struct { // parse JSON from fluentd Endpoint // Parameters: -// data: unprocessed json received from endpoint +// +// data: unprocessed json received from endpoint // // Returns: -// pluginData: slice that contains parsed plugins -// error: error that may have occurred +// +// pluginData: slice that contains parsed plugins +// error: error that may have occurred func parse(data []byte) (datapointArray []pluginData, err error) { var endpointData endpointInfo diff --git a/plugins/inputs/github/github.go b/plugins/inputs/github/github.go index 428740ed64b51..90a3a6d46a0c4 100644 --- a/plugins/inputs/github/github.go +++ b/plugins/inputs/github/github.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/gnmi/gnmi.go b/plugins/inputs/gnmi/gnmi.go index 2726781340057..c26e0252694ce 100644 --- a/plugins/inputs/gnmi/gnmi.go +++ b/plugins/inputs/gnmi/gnmi.go @@ -32,6 +32,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -481,7 +482,7 @@ func handlePath(gnmiPath *gnmiLib.Path, tags map[string]string, aliases map[stri return builder.String(), aliasPath, nil } -//ParsePath from XPath-like string to gNMI path structure +// ParsePath from XPath-like string to gNMI path structure func parsePath(origin string, pathToParse string, target string) (*gnmiLib.Path, error) { gnmiPath, err := xpath.ToGNMIPath(pathToParse) if err != nil { diff --git a/plugins/inputs/graylog/graylog.go b/plugins/inputs/graylog/graylog.go index dfe29bd38e7d8..7832e2960e014 100644 --- a/plugins/inputs/graylog/graylog.go +++ b/plugins/inputs/graylog/graylog.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -121,12 +122,14 @@ func (h *GrayLog) Gather(acc telegraf.Accumulator) error { // Gathers data from a particular server // Parameters: -// acc : The telegraf Accumulator to use -// serverURL: endpoint to send request to -// service : the service being queried +// +// acc : The telegraf Accumulator to use +// serverURL: endpoint to send request to +// service : the service being queried // // Returns: -// error: Any error that may have occurred +// +// error: Any error that may have occurred func (h *GrayLog) gatherServer( acc telegraf.Accumulator, serverURL string, @@ -161,11 +164,14 @@ func (h *GrayLog) gatherServer( // Flatten JSON hierarchy to produce field name and field value // Parameters: -// item: Item map to flatten -// fields: Map to store generated fields. -// id: Prefix for top level metric (empty string "") +// +// item: Item map to flatten +// fields: Map to store generated fields. +// id: Prefix for top level metric (empty string "") +// // Returns: -// void +// +// void func (h *GrayLog) flatten(item map[string]interface{}, fields map[string]interface{}, id string) { if id != "" { id = id + "_" @@ -185,11 +191,13 @@ func (h *GrayLog) flatten(item map[string]interface{}, fields map[string]interfa // Sends an HTTP request to the server using the GrayLog object's HTTPClient. // Parameters: -// serverURL: endpoint to send request to +// +// serverURL: endpoint to send request to // // Returns: -// string: body of the response -// error : Any error that may have occurred +// +// string: body of the response +// error : Any error that may have occurred func (h *GrayLog) sendRequest(serverURL string) (string, float64, error) { headers := map[string]string{ "Content-Type": "application/json", diff --git a/plugins/inputs/graylog/graylog_test.go b/plugins/inputs/graylog/graylog_test.go index 108d3bc28dad6..04337ed9c9de0 100644 --- a/plugins/inputs/graylog/graylog_test.go +++ b/plugins/inputs/graylog/graylog_test.go @@ -128,11 +128,13 @@ func (c *mockHTTPClient) HTTPClient() *http.Client { // Generates a pointer to an HttpJson object that uses a mock HTTP client. // Parameters: -// response : Body of the response that the mock HTTP client should return -// statusCode: HTTP status code the mock HTTP client should return +// +// response : Body of the response that the mock HTTP client should return +// statusCode: HTTP status code the mock HTTP client should return // // Returns: -// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client +// +// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client func genMockGrayLog(response string, statusCode int) []*GrayLog { return []*GrayLog{ { diff --git a/plugins/inputs/haproxy/haproxy.go b/plugins/inputs/haproxy/haproxy.go index bcf21349dba6a..3daa854bd5dfa 100644 --- a/plugins/inputs/haproxy/haproxy.go +++ b/plugins/inputs/haproxy/haproxy.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/haproxy/haproxy_test.go b/plugins/inputs/haproxy/haproxy_test.go index 21a1b09c10d02..804b28a04f9d7 100644 --- a/plugins/inputs/haproxy/haproxy_test.go +++ b/plugins/inputs/haproxy/haproxy_test.go @@ -170,8 +170,8 @@ func TestHaproxyGeneratesMetricsUsingSocket(t *testing.T) { require.NotEmpty(t, acc.Errors) } -//When not passing server config, we default to localhost -//We just want to make sure we did request stat from localhost +// When not passing server config, we default to localhost +// We just want to make sure we did request stat from localhost func TestHaproxyDefaultGetFromLocalhost(t *testing.T) { r := &haproxy{} diff --git a/plugins/inputs/hddtemp/hddtemp.go b/plugins/inputs/hddtemp/hddtemp.go index c7f8b59470b0a..f7e137445c787 100644 --- a/plugins/inputs/hddtemp/hddtemp.go +++ b/plugins/inputs/hddtemp/hddtemp.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/http/http.go b/plugins/inputs/http/http.go index c290ecf7028eb..dcb9fadf7ce8d 100644 --- a/plugins/inputs/http/http.go +++ b/plugins/inputs/http/http.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -94,11 +95,13 @@ func (h *HTTP) SetParserFunc(fn telegraf.ParserFunc) { // Gathers data from a particular URL // Parameters: -// acc : The telegraf Accumulator to use -// url : endpoint to send request to +// +// acc : The telegraf Accumulator to use +// url : endpoint to send request to // // Returns: -// error: Any error that may have occurred +// +// error: Any error that may have occurred func (h *HTTP) gatherURL( acc telegraf.Accumulator, url string, diff --git a/plugins/inputs/http_listener_v2/http_listener_v2.go b/plugins/inputs/http_listener_v2/http_listener_v2.go index ed5dda2525347..9ef6a26906ffb 100644 --- a/plugins/inputs/http_listener_v2/http_listener_v2.go +++ b/plugins/inputs/http_listener_v2/http_listener_v2.go @@ -26,6 +26,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/http_response/http_response.go b/plugins/inputs/http_response/http_response.go index cec3468523b90..6c351f774f560 100644 --- a/plugins/inputs/http_response/http_response.go +++ b/plugins/inputs/http_response/http_response.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/httpjson/httpjson.go b/plugins/inputs/httpjson/httpjson.go index f6d8f241364f7..6500cc3ab4736 100644 --- a/plugins/inputs/httpjson/httpjson.go +++ b/plugins/inputs/httpjson/httpjson.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -111,12 +112,14 @@ func (h *HTTPJSON) Gather(acc telegraf.Accumulator) error { // Gathers data from a particular server // Parameters: -// acc : The telegraf Accumulator to use -// serverURL: endpoint to send request to -// service : the service being queried +// +// acc : The telegraf Accumulator to use +// serverURL: endpoint to send request to +// service : the service being queried // // Returns: -// error: Any error that may have occurred +// +// error: Any error that may have occurred func (h *HTTPJSON) gatherServer( acc telegraf.Accumulator, serverURL string, @@ -164,11 +167,13 @@ func (h *HTTPJSON) gatherServer( // Sends an HTTP request to the server using the HTTPJSON object's HTTPClient. // This request can be either a GET or a POST. // Parameters: -// serverURL: endpoint to send request to +// +// serverURL: endpoint to send request to // // Returns: -// string: body of the response -// error : Any error that may have occurred +// +// string: body of the response +// error : Any error that may have occurred func (h *HTTPJSON) sendRequest(serverURL string) (string, float64, error) { // Prepare URL requestURL, err := url.Parse(serverURL) diff --git a/plugins/inputs/httpjson/httpjson_test.go b/plugins/inputs/httpjson/httpjson_test.go index c522ebe9978d2..8769fad9c5f86 100644 --- a/plugins/inputs/httpjson/httpjson_test.go +++ b/plugins/inputs/httpjson/httpjson_test.go @@ -156,11 +156,13 @@ func (c *mockHTTPClient) HTTPClient() *http.Client { // Generates a pointer to an HTTPJSON object that uses a mock HTTP client. // Parameters: -// response : Body of the response that the mock HTTP client should return -// statusCode: HTTP status code the mock HTTP client should return +// +// response : Body of the response that the mock HTTP client should return +// statusCode: HTTP status code the mock HTTP client should return // // Returns: -// *HTTPJSON: Pointer to an HTTPJSON object that uses the generated mock HTTP client +// +// *HTTPJSON: Pointer to an HTTPJSON object that uses the generated mock HTTP client func genMockHTTPJSON(response string, statusCode int) []*HTTPJSON { return []*HTTPJSON{ { diff --git a/plugins/inputs/hugepages/hugepages.go b/plugins/inputs/hugepages/hugepages.go index 8929c422e8733..96eaba4b9451a 100644 --- a/plugins/inputs/hugepages/hugepages.go +++ b/plugins/inputs/hugepages/hugepages.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/icinga2/icinga2.go b/plugins/inputs/icinga2/icinga2.go index 408aed560256f..e31c1585f5dd9 100644 --- a/plugins/inputs/icinga2/icinga2.go +++ b/plugins/inputs/icinga2/icinga2.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/infiniband/infiniband.go b/plugins/inputs/infiniband/infiniband.go index a33a05db17f1a..da50036c64a0c 100644 --- a/plugins/inputs/infiniband/infiniband.go +++ b/plugins/inputs/infiniband/infiniband.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/influxdb_listener/influxdb_listener.go b/plugins/inputs/influxdb_listener/influxdb_listener.go index f2cfdf6fe2667..dc73b3c1fd00b 100644 --- a/plugins/inputs/influxdb_listener/influxdb_listener.go +++ b/plugins/inputs/influxdb_listener/influxdb_listener.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go b/plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go index fc8abf0df2f83..8feec8d3c5c7d 100644 --- a/plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go +++ b/plugins/inputs/influxdb_v2_listener/influxdb_v2_listener.go @@ -25,6 +25,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/intel_pmu/intel_pmu.go b/plugins/inputs/intel_pmu/intel_pmu.go index 6728a7c9439ee..e8a60cf675c01 100644 --- a/plugins/inputs/intel_pmu/intel_pmu.go +++ b/plugins/inputs/intel_pmu/intel_pmu.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/intel_powerstat/intel_powerstat.go b/plugins/inputs/intel_powerstat/intel_powerstat.go index 3868356697e7e..2abc705889768 100644 --- a/plugins/inputs/intel_powerstat/intel_powerstat.go +++ b/plugins/inputs/intel_powerstat/intel_powerstat.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/intel_rdt/intel_rdt.go b/plugins/inputs/intel_rdt/intel_rdt.go index aeb39b8ef4d62..3dcdfe15c3b8e 100644 --- a/plugins/inputs/intel_rdt/intel_rdt.go +++ b/plugins/inputs/intel_rdt/intel_rdt.go @@ -27,6 +27,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/internet_speed/internet_speed.go b/plugins/inputs/internet_speed/internet_speed.go index 600d72d4a31c1..d880fb8c5e513 100644 --- a/plugins/inputs/internet_speed/internet_speed.go +++ b/plugins/inputs/internet_speed/internet_speed.go @@ -13,6 +13,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/interrupts/interrupts.go b/plugins/inputs/interrupts/interrupts.go index a51e570617cae..424b5797a2ca8 100644 --- a/plugins/inputs/interrupts/interrupts.go +++ b/plugins/inputs/interrupts/interrupts.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ipmi_sensor/ipmi_sensor.go b/plugins/inputs/ipmi_sensor/ipmi_sensor.go index ade0a7f19af14..78756cddcebfd 100644 --- a/plugins/inputs/ipmi_sensor/ipmi_sensor.go +++ b/plugins/inputs/ipmi_sensor/ipmi_sensor.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ipset/ipset.go b/plugins/inputs/ipset/ipset.go index bbcbf1f4e92b3..91b19031a8761 100644 --- a/plugins/inputs/ipset/ipset.go +++ b/plugins/inputs/ipset/ipset.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/iptables/iptables.go b/plugins/inputs/iptables/iptables.go index eb29c510709cb..bc29fbbcdd7d3 100644 --- a/plugins/inputs/iptables/iptables.go +++ b/plugins/inputs/iptables/iptables.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ipvs/ipvs.go b/plugins/inputs/ipvs/ipvs.go index 9d737dc46284c..2754d7f152844 100644 --- a/plugins/inputs/ipvs/ipvs.go +++ b/plugins/inputs/ipvs/ipvs.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/jenkins/jenkins.go b/plugins/inputs/jenkins/jenkins.go index b303595850b5a..476b3da61d8cc 100644 --- a/plugins/inputs/jenkins/jenkins.go +++ b/plugins/inputs/jenkins/jenkins.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/jolokia/jolokia.go b/plugins/inputs/jolokia/jolokia.go index 625bfb55c7822..faed593235a14 100644 --- a/plugins/inputs/jolokia/jolokia.go +++ b/plugins/inputs/jolokia/jolokia.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/jolokia/jolokia_test.go b/plugins/inputs/jolokia/jolokia_test.go index 084a84577fdc9..48a76963f2885 100644 --- a/plugins/inputs/jolokia/jolokia_test.go +++ b/plugins/inputs/jolokia/jolokia_test.go @@ -122,11 +122,13 @@ func (c jolokiaClientStub) MakeRequest(_ *http.Request) (*http.Response, error) // Generates a pointer to an HttpJson object that uses a mock HTTP client. // Parameters: -// response : Body of the response that the mock HTTP client should return -// statusCode: HTTP status code the mock HTTP client should return +// +// response : Body of the response that the mock HTTP client should return +// statusCode: HTTP status code the mock HTTP client should return // // Returns: -// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client +// +// *HttpJson: Pointer to an HttpJson object that uses the generated mock HTTP client func genJolokiaClientStub(response string, statusCode int, servers []Server, metrics []Metric) *Jolokia { return &Jolokia{ jClient: jolokiaClientStub{responseBody: response, statusCode: statusCode}, diff --git a/plugins/inputs/jolokia2/common/client.go b/plugins/inputs/jolokia2/common/client.go index 6f98720754b26..7228c5dfb3ea5 100644 --- a/plugins/inputs/jolokia2/common/client.go +++ b/plugins/inputs/jolokia2/common/client.go @@ -55,14 +55,14 @@ type ReadResponse struct { RequestTarget string } -// Jolokia JSON request object. Example: { -// "type": "read", -// "mbean: "java.lang:type="Runtime", -// "attribute": "Uptime", -// "target": { -// "url: "service:jmx:rmi:///jndi/rmi://target:9010/jmxrmi" -// } -// } +// Jolokia JSON request object. Example: { +// "type": "read", +// "mbean: "java.lang:type="Runtime", +// "attribute": "Uptime", +// "target": { +// "url: "service:jmx:rmi:///jndi/rmi://target:9010/jmxrmi" +// } +// } type jolokiaRequest struct { Type string `json:"type"` Mbean string `json:"mbean"` @@ -77,19 +77,19 @@ type jolokiaTarget struct { Password string `json:"password,omitempty"` } -// Jolokia JSON response object. Example: { -// "request": { -// "type": "read" -// "mbean": "java.lang:type=Runtime", -// "attribute": "Uptime", -// "target": { -// "url": "service:jmx:rmi:///jndi/rmi://target:9010/jmxrmi" -// } -// }, -// "value": 1214083, -// "timestamp": 1488059309, -// "status": 200 -// } +// Jolokia JSON response object. Example: { +// "request": { +// "type": "read" +// "mbean": "java.lang:type=Runtime", +// "attribute": "Uptime", +// "target": { +// "url": "service:jmx:rmi:///jndi/rmi://target:9010/jmxrmi" +// } +// }, +// "value": 1214083, +// "timestamp": 1488059309, +// "status": 200 +// } type jolokiaResponse struct { Request jolokiaRequest `json:"request"` Value interface{} `json:"value"` diff --git a/plugins/inputs/jti_openconfig_telemetry/auth/authentication_service.pb.go b/plugins/inputs/jti_openconfig_telemetry/auth/authentication_service.pb.go index 1342758887932..54d990103f6fa 100644 --- a/plugins/inputs/jti_openconfig_telemetry/auth/authentication_service.pb.go +++ b/plugins/inputs/jti_openconfig_telemetry/auth/authentication_service.pb.go @@ -84,7 +84,6 @@ func (x *LoginRequest) GetClientId() string { return "" } -// // The response message containing the result of login attempt. // result value of true indicates success and false indicates // failure diff --git a/plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go b/plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go index e907e04a90001..86f8bf8d87dd5 100644 --- a/plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go +++ b/plugins/inputs/jti_openconfig_telemetry/jti_openconfig_telemetry.go @@ -26,6 +26,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/jti_openconfig_telemetry/oc/oc.pb.go b/plugins/inputs/jti_openconfig_telemetry/oc/oc.pb.go index 19d16dccc501a..9e07a21c51b98 100644 --- a/plugins/inputs/jti_openconfig_telemetry/oc/oc.pb.go +++ b/plugins/inputs/jti_openconfig_telemetry/oc/oc.pb.go @@ -640,8 +640,8 @@ func (x *SubscriptionResponse) GetSubscriptionId() uint32 { return 0 } -// 2. Telemetry data send back on the same connection as the -// subscription request. +// 2. Telemetry data send back on the same connection as the +// subscription request. type OpenConfigData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache diff --git a/plugins/inputs/kafka_consumer/kafka_consumer.go b/plugins/inputs/kafka_consumer/kafka_consumer.go index 3c716f0c3c90c..04f812bad9b17 100644 --- a/plugins/inputs/kafka_consumer/kafka_consumer.go +++ b/plugins/inputs/kafka_consumer/kafka_consumer.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy.go b/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy.go index 6a4abc8eb79bc..920a01b059886 100644 --- a/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy.go +++ b/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy_integration_test.go b/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy_integration_test.go index 1a74b2e8b2feb..3dbb4be641d08 100644 --- a/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy_integration_test.go +++ b/plugins/inputs/kafka_consumer_legacy/kafka_consumer_legacy_integration_test.go @@ -78,8 +78,9 @@ func TestReadsMetricsFromKafkaIntegration(t *testing.T) { } } -//nolint:unused // Used in skipped tests // Waits for the metric that was sent to the kafka broker to arrive at the kafka consumer +// +//nolint:unused // Used in skipped tests func waitForPoint(acc *testutil.Accumulator, t *testing.T) { // Give the kafka container up to 2 seconds to get the point to the consumer ticker := time.NewTicker(5 * time.Millisecond) diff --git a/plugins/inputs/kapacitor/kapacitor.go b/plugins/inputs/kapacitor/kapacitor.go index f18870ccd7c2b..c27d713e33076 100644 --- a/plugins/inputs/kapacitor/kapacitor.go +++ b/plugins/inputs/kapacitor/kapacitor.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -126,11 +127,13 @@ type stats struct { // Gathers data from a particular URL // Parameters: -// acc : The telegraf Accumulator to use -// url : endpoint to send request to +// +// acc : The telegraf Accumulator to use +// url : endpoint to send request to // // Returns: -// error: Any error that may have occurred +// +// error: Any error that may have occurred func (k *Kapacitor) gatherURL( acc telegraf.Accumulator, url string, diff --git a/plugins/inputs/kernel/kernel.go b/plugins/inputs/kernel/kernel.go index 2b60d63385e87..e2c843acc8caa 100644 --- a/plugins/inputs/kernel/kernel.go +++ b/plugins/inputs/kernel/kernel.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kernel_vmstat/kernel_vmstat.go b/plugins/inputs/kernel_vmstat/kernel_vmstat.go index 0c3f44695f8c5..3c8d1701fc7bf 100644 --- a/plugins/inputs/kernel_vmstat/kernel_vmstat.go +++ b/plugins/inputs/kernel_vmstat/kernel_vmstat.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kibana/kibana.go b/plugins/inputs/kibana/kibana.go index c859d0df41405..ec59dac2cc488 100644 --- a/plugins/inputs/kibana/kibana.go +++ b/plugins/inputs/kibana/kibana.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/knx_listener/knx_listener.go b/plugins/inputs/knx_listener/knx_listener.go index e03a072b3abae..7139aa4fff84b 100644 --- a/plugins/inputs/knx_listener/knx_listener.go +++ b/plugins/inputs/knx_listener/knx_listener.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kube_inventory/kube_inventory.go b/plugins/inputs/kube_inventory/kube_inventory.go index 963c7deee723e..cd7f724421286 100644 --- a/plugins/inputs/kube_inventory/kube_inventory.go +++ b/plugins/inputs/kube_inventory/kube_inventory.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/kubernetes/kubernetes.go b/plugins/inputs/kubernetes/kubernetes.go index 4d28cc1da2b1e..7823d0b60c39b 100644 --- a/plugins/inputs/kubernetes/kubernetes.go +++ b/plugins/inputs/kubernetes/kubernetes.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -74,7 +75,7 @@ func (k *Kubernetes) Init() error { return nil } -//Gather collects kubernetes metrics from a given URL +// Gather collects kubernetes metrics from a given URL func (k *Kubernetes) Gather(acc telegraf.Accumulator) error { acc.AddError(k.gatherSummary(k.URL, acc)) return nil diff --git a/plugins/inputs/lanz/lanz.go b/plugins/inputs/lanz/lanz.go index af0d530454070..4d6ee21f78658 100644 --- a/plugins/inputs/lanz/lanz.go +++ b/plugins/inputs/lanz/lanz.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/leofs/leofs.go b/plugins/inputs/leofs/leofs.go index fea0f99af16d1..2d3aae0cc1805 100644 --- a/plugins/inputs/leofs/leofs.go +++ b/plugins/inputs/leofs/leofs.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/leofs/leofs_test.go b/plugins/inputs/leofs/leofs_test.go index b0825b7e46ca0..9098e39b7bdf8 100644 --- a/plugins/inputs/leofs/leofs_test.go +++ b/plugins/inputs/leofs/leofs_test.go @@ -137,9 +137,12 @@ func testMain(t *testing.T, code string, endpoint string, serverType ServerType) require.NoError(t, exec.Command("go", "build", "-o", executable, src).Run()) defer os.Remove("./" + executable) + currentWorkingDirectory, err := os.Getwd() + require.NoError(t, err) + envPathOrigin := os.Getenv("PATH") // Refer to the fake snmpwalk - require.NoError(t, os.Setenv("PATH", ".")) + require.NoError(t, os.Setenv("PATH", currentWorkingDirectory)) defer os.Setenv("PATH", envPathOrigin) l := &LeoFS{ @@ -149,7 +152,7 @@ func testMain(t *testing.T, code string, endpoint string, serverType ServerType) var acc testutil.Accumulator acc.SetDebug(true) - err := acc.GatherError(l.Gather) + err = acc.GatherError(l.Gather) require.NoError(t, err) floatMetrics := KeyMapping[serverType] diff --git a/plugins/inputs/linux_sysctl_fs/linux_sysctl_fs.go b/plugins/inputs/linux_sysctl_fs/linux_sysctl_fs.go index 6050dae8b36d4..34b636f517026 100644 --- a/plugins/inputs/linux_sysctl_fs/linux_sysctl_fs.go +++ b/plugins/inputs/linux_sysctl_fs/linux_sysctl_fs.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/logparser/logparser.go b/plugins/inputs/logparser/logparser.go index d297393a9e3d0..42b9e8f42176d 100644 --- a/plugins/inputs/logparser/logparser.go +++ b/plugins/inputs/logparser/logparser.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/logstash/logstash.go b/plugins/inputs/logstash/logstash.go index 8d58c62b4b664..b2159bbd67296 100644 --- a/plugins/inputs/logstash/logstash.go +++ b/plugins/inputs/logstash/logstash.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/lustre2/lustre2.go b/plugins/inputs/lustre2/lustre2.go index 7f7645c130c9b..58f456c767a3b 100644 --- a/plugins/inputs/lustre2/lustre2.go +++ b/plugins/inputs/lustre2/lustre2.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -38,9 +39,12 @@ type Lustre2 struct { allFields map[tags]map[string]interface{} } -/* The wanted fields would be a []string if not for the +/* + The wanted fields would be a []string if not for the + lines that start with read_bytes/write_bytes and contain - both the byte count and the function call count + + both the byte count and the function call count */ type mapping struct { inProc string // What to look for at the start of a line in /proc/fs/lustre/* diff --git a/plugins/inputs/lvm/lvm.go b/plugins/inputs/lvm/lvm.go index e77dab460962f..0026a4dd36158 100644 --- a/plugins/inputs/lvm/lvm.go +++ b/plugins/inputs/lvm/lvm.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mailchimp/mailchimp.go b/plugins/inputs/mailchimp/mailchimp.go index 65b286b7e59af..83b6e8bbc8c3e 100644 --- a/plugins/inputs/mailchimp/mailchimp.go +++ b/plugins/inputs/mailchimp/mailchimp.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/marklogic/marklogic.go b/plugins/inputs/marklogic/marklogic.go index cbf09f1d1360b..e03423bf08d0e 100644 --- a/plugins/inputs/marklogic/marklogic.go +++ b/plugins/inputs/marklogic/marklogic.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mcrouter/mcrouter.go b/plugins/inputs/mcrouter/mcrouter.go index 956230ae7bd89..830772d13f908 100644 --- a/plugins/inputs/mcrouter/mcrouter.go +++ b/plugins/inputs/mcrouter/mcrouter.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mdstat/mdstat.go b/plugins/inputs/mdstat/mdstat.go index 0d1eb940988ad..0cdc59f94f829 100644 --- a/plugins/inputs/mdstat/mdstat.go +++ b/plugins/inputs/mdstat/mdstat.go @@ -33,6 +33,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mem/mem.go b/plugins/inputs/mem/mem.go index 961a02ed10022..b8b3c65efd789 100644 --- a/plugins/inputs/mem/mem.go +++ b/plugins/inputs/mem/mem.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/memcached/memcached.go b/plugins/inputs/memcached/memcached.go index b52d5e7b448ff..237abf2343469 100644 --- a/plugins/inputs/memcached/memcached.go +++ b/plugins/inputs/memcached/memcached.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mesos/mesos.go b/plugins/inputs/mesos/mesos.go index f0f0f102d16fb..ebfefd52d0369 100644 --- a/plugins/inputs/mesos/mesos.go +++ b/plugins/inputs/mesos/mesos.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/minecraft/minecraft.go b/plugins/inputs/minecraft/minecraft.go index 490bf188f06bd..1fb878421a606 100644 --- a/plugins/inputs/minecraft/minecraft.go +++ b/plugins/inputs/minecraft/minecraft.go @@ -9,6 +9,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mock/mock.go b/plugins/inputs/mock/mock.go index 3861a18c7dcb4..b194c15555189 100644 --- a/plugins/inputs/mock/mock.go +++ b/plugins/inputs/mock/mock.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/modbus/configuration_register.go b/plugins/inputs/modbus/configuration_register.go index 87275675a0f0c..fe753a62896ca 100644 --- a/plugins/inputs/modbus/configuration_register.go +++ b/plugins/inputs/modbus/configuration_register.go @@ -6,6 +6,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample_register.conf var sampleConfigPartPerRegister string diff --git a/plugins/inputs/modbus/configuration_request.go b/plugins/inputs/modbus/configuration_request.go index eed4e855627b2..c98624285c7ab 100644 --- a/plugins/inputs/modbus/configuration_request.go +++ b/plugins/inputs/modbus/configuration_request.go @@ -8,6 +8,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample_request.conf var sampleConfigPartPerRequest string diff --git a/plugins/inputs/modbus/modbus.go b/plugins/inputs/modbus/modbus.go index bf2537d4e35fb..cba03406cac98 100644 --- a/plugins/inputs/modbus/modbus.go +++ b/plugins/inputs/modbus/modbus.go @@ -18,10 +18,12 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample_general_begin.conf var sampleConfigStart string // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample_general_end.conf var sampleConfigEnd string diff --git a/plugins/inputs/mongodb/mongodb.go b/plugins/inputs/mongodb/mongodb.go index c131fe0acd185..7b3fa33f8bbd4 100644 --- a/plugins/inputs/mongodb/mongodb.go +++ b/plugins/inputs/mongodb/mongodb.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/monit/monit.go b/plugins/inputs/monit/monit.go index 3c78bf84e57b0..e6f3fa44538be 100644 --- a/plugins/inputs/monit/monit.go +++ b/plugins/inputs/monit/monit.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mqtt_consumer/mqtt_consumer.go b/plugins/inputs/mqtt_consumer/mqtt_consumer.go index adc6ff0299811..b8aa22172d5a0 100644 --- a/plugins/inputs/mqtt_consumer/mqtt_consumer.go +++ b/plugins/inputs/mqtt_consumer/mqtt_consumer.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/multifile/multifile.go b/plugins/inputs/multifile/multifile.go index 159e103c930ba..ed8454bfef23a 100644 --- a/plugins/inputs/multifile/multifile.go +++ b/plugins/inputs/multifile/multifile.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/mysql/mysql.go b/plugins/inputs/mysql/mysql.go index f5dc343ce783f..5b39691a9c7cd 100644 --- a/plugins/inputs/mysql/mysql.go +++ b/plugins/inputs/mysql/mysql.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nats/nats.go b/plugins/inputs/nats/nats.go index 1a92f2ea0bc39..b5966fafadf0e 100644 --- a/plugins/inputs/nats/nats.go +++ b/plugins/inputs/nats/nats.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nats_consumer/nats_consumer.go b/plugins/inputs/nats_consumer/nats_consumer.go index 8105ff9b2c546..3643252aa07e9 100644 --- a/plugins/inputs/nats_consumer/nats_consumer.go +++ b/plugins/inputs/nats_consumer/nats_consumer.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/neptune_apex/neptune_apex.go b/plugins/inputs/neptune_apex/neptune_apex.go index 1dde25741b657..3295bb6915fed 100644 --- a/plugins/inputs/neptune_apex/neptune_apex.go +++ b/plugins/inputs/neptune_apex/neptune_apex.go @@ -1,6 +1,7 @@ -//go:generate ../../../tools/readme_config_includer/generator // Package neptune_apex implements an input plugin for the Neptune Apex // aquarium controller. +// +//go:generate ../../../tools/readme_config_includer/generator package neptune_apex import ( @@ -21,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -89,7 +91,7 @@ func (n *NeptuneApex) gatherServer( } // parseXML is strict on the input and does not do best-effort parsing. -//This is because of the life-support nature of the Neptune Apex. +// This is because of the life-support nature of the Neptune Apex. func (n *NeptuneApex) parseXML(acc telegraf.Accumulator, data []byte) error { r := xmlReply{} err := xml.Unmarshal(data, &r) diff --git a/plugins/inputs/net/net.go b/plugins/inputs/net/net.go index d3e1cae22bd63..3464203312dc7 100644 --- a/plugins/inputs/net/net.go +++ b/plugins/inputs/net/net.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/net_response/net_response.go b/plugins/inputs/net_response/net_response.go index a3cb1467b67ae..7cd2609f35d78 100644 --- a/plugins/inputs/net_response/net_response.go +++ b/plugins/inputs/net_response/net_response.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/netstat/netstat.go b/plugins/inputs/netstat/netstat.go index 8727b1333efb0..932f84390adbd 100644 --- a/plugins/inputs/netstat/netstat.go +++ b/plugins/inputs/netstat/netstat.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nfsclient/nfsclient.go b/plugins/inputs/nfsclient/nfsclient.go index 07060a603d595..394840ddb6e35 100644 --- a/plugins/inputs/nfsclient/nfsclient.go +++ b/plugins/inputs/nfsclient/nfsclient.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx/nginx.go b/plugins/inputs/nginx/nginx.go index cfa378f0f727c..a55f1b1dc4b1d 100644 --- a/plugins/inputs/nginx/nginx.go +++ b/plugins/inputs/nginx/nginx.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_plus/nginx_plus.go b/plugins/inputs/nginx_plus/nginx_plus.go index dd073590d21d9..dac7eaa60c4b3 100644 --- a/plugins/inputs/nginx_plus/nginx_plus.go +++ b/plugins/inputs/nginx_plus/nginx_plus.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_plus_api/nginx_plus_api.go b/plugins/inputs/nginx_plus_api/nginx_plus_api.go index b50ef5cf380ad..f14278023a32e 100644 --- a/plugins/inputs/nginx_plus_api/nginx_plus_api.go +++ b/plugins/inputs/nginx_plus_api/nginx_plus_api.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_sts/nginx_sts.go b/plugins/inputs/nginx_sts/nginx_sts.go index 7a6ff25bf2379..de52cf7bf4722 100644 --- a/plugins/inputs/nginx_sts/nginx_sts.go +++ b/plugins/inputs/nginx_sts/nginx_sts.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_upstream_check/nginx_upstream_check.go b/plugins/inputs/nginx_upstream_check/nginx_upstream_check.go index 457487cd0b6b8..b7fbb3710a609 100644 --- a/plugins/inputs/nginx_upstream_check/nginx_upstream_check.go +++ b/plugins/inputs/nginx_upstream_check/nginx_upstream_check.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nginx_vts/nginx_vts.go b/plugins/inputs/nginx_vts/nginx_vts.go index 62fe23b2bef98..55fc19841f62b 100644 --- a/plugins/inputs/nginx_vts/nginx_vts.go +++ b/plugins/inputs/nginx_vts/nginx_vts.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nomad/nomad.go b/plugins/inputs/nomad/nomad.go index 8e8b446c0584b..fc1f43783038a 100644 --- a/plugins/inputs/nomad/nomad.go +++ b/plugins/inputs/nomad/nomad.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nsd/nsd.go b/plugins/inputs/nsd/nsd.go index 3f8832ae3a83c..c5e36554c93cc 100644 --- a/plugins/inputs/nsd/nsd.go +++ b/plugins/inputs/nsd/nsd.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nsq/nsq.go b/plugins/inputs/nsq/nsq.go index f14cb4bd2cccc..c447bdb52c4c7 100644 --- a/plugins/inputs/nsq/nsq.go +++ b/plugins/inputs/nsq/nsq.go @@ -40,6 +40,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nsq_consumer/nsq_consumer.go b/plugins/inputs/nsq_consumer/nsq_consumer.go index 5967e7a219661..d0a7b00b171cd 100644 --- a/plugins/inputs/nsq_consumer/nsq_consumer.go +++ b/plugins/inputs/nsq_consumer/nsq_consumer.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -34,7 +35,7 @@ func (l *logger) Output(_ int, s string) error { return nil } -//NSQConsumer represents the configuration of the plugin +// NSQConsumer represents the configuration of the plugin type NSQConsumer struct { Server string `toml:"server" deprecated:"1.5.0;use 'nsqd' instead"` Nsqd []string `toml:"nsqd"` diff --git a/plugins/inputs/nstat/nstat.go b/plugins/inputs/nstat/nstat.go index 867fa2ae60ec7..432a994489639 100644 --- a/plugins/inputs/nstat/nstat.go +++ b/plugins/inputs/nstat/nstat.go @@ -12,6 +12,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/nvidia_smi/nvidia_smi.go b/plugins/inputs/nvidia_smi/nvidia_smi.go index d44d1ad82c39e..d0d5ebc2ef996 100644 --- a/plugins/inputs/nvidia_smi/nvidia_smi.go +++ b/plugins/inputs/nvidia_smi/nvidia_smi.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/openldap/openldap.go b/plugins/inputs/openldap/openldap.go index f08d3b8f539f0..8764ab9c9b39c 100644 --- a/plugins/inputs/openldap/openldap.go +++ b/plugins/inputs/openldap/openldap.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/openntpd/openntpd.go b/plugins/inputs/openntpd/openntpd.go index d954221340445..e56847c7419ec 100644 --- a/plugins/inputs/openntpd/openntpd.go +++ b/plugins/inputs/openntpd/openntpd.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/opensmtpd/opensmtpd.go b/plugins/inputs/opensmtpd/opensmtpd.go index c9e5ffe52431d..e4ca79ee968e4 100644 --- a/plugins/inputs/opensmtpd/opensmtpd.go +++ b/plugins/inputs/opensmtpd/opensmtpd.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -59,7 +60,6 @@ func opensmtpdRunner(cmdName string, timeout config.Duration, useSudo bool) (*by // Gather collects the configured stats from smtpctl and adds them to the // Accumulator -// func (*Opensmtpd) SampleConfig() string { return sampleConfig } diff --git a/plugins/inputs/openstack/openstack.go b/plugins/inputs/openstack/openstack.go index 9aee9e224da7e..c98f08d16f8a4 100644 --- a/plugins/inputs/openstack/openstack.go +++ b/plugins/inputs/openstack/openstack.go @@ -1,4 +1,3 @@ -//go:generate ../../../tools/readme_config_includer/generator // Package openstack implements an OpenStack input plugin for Telegraf // // The OpenStack input plug is a simple two phase metric collector. In the first @@ -7,6 +6,8 @@ // // No aggregation is performed by the input plugin, instead queries to InfluxDB should // be used to gather global totals of things such as tag frequency. +// +//go:generate ../../../tools/readme_config_includer/generator package openstack import ( @@ -45,6 +46,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/opentelemetry/opentelemetry.go b/plugins/inputs/opentelemetry/opentelemetry.go index 11c0d3092f420..a1b3899f6afc9 100644 --- a/plugins/inputs/opentelemetry/opentelemetry.go +++ b/plugins/inputs/opentelemetry/opentelemetry.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/openweathermap/openweathermap.go b/plugins/inputs/openweathermap/openweathermap.go index ed22bde6bc7a7..0b18e005391bc 100644 --- a/plugins/inputs/openweathermap/openweathermap.go +++ b/plugins/inputs/openweathermap/openweathermap.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/passenger/passenger.go b/plugins/inputs/passenger/passenger.go index 170a3325544f5..072c682c74dec 100644 --- a/plugins/inputs/passenger/passenger.go +++ b/plugins/inputs/passenger/passenger.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/pf/pf.go b/plugins/inputs/pf/pf.go index b510842b32124..0f77e7116aa24 100644 --- a/plugins/inputs/pf/pf.go +++ b/plugins/inputs/pf/pf.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/pgbouncer/pgbouncer.go b/plugins/inputs/pgbouncer/pgbouncer.go index 5f68eddce9d21..a6e8e172fa528 100644 --- a/plugins/inputs/pgbouncer/pgbouncer.go +++ b/plugins/inputs/pgbouncer/pgbouncer.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/phpfpm/phpfpm.go b/plugins/inputs/phpfpm/phpfpm.go index bba87a793fd03..c6338e6dd4dc4 100644 --- a/plugins/inputs/phpfpm/phpfpm.go +++ b/plugins/inputs/phpfpm/phpfpm.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/phpfpm/phpfpm_test.go b/plugins/inputs/phpfpm/phpfpm_test.go index 14d03dd3fafe7..680ba9d3078b7 100644 --- a/plugins/inputs/phpfpm/phpfpm_test.go +++ b/plugins/inputs/phpfpm/phpfpm_test.go @@ -272,8 +272,8 @@ func TestPhpFpmGeneratesMetrics_From_Socket_Custom_Status_Path(t *testing.T) { acc.AssertContainsTaggedFields(t, "phpfpm", fields, tags) } -//When not passing server config, we default to localhost -//We just want to make sure we did request stat from localhost +// 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{Urls: []string{"http://bad.localhost:62001/status"}} diff --git a/plugins/inputs/ping/ping.go b/plugins/inputs/ping/ping.go index 42a7cbbef27d8..1498e05fb37df 100644 --- a/plugins/inputs/ping/ping.go +++ b/plugins/inputs/ping/ping.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ping/ping_notwindows.go b/plugins/inputs/ping/ping_notwindows.go index c09c4a3fcd359..3d5644950eac8 100644 --- a/plugins/inputs/ping/ping_notwindows.go +++ b/plugins/inputs/ping/ping_notwindows.go @@ -156,13 +156,13 @@ func (p *Ping) args(url string, system string) []string { // processPingOutput takes in a string output from the ping command, like: // -// ping www.google.com (173.194.115.84): 56 data bytes -// 64 bytes from 173.194.115.84: icmp_seq=0 ttl=54 time=52.172 ms -// 64 bytes from 173.194.115.84: icmp_seq=1 ttl=54 time=34.843 ms +// ping www.google.com (173.194.115.84): 56 data bytes +// 64 bytes from 173.194.115.84: icmp_seq=0 ttl=54 time=52.172 ms +// 64 bytes from 173.194.115.84: icmp_seq=1 ttl=54 time=34.843 ms // -// --- www.google.com ping statistics --- -// 2 packets transmitted, 2 packets received, 0.0% packet loss -// round-trip min/avg/max/stddev = 34.843/43.508/52.172/8.664 ms +// --- www.google.com ping statistics --- +// 2 packets transmitted, 2 packets received, 0.0% packet loss +// round-trip min/avg/max/stddev = 34.843/43.508/52.172/8.664 ms // // It returns (, , ) func processPingOutput(out string) (stats, error) { diff --git a/plugins/inputs/postfix/postfix.go b/plugins/inputs/postfix/postfix.go index fd6c149b2f34f..6b569ebfeb3e7 100644 --- a/plugins/inputs/postfix/postfix.go +++ b/plugins/inputs/postfix/postfix.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/postgresql/postgresql.go b/plugins/inputs/postgresql/postgresql.go index e9a2fd815d617..8e397c84e9816 100644 --- a/plugins/inputs/postgresql/postgresql.go +++ b/plugins/inputs/postgresql/postgresql.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/postgresql_extensible/postgresql_extensible.go b/plugins/inputs/postgresql_extensible/postgresql_extensible.go index 3109f1d6aa218..a3925e7366b2f 100644 --- a/plugins/inputs/postgresql_extensible/postgresql_extensible.go +++ b/plugins/inputs/postgresql_extensible/postgresql_extensible.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/powerdns/powerdns.go b/plugins/inputs/powerdns/powerdns.go index 2a5abce09fdeb..e2c93e5e0ccfc 100644 --- a/plugins/inputs/powerdns/powerdns.go +++ b/plugins/inputs/powerdns/powerdns.go @@ -16,6 +16,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/powerdns_recursor/powerdns_recursor.go b/plugins/inputs/powerdns_recursor/powerdns_recursor.go index 61637bd46c89c..77a2688d0c355 100644 --- a/plugins/inputs/powerdns_recursor/powerdns_recursor.go +++ b/plugins/inputs/powerdns_recursor/powerdns_recursor.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/processes/processes.go b/plugins/inputs/processes/processes.go index 2f5551e11215a..061af1221c5c5 100644 --- a/plugins/inputs/processes/processes.go +++ b/plugins/inputs/processes/processes.go @@ -3,6 +3,7 @@ package processes import _ "embed" // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/processes/processes_test.go b/plugins/inputs/processes/processes_test.go index 7fc0a76dac036..fd4bfeb791db3 100644 --- a/plugins/inputs/processes/processes_test.go +++ b/plugins/inputs/processes/processes_test.go @@ -18,8 +18,8 @@ import ( func TestProcesses(t *testing.T) { tester := tester{} processes := &Processes{ - Log: testutil.Logger{}, - execPS: testExecPS("STAT\n Ss \n S \n Z \n R \n S< \n SNs \n Ss+ \n \n \n"), + Log: testutil.Logger{}, + execPS: testExecPS("STAT\n Ss \n S \n Z \n R \n S< \n SNs \n Ss+ \n \n \n"), readProcFile: tester.testProcFile, } var acc testutil.Accumulator diff --git a/plugins/inputs/procstat/native_finder.go b/plugins/inputs/procstat/native_finder.go index 041e2cae91888..7307197ae97e5 100644 --- a/plugins/inputs/procstat/native_finder.go +++ b/plugins/inputs/procstat/native_finder.go @@ -10,16 +10,16 @@ import ( "github.com/shirou/gopsutil/v3/process" ) -//NativeFinder uses gopsutil to find processes +// NativeFinder uses gopsutil to find processes type NativeFinder struct { } -//NewNativeFinder ... +// NewNativeFinder ... func NewNativeFinder() (PIDFinder, error) { return &NativeFinder{}, nil } -//Uid will return all pids for the given user +// Uid will return all pids for the given user func (pg *NativeFinder) UID(user string) ([]PID, error) { var dst []PID procs, err := process.Processes() @@ -40,7 +40,7 @@ func (pg *NativeFinder) UID(user string) ([]PID, error) { return dst, nil } -//PidFile returns the pid from the pid file given. +// PidFile returns the pid from the pid file given. func (pg *NativeFinder) PidFile(path string) ([]PID, error) { var pids []PID pidString, err := os.ReadFile(path) @@ -56,7 +56,7 @@ func (pg *NativeFinder) PidFile(path string) ([]PID, error) { return pids, nil } -//FullPattern matches on the command line when the process was executed +// FullPattern matches on the command line when the process was executed func (pg *NativeFinder) FullPattern(pattern string) ([]PID, error) { var pids []PID regxPattern, err := regexp.Compile(pattern) diff --git a/plugins/inputs/procstat/native_finder_notwindows.go b/plugins/inputs/procstat/native_finder_notwindows.go index 528b083ae628b..89af58799a578 100644 --- a/plugins/inputs/procstat/native_finder_notwindows.go +++ b/plugins/inputs/procstat/native_finder_notwindows.go @@ -7,7 +7,7 @@ import ( "regexp" ) -//Pattern matches on the process name +// Pattern matches on the process name func (pg *NativeFinder) Pattern(pattern string) ([]PID, error) { var pids []PID regxPattern, err := regexp.Compile(pattern) diff --git a/plugins/inputs/procstat/procstat.go b/plugins/inputs/procstat/procstat.go index 79047cfa80aab..04d9c669d1673 100644 --- a/plugins/inputs/procstat/procstat.go +++ b/plugins/inputs/procstat/procstat.go @@ -20,6 +20,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/prometheus/prometheus.go b/plugins/inputs/prometheus/prometheus.go index ed9a46e0db7b1..9185d97368f51 100644 --- a/plugins/inputs/prometheus/prometheus.go +++ b/plugins/inputs/prometheus/prometheus.go @@ -27,6 +27,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/proxmox/proxmox.go b/plugins/inputs/proxmox/proxmox.go index 369d9d1f83543..3383c6f2d4f23 100644 --- a/plugins/inputs/proxmox/proxmox.go +++ b/plugins/inputs/proxmox/proxmox.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/puppetagent/puppetagent.go b/plugins/inputs/puppetagent/puppetagent.go index 61a03298a7c13..a1fdb18aba2b8 100644 --- a/plugins/inputs/puppetagent/puppetagent.go +++ b/plugins/inputs/puppetagent/puppetagent.go @@ -15,6 +15,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/rabbitmq/rabbitmq.go b/plugins/inputs/rabbitmq/rabbitmq.go index 5fdf1b51cb5a2..1863abaab77a7 100644 --- a/plugins/inputs/rabbitmq/rabbitmq.go +++ b/plugins/inputs/rabbitmq/rabbitmq.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/raindrops/raindrops.go b/plugins/inputs/raindrops/raindrops.go index 6f6a95eb212fe..1a8d12beec51a 100644 --- a/plugins/inputs/raindrops/raindrops.go +++ b/plugins/inputs/raindrops/raindrops.go @@ -18,6 +18,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ras/ras.go b/plugins/inputs/ras/ras.go index b8812fbc533a1..2fbf2d4451749 100644 --- a/plugins/inputs/ras/ras.go +++ b/plugins/inputs/ras/ras.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/ravendb/ravendb.go b/plugins/inputs/ravendb/ravendb.go index e96c336d4b4f0..3006345bef6cf 100644 --- a/plugins/inputs/ravendb/ravendb.go +++ b/plugins/inputs/ravendb/ravendb.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/redfish/redfish.go b/plugins/inputs/redfish/redfish.go index 55dea5e17de34..bd35b8b90ae1a 100644 --- a/plugins/inputs/redfish/redfish.go +++ b/plugins/inputs/redfish/redfish.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/redis/redis.go b/plugins/inputs/redis/redis.go index 70f815f317d67..6aab3c8b6b7de 100644 --- a/plugins/inputs/redis/redis.go +++ b/plugins/inputs/redis/redis.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -476,7 +477,9 @@ func gatherInfoOutput( // Parse the special Keyspace line at end of redis stats // This is a special line that looks something like: -// db0:keys=2,expires=0,avg_ttl=0 +// +// db0:keys=2,expires=0,avg_ttl=0 +// // And there is one for each db on the redis instance func gatherKeyspaceLine( name string, @@ -505,7 +508,9 @@ func gatherKeyspaceLine( // Parse the special cmdstat lines. // Example: -// cmdstat_publish:calls=33791,usec=208789,usec_per_call=6.18 +// +// cmdstat_publish:calls=33791,usec=208789,usec_per_call=6.18 +// // Tag: cmdstat=publish; Fields: calls=33791i,usec=208789i,usec_per_call=6.18 func gatherCommandstateLine( name string, @@ -550,7 +555,9 @@ func gatherCommandstateLine( // Parse the special Replication line // Example: -// slave0:ip=127.0.0.1,port=7379,state=online,offset=4556468,lag=0 +// +// slave0:ip=127.0.0.1,port=7379,state=online,offset=4556468,lag=0 +// // This line will only be visible when a node has a replica attached. func gatherReplicationLine( name string, @@ -714,7 +721,7 @@ func (r *Redis) Start(telegraf.Accumulator) error { return nil } -//Stop close the client through ServiceInput interface Start/Stop methods impl. +// Stop close the client through ServiceInput interface Start/Stop methods impl. func (r *Redis) Stop() { for _, c := range r.clients { err := c.Close() diff --git a/plugins/inputs/redis_sentinel/redis_sentinel.go b/plugins/inputs/redis_sentinel/redis_sentinel.go index 25c624b697798..04ae1b1786c4b 100644 --- a/plugins/inputs/redis_sentinel/redis_sentinel.go +++ b/plugins/inputs/redis_sentinel/redis_sentinel.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/rethinkdb/rethinkdb.go b/plugins/inputs/rethinkdb/rethinkdb.go index 6c881f99ce2bb..a7a70948a0732 100644 --- a/plugins/inputs/rethinkdb/rethinkdb.go +++ b/plugins/inputs/rethinkdb/rethinkdb.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/riak/riak.go b/plugins/inputs/riak/riak.go index 8d9552057eb8b..f06fd4f900442 100644 --- a/plugins/inputs/riak/riak.go +++ b/plugins/inputs/riak/riak.go @@ -14,6 +14,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/riemann_listener/riemann_listener.go b/plugins/inputs/riemann_listener/riemann_listener.go index f99e0976fd904..35f0924e11f85 100644 --- a/plugins/inputs/riemann_listener/riemann_listener.go +++ b/plugins/inputs/riemann_listener/riemann_listener.go @@ -28,6 +28,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/salesforce/salesforce.go b/plugins/inputs/salesforce/salesforce.go index ec3d82c32f1c5..e78a140e78a05 100644 --- a/plugins/inputs/salesforce/salesforce.go +++ b/plugins/inputs/salesforce/salesforce.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sensors/sensors.go b/plugins/inputs/sensors/sensors.go index aeddecaa071b3..bfda986bdfda9 100644 --- a/plugins/inputs/sensors/sensors.go +++ b/plugins/inputs/sensors/sensors.go @@ -21,6 +21,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -69,7 +70,9 @@ func (s *Sensors) Gather(acc telegraf.Accumulator) error { } // parse forks the command: -// sensors -u -A +// +// sensors -u -A +// // and parses the output to add it to the telegraf.Accumulator. func (s *Sensors) parse(acc telegraf.Accumulator) error { tags := map[string]string{} diff --git a/plugins/inputs/sflow/sflow.go b/plugins/inputs/sflow/sflow.go index 52043a1390c17..adcb2c295e963 100644 --- a/plugins/inputs/sflow/sflow.go +++ b/plugins/inputs/sflow/sflow.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/slab/slab.go b/plugins/inputs/slab/slab.go index c895c3b84bc8d..cc2d840b2025f 100644 --- a/plugins/inputs/slab/slab.go +++ b/plugins/inputs/slab/slab.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/smart/smart.go b/plugins/inputs/smart/smart.go index b0c755a2059f8..4b275b291c41f 100644 --- a/plugins/inputs/smart/smart.go +++ b/plugins/inputs/smart/smart.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/snmp/gosmi.go b/plugins/inputs/snmp/gosmi.go index f2de844ce6fc0..4de0977e24800 100644 --- a/plugins/inputs/snmp/gosmi.go +++ b/plugins/inputs/snmp/gosmi.go @@ -82,6 +82,7 @@ var gosmiSnmpTableCachesLock sync.Mutex // snmpTable resolves the given OID as a table, providing information about the // table and fields within. +// //nolint:revive //Too many return variable but necessary func (g *gosmiTranslator) SnmpTable(oid string) ( mibName string, oidNum string, oidText string, diff --git a/plugins/inputs/snmp/gosmi_test.go b/plugins/inputs/snmp/gosmi_test.go index bca48ffa17094..c5f4b8a4b2204 100644 --- a/plugins/inputs/snmp/gosmi_test.go +++ b/plugins/inputs/snmp/gosmi_test.go @@ -31,8 +31,8 @@ func TestGosmiTranslator(t *testing.T) { require.NotNil(t, tr) } -//gosmi uses the same connection struct as netsnmp but has a few -//different test cases, so it has its own copy +// gosmi uses the same connection struct as netsnmp but has a few +// different test cases, so it has its own copy var gosmiTsc = &testSNMPConnection{ host: "tsc", values: map[string]interface{}{ @@ -222,11 +222,11 @@ func TestSnmpInit_noTranslateGosmi(t *testing.T) { assert.Equal(t, false, s.Tables[0].Fields[2].IsTag) } -//TestTableBuild_walk in snmp_test.go is split into two tests here, -//noTranslate and Translate. +// TestTableBuild_walk in snmp_test.go is split into two tests here, +// noTranslate and Translate. // -//This is only running with gosmi translator but should be valid with -//netsnmp too. +// This is only running with gosmi translator but should be valid with +// netsnmp too. func TestTableBuild_walk_noTranslate(t *testing.T) { tbl := Table{ Name: "mytable", diff --git a/plugins/inputs/snmp/netsnmp.go b/plugins/inputs/snmp/netsnmp.go index 96339956f5c71..09f56ed4a6c06 100644 --- a/plugins/inputs/snmp/netsnmp.go +++ b/plugins/inputs/snmp/netsnmp.go @@ -12,8 +12,8 @@ import ( "github.com/influxdata/wlog" ) -//struct that implements the translator interface. This calls existing -//code to exec netsnmp's snmptranslate program +// struct that implements the translator interface. This calls existing +// code to exec netsnmp's snmptranslate program type netsnmpTranslator struct { } @@ -58,6 +58,7 @@ var snmpTableCachesLock sync.Mutex // snmpTable resolves the given OID as a table, providing information about the // table and fields within. +// //nolint:revive func (n *netsnmpTranslator) SnmpTable(oid string) ( mibName string, oidNum string, oidText string, @@ -154,6 +155,7 @@ var snmpTranslateCachesLock sync.Mutex var snmpTranslateCaches map[string]snmpTranslateCache // snmpTranslate resolves the given OID. +// //nolint:revive func (n *netsnmpTranslator) SnmpTranslate(oid string) ( mibName string, oidNum string, oidText string, diff --git a/plugins/inputs/snmp/snmp.go b/plugins/inputs/snmp/snmp.go index 5fda56fe2a49a..d9dbf5c515f68 100644 --- a/plugins/inputs/snmp/snmp.go +++ b/plugins/inputs/snmp/snmp.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/snmp_legacy/snmp_legacy.go b/plugins/inputs/snmp_legacy/snmp_legacy.go index fc2f5af3a7f23..f9bf70bc0878b 100644 --- a/plugins/inputs/snmp_legacy/snmp_legacy.go +++ b/plugins/inputs/snmp_legacy/snmp_legacy.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/snmp_trap/snmp_trap.go b/plugins/inputs/snmp_trap/snmp_trap.go index e7b9d413fac2b..37e33bdd75e75 100644 --- a/plugins/inputs/snmp_trap/snmp_trap.go +++ b/plugins/inputs/snmp_trap/snmp_trap.go @@ -20,6 +20,7 @@ import ( var defaultTimeout = config.Duration(time.Second * 5) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/socket_listener/socket_listener.go b/plugins/inputs/socket_listener/socket_listener.go index 3823263437209..93cc59c3c694f 100644 --- a/plugins/inputs/socket_listener/socket_listener.go +++ b/plugins/inputs/socket_listener/socket_listener.go @@ -23,6 +23,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/socketstat/socketstat.go b/plugins/inputs/socketstat/socketstat.go index 3f905882234f8..4ab30f932fc41 100644 --- a/plugins/inputs/socketstat/socketstat.go +++ b/plugins/inputs/socketstat/socketstat.go @@ -24,6 +24,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/solr/solr.go b/plugins/inputs/solr/solr.go index 7b4e74658b614..bf8eec2e45379 100644 --- a/plugins/inputs/solr/solr.go +++ b/plugins/inputs/solr/solr.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sql/sql.go b/plugins/inputs/sql/sql.go index aa4a7e9f42085..454911b17902e 100644 --- a/plugins/inputs/sql/sql.go +++ b/plugins/inputs/sql/sql.go @@ -22,6 +22,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sqlserver/azuresqldbqueries.go b/plugins/inputs/sqlserver/azuresqldbqueries.go index 91f9180b7a53b..a78dad6b3f703 100644 --- a/plugins/inputs/sqlserver/azuresqldbqueries.go +++ b/plugins/inputs/sqlserver/azuresqldbqueries.go @@ -4,9 +4,9 @@ import ( _ "github.com/denisenkom/go-mssqldb" // go-mssqldb initialization ) -//------------------------------------------------------------------------------------------------ -//------------------ Azure SQL Database ---------------------------------------------------------- -//------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------ Azure SQL Database ---------------------------------------------------------- +// ------------------------------------------------------------------------------------------------ // Only executed if AzureDB flag is set const sqlAzureDBResourceStats string = ` IF SERVERPROPERTY('EngineEdition') <> 5 BEGIN /*not Azure SQL DB*/ diff --git a/plugins/inputs/sqlserver/azuresqlmanagedqueries.go b/plugins/inputs/sqlserver/azuresqlmanagedqueries.go index 90523e5e223da..a5ebd6ea5a8c6 100644 --- a/plugins/inputs/sqlserver/azuresqlmanagedqueries.go +++ b/plugins/inputs/sqlserver/azuresqlmanagedqueries.go @@ -4,9 +4,9 @@ import ( _ "github.com/denisenkom/go-mssqldb" // go-mssqldb initialization ) -//------------------------------------------------------------------------------------------------ -//------------------ Azure Managed Instance ------------------------------------------------------ -//------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------ Azure Managed Instance ------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ const sqlAzureMIProperties = ` IF SERVERPROPERTY('EngineEdition') <> 8 BEGIN /*not Azure Managed Instance*/ DECLARE @ErrorMessage AS nvarchar(500) = 'Telegraf - Connection string Server:'+ @@SERVERNAME + ',Database:' + DB_NAME() +' is not an Azure Managed Instance. Check the database_type parameter in the telegraf configuration.'; diff --git a/plugins/inputs/sqlserver/azuresqlpoolqueries.go b/plugins/inputs/sqlserver/azuresqlpoolqueries.go index 36fe087fc57e6..c9ffb4dfdce5b 100644 --- a/plugins/inputs/sqlserver/azuresqlpoolqueries.go +++ b/plugins/inputs/sqlserver/azuresqlpoolqueries.go @@ -4,9 +4,9 @@ import ( _ "github.com/denisenkom/go-mssqldb" // go-mssqldb initialization ) -//------------------------------------------------------------------------------------------------ -//------------------ Azure Sql Elastic Pool ------------------------------------------------------ -//------------------------------------------------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ +// ------------------ Azure Sql Elastic Pool ------------------------------------------------------ +// ------------------------------------------------------------------------------------------------ const sqlAzurePoolResourceStats = ` IF SERVERPROPERTY('EngineEdition') <> 5 OR NOT EXISTS (SELECT 1 FROM sys.database_service_objectives WHERE database_id = DB_ID() AND elastic_pool_name IS NOT NULL) BEGIN diff --git a/plugins/inputs/sqlserver/sqlqueriesV2.go b/plugins/inputs/sqlserver/sqlqueriesV2.go index 7eefcc089ce88..2a344e1a9b2e8 100644 --- a/plugins/inputs/sqlserver/sqlqueriesV2.go +++ b/plugins/inputs/sqlserver/sqlqueriesV2.go @@ -347,7 +347,7 @@ BEGIN ` -//Recommend disabling this by default, but is useful to detect single CPU spikes/bottlenecks +// Recommend disabling this by default, but is useful to detect single CPU spikes/bottlenecks const sqlServerSchedulersV2 string = ` SET DEADLOCK_PRIORITY - 10; @@ -388,8 +388,11 @@ EXEC sp_executesql @SqlStatement /* This string defines a SQL statements to retrieve Performance Counters as documented here - + SQL Server Performance Objects - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects?view=sql-server-ver15#SQLServerPOs + Some of the specific objects used are - + MSSQL$*:Access Methods - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object?view=sql-server-ver15 MSSQL$*:Buffer Manager - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object?view=sql-server-ver15 MSSQL$*:Databases - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object?view=sql-server-ver15 diff --git a/plugins/inputs/sqlserver/sqlserver.go b/plugins/inputs/sqlserver/sqlserver.go index 5987e06a81545..b2c8775f6b73f 100644 --- a/plugins/inputs/sqlserver/sqlserver.go +++ b/plugins/inputs/sqlserver/sqlserver.go @@ -19,6 +19,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sqlserver/sqlserverqueries.go b/plugins/inputs/sqlserver/sqlserverqueries.go index ab0e249be5226..8d7808139624d 100644 --- a/plugins/inputs/sqlserver/sqlserverqueries.go +++ b/plugins/inputs/sqlserver/sqlserverqueries.go @@ -287,8 +287,11 @@ EXEC sp_executesql @SqlStatement /* This string defines a SQL statements to retrieve Performance Counters as documented here - + SQL Server Performance Objects - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/use-sql-server-objects?view=sql-server-ver15#SQLServerPOs + Some of the specific objects used are - + MSSQL$*:Access Methods - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-access-methods-object?view=sql-server-ver15 MSSQL$*:Buffer Manager - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-buffer-manager-object?view=sql-server-ver15 MSSQL$*:Databases - https://docs.microsoft.com/en-us/sql/relational-databases/performance-monitor/sql-server-databases-object?view=sql-server-ver15 diff --git a/plugins/inputs/stackdriver/stackdriver.go b/plugins/inputs/stackdriver/stackdriver.go index 25cf4c4306757..c89f9a31ef982 100644 --- a/plugins/inputs/stackdriver/stackdriver.go +++ b/plugins/inputs/stackdriver/stackdriver.go @@ -29,6 +29,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/statsd/running_stats.go b/plugins/inputs/statsd/running_stats.go index 08f24fe8861fd..1883406c46bc6 100644 --- a/plugins/inputs/statsd/running_stats.go +++ b/plugins/inputs/statsd/running_stats.go @@ -12,7 +12,8 @@ const defaultMedianLimit = 1000 // RunningStats calculates a running mean, variance, standard deviation, // lower bound, upper bound, count, and can calculate estimated percentiles. // It is based on the incremental algorithm described here: -// https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance +// +// https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance type RunningStats struct { k float64 n int64 diff --git a/plugins/inputs/statsd/statsd.go b/plugins/inputs/statsd/statsd.go index da3a0b0159a32..a4e0431f30479 100644 --- a/plugins/inputs/statsd/statsd.go +++ b/plugins/inputs/statsd/statsd.go @@ -25,6 +25,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/supervisor/supervisor.go b/plugins/inputs/supervisor/supervisor.go index 6f0cf41e0f758..83a315bf4513c 100644 --- a/plugins/inputs/supervisor/supervisor.go +++ b/plugins/inputs/supervisor/supervisor.go @@ -46,6 +46,7 @@ type supervisorInfo struct { } // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/suricata/suricata.go b/plugins/inputs/suricata/suricata.go index bbe246fe38ccf..89f0ce58edcc8 100644 --- a/plugins/inputs/suricata/suricata.go +++ b/plugins/inputs/suricata/suricata.go @@ -17,6 +17,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/swap/swap.go b/plugins/inputs/swap/swap.go index 4e04606666aed..6a122c2b81d4e 100644 --- a/plugins/inputs/swap/swap.go +++ b/plugins/inputs/swap/swap.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/synproxy/synproxy.go b/plugins/inputs/synproxy/synproxy.go index 3950f727fd074..453bd42faac73 100644 --- a/plugins/inputs/synproxy/synproxy.go +++ b/plugins/inputs/synproxy/synproxy.go @@ -11,6 +11,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/syslog/syslog.go b/plugins/inputs/syslog/syslog.go index 528a7029eccfd..72de8c0207730 100644 --- a/plugins/inputs/syslog/syslog.go +++ b/plugins/inputs/syslog/syslog.go @@ -29,6 +29,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string diff --git a/plugins/inputs/sysstat/sysstat.go b/plugins/inputs/sysstat/sysstat.go index d171b6a1309c2..032df38f3e60c 100644 --- a/plugins/inputs/sysstat/sysstat.go +++ b/plugins/inputs/sysstat/sysstat.go @@ -24,6 +24,7 @@ import ( ) // DO NOT REMOVE THE NEXT TWO LINES! This is required to embed the sampleConfig data. +// //go:embed sample.conf var sampleConfig string @@ -138,7 +139,9 @@ func (s *Sysstat) Gather(acc telegraf.Accumulator) error { // collect collects sysstat data with the collector utility sadc. // It runs the following command: -// Sadc -S -S ... 2 tmpFile +// +// Sadc -S -S ... 2 tmpFile +// // The above command collects system metrics during and // saves it in binary form to tmpFile. func (s *Sysstat) collect(tempfile string) error { @@ -190,7 +193,9 @@ func withCLocale(cmd *exec.Cmd) *exec.Cmd { } // parse runs Sadf on the previously saved tmpFile: -// Sadf -p -- -p