Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Fix linter findings for errorlint (part4) #12723

Merged
merged 1 commit into from
Feb 22, 2023
Merged

chore: Fix linter findings for errorlint (part4) #12723

merged 1 commit into from
Feb 22, 2023

Conversation

zak-pawel
Copy link
Collaborator

Address findings for errorlint - finds code that can cause problems with the error wrapping scheme introduced in Go 1.13.

It is only part of the bigger job.
After all findings in whole project are handled, we can enable errorlint linter to guard this.

Following findings in plugins/inputs/[a-e]* packages were fixed:

plugins/inputs/activemq/activemq.go:232:55                             errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/activemq/activemq.go:242:55                             errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/activemq/activemq.go:252:60                             errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/amqp_consumer/amqp_consumer.go:216:58                   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/amqp_consumer/amqp_consumer.go:253:57                   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/amqp_consumer/amqp_consumer.go:263:51                   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/amqp_consumer/amqp_consumer.go:276:73                   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/amqp_consumer/amqp_consumer.go:310:53                   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/amqp_consumer/amqp_consumer.go:344:55                   errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/amqp_consumer/amqp_consumer.go:445:19                   errorlint  comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/apache/apache.go:60:67                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/apache/apache.go:94:71                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/apache/apache.go:103:67                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/aurora/aurora.go:84:42                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/aurora/aurora.go:94:42                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/aurora/aurora.go:170:57                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/aurora/aurora.go:215:46                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bcache/bcache.go:131:53                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/beanstalkd/beanstalkd_test.go:124:7                     errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/bind/bind.go:51:67                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bind/json_stats.go:171:57                               errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bind/xml_stats_v2.go:104:58                             errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bind/xml_stats_v3.go:156:60                             errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bond/bond.go:58:78                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bond/bond.go:64:75                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bond/bond.go:156:95                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bond/bond.go:161:97                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/bond/bond.go:167:104                                    errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/burrow/burrow.go:126:70                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:73:77                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:79:76                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:84:81                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:110:53                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:114:50                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:160:56                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:169:91                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:242:66                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:302:63                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:381:62                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:542:62                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/ceph/ceph.go:621:62                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/chrony/chrony.go:53:87                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:227:20       errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:322:7        errorlint  comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:323:65       errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:338:76       errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt.go:361:53       errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go:759:32  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go:841:32  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go:854:32  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go:892:32  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go:931:32  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/cisco_telemetry_mdt/cisco_telemetry_mdt_test.go:941:32  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/cloud_pubsub/cloud_pubsub.go:105:66                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cloud_pubsub/cloud_pubsub.go:160:94                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cloud_pubsub/cloud_pubsub.go:164:86                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cloud_pubsub/cloud_pubsub.go:183:61                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cloud_pubsub/cloud_pubsub.go:269:66                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cloudwatch/cloudwatch.go:468:60                         errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/conntrack/conntrack.go:92:68                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/conntrack/conntrack.go:109:75                           errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/consul_agent/consul_agent.go:63:49                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/consul_agent/consul_agent.go:70:64                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/consul_agent/consul_agent.go:103:70                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/consul_agent/consul_agent.go:114:61                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/consul_agent/consul_agent.go:124:47                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/couchdb/couchdb.go:107:60                               errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/cpu/cpu.go:50:51                                        errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dcos/creds.go:53:68                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dcos/dcos.go:149:20                                     errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/dcos/dcos.go:165:20                                     errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/directory_monitor/directory_monitor.go:106:6            errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/directory_monitor/directory_monitor.go:126:7            errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/directory_monitor/directory_monitor.go:202:23           errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/disk/disk.go:50:58                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/diskio/diskio.go:51:61                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/diskio/diskio.go:69:55                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/disque/disque.go:72:73                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/disque/disque.go:103:80                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/disque/disque.go:145:43                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/disque/disque.go:154:58                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dns_query/dns_query.go:90:22                            errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/dns_query/dns_query.go:133:19                           errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/docker/docker.go:98:74                                  errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/docker/docker.go:103:70                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/docker/docker.go:191:5                                  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/docker/docker.go:219:5                                  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/docker/docker.go:296:5                                  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/docker/docker.go:456:5                                  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/docker/docker.go:460:55                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/docker/docker.go:466:6                                  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/docker/docker.go:469:43                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/docker/docker.go:494:5                                  errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/docker/docker.go:498:62                                 errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/docker_log/docker_log.go:192:21                         errorlint  comparing with != will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/docker_log/docker_log.go:287:82                         errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dovecot/dovecot.go:77:38                                errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dovecot/dovecot.go:83:75                                errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dovecot/dovecot.go:89:82                                errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dovecot/dovecot.go:99:89                                errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dovecot/dovecot.go:106:18                               errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/dovecot/dovecot.go:107:82                               errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk.go:99:97                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk.go:157:99                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk.go:166:99                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk.go:209:105                                    errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk.go:223:62                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:43:66                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:50:69                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:64:94                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:69:84                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:76:18                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:78:75                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:86:18                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:88:87                            errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:137:56                           errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:142:61                           errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_connector.go:148:63                           errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_utils.go:50:77                                errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/dpdk/dpdk_utils.go:75:69                                errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/elasticsearch_query/aggregation_query.go:40:61          errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/elasticsearch_query/aggregation_query.go:44:63          errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/elasticsearch_query/aggregation_query.go:72:104         errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/elasticsearch_query/elasticsearch_query.go:98:60        errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/elasticsearch_query/elasticsearch_query.go:156:63       errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/elasticsearch_query/elasticsearch_query.go:190:93       errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/eventhub_consumer/eventhub_consumer.go:149:77           errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/exec/exec.go:71:68                                      errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/exec/exec.go:129:7                                      errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/exec/exec.go:146:54                                     errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/execd/execd.go:110:7                                    errorlint  comparing with == will fail on wrapped errors. Use errors.Is to check for a specific error
plugins/inputs/execd/execd.go:113:33                                   errorlint  type assertion on error will fail on wrapped errors. Use errors.As to check for specific errors
plugins/inputs/execd/execd_posix.go:34:60                              errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors
plugins/inputs/execd/execd_posix.go:38:53                              errorlint  non-wrapping format verb for fmt.Errorf. Use `%w` to format errors

@telegraf-tiger
Copy link
Contributor

@powersj powersj added waiting for response waiting for response from contributor ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review. and removed waiting for response waiting for response from contributor labels Feb 22, 2023
Copy link
Member

@srebhan srebhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @zak-pawel!

@srebhan srebhan merged commit 312fb04 into influxdata:master Feb 22, 2023
powersj pushed a commit that referenced this pull request Feb 27, 2023
Co-authored-by: Pawel Zak <Pawel Zak>
(cherry picked from commit 312fb04)
@edeno1
Copy link

edeno1 commented Apr 4, 2023

@zak-pawel Does it have anything to do with not getting a metrics for an hour?

@zak-pawel
Copy link
Collaborator Author

@zak-pawel Does it have anything to do with not getting a metrics for an hour?

@edeno1 I have no idea. Could you elaborate on this? Is there any issue?

@edeno1
Copy link

edeno1 commented Apr 4, 2023

@zak-pawel I take metrics in cloudwatch and send them via http to prometheus remote write Lately every day I don't see metrics for an hour and then it comes back this thing affects me a lot because I issue alerts in real time with these metrics

[global_tags]
  # dc = "us-east-1" # will tag all metrics with dc=us-east-1
  # rack = "1a"
  ## Environment variables can be used as tags, and throughout the config file
  # user = "$USER"

# Configuration for telegraf agent
[agent]
  ## Default data collection interval for all inputs
  interval = "10s"
  ## Rounds collection interval to 'interval'
  ## ie, if interval="10s" then always collect on :00, :10, :20, etc.
  round_interval = true

  ## Telegraf will send metrics to outputs in batches of at most
  ## metric_batch_size metrics.
  ## This controls the size of writes that Telegraf sends to output plugins.
  metric_batch_size = 1000

  ## Maximum number of unwritten metrics per output.  Increasing this value
  ## allows for longer periods of output downtime without dropping metrics at the
  ## cost of higher maximum memory usage.
  metric_buffer_limit = 10000

  ## Collection jitter is used to jitter the collection by a random amount.
  ## Each plugin will sleep for a random time within jitter before collecting.
  ## This can be used to avoid many plugins querying things like sysfs at the
  ## same time, which can have a measurable effect on the system.
  collection_jitter = "0s"

  ## Collection offset is used to shift the collection by the given amount.
  ## This can be be used to avoid many plugins querying constraint devices
  ## at the same time by manually scheduling them in time.
  # collection_offset = "0s"

  ## Default flushing interval for all outputs. Maximum flush_interval will be
  ## flush_interval + flush_jitter
  flush_interval = "10s"
  ## Jitter the flush interval by a random amount. This is primarily to avoid
  ## large write spikes for users running a large number of telegraf instances.
  ## ie, a jitter of 5s and interval 10s means flushes will happen every 10-15s
  flush_jitter = "0s"

  ## Collected metrics are rounded to the precision specified. Precision is
  ## specified as an interval with an integer + unit (e.g. 0s, 10ms, 2us, 4s).
  ## Valid time units are "ns", "us" (or "µs"), "ms", "s".
  ##
  ## By default or when set to "0s", precision will be set to the same
  ## timestamp order as the collection interval, with the maximum being 1s:
  ##   ie, when interval = "10s", precision will be "1s"
  ##       when interval = "250ms", precision will be "1ms"
  ##
  ## Precision will NOT be used for service inputs. It is up to each individual
  ## service input to set the timestamp at the appropriate precision.
  precision = "0s"

  ## Log at debug level.
   debug = true
  ## Log only error level messages.
  # quiet = false

  ## Log target controls the destination for logs and can be one of "file",
  ## "stderr" or, on Windows, "eventlog".  When set to "file", the output file
  ## is determined by the "logfile" setting.
  # logtarget = "file"

  ## Name of the file to be logged to when using the "file" logtarget.  If set to
  ## the empty string then logs are written to stderr.
  # logfile = ""

  ## The logfile will be rotated after the time interval specified.  When set
  ## to 0 no time based rotation is performed.  Logs are rotated only when
  ## written to, if there is no log activity rotation may be delayed.
  # logfile_rotation_interval = "0h"

  ## The logfile will be rotated when it becomes larger than the specified
  ## size.  When set to 0 no size based rotation is performed.
  # logfile_rotation_max_size = "0MB"

  ## Maximum number of rotated archives to keep, any older logs are deleted.
  ## If set to -1, no archives are removed.
  # logfile_rotation_max_archives = 5

  ## Pick a timezone to use when logging or type 'local' for local time.
  ## Example: America/Chicago
  # log_with_timezone = ""

  ## Override default hostname, if empty use os.Hostname()
  hostname = ""
  ## If set to true, do no set the "host" tag in the telegraf agent.
  omit_hostname = true

  ## Method of translating SNMP objects. Can be "netsnmp" (deprecated) which
  ## translates by calling external programs snmptranslate and snmptable,
  ## or "gosmi" which translates using the built-in gosmi library.
  # snmp_translator = "netsnmp"


# Pull Metric Statistics from Amazon CloudWatch
[[inputs.cloudwatch]]
  region = "eu-west-1"
  period = "1m"
  delay = "30s"
  interval = "30s"
  namespaces = ["AWS/SQS"]
  fieldpass = ["approximate_number_of_messages_visible_average","approximate_number_of_messages_not_visible_average"]
[[inputs.cloudwatch]]
  region = "eu-west-1"
  period = "1m"
  delay = "1m"
  interval = "5m"
  namespaces = ["AWS/RDS"]
  fieldpass = ["cpu_utilization_average","database_connections_average","free_storage_space_average","write_iops_average","read_iops_average","freeable_memory_average"]
[[inputs.cloudwatch]]
  region = "eu-west-1"
  period = "1m"
  delay = "1m"
  interval = "1m"
  namespaces = ["AWS/ElastiCache"]
  fieldpass = ["cpu_utilization_average","database_memory_usage_percentage_average","memory_fragmentation_ratio_average","freeable_memory_average","network_bytes_in_average","network_bytes_out_average"]
[[inputs.cloudwatch]]
  region = "eu-west-1"
  period = "1m"
  delay = "1m"
  interval = "1m"
  namespaces = ["AWS/WAFV2"]
[[inputs.cloudwatch]]
  region = "eu-west-1"
  period = "1m"
  delay = "1m"
  interval = "1m"
  namespaces = ["AWS/SNS"]
  fieldpass = ["number_of_messages_published_sum","number_of_notifications_failed_sum"]
[[inputs.cloudwatch]]
  region = "eu-west-1"
  period = "1m"
  delay = "1m"
  interval = "1m"
  namespaces = ["AWS/Lambda"]
  fieldpass = ["duration_average","invocations_sum","errors_sum"]
[[inputs.cloudwatch]]
  region = "eu-west-1"
  period = "1m"
  delay = "1m"
  interval = "6m"
  namespaces = ["AWS/ApplicationELB"]
  fieldpass = ["target_response_time_average","request_count_per_target_sample_count","http_code_elb_5xx_count_sample_count","active_connection_count_sample_count"]

[[outputs.file]]
  ## Files to write to, "stdout" is a specially handled file.
  files = ["stdout", "/tmp/metrics.out"]

  ## Use batch serialization format instead of line based delimiting.  The
  ## batch format allows for the production of non line based output formats and
  ## may more efficiently encode and write metrics.
  # use_batch_format = false

  ## The file will be rotated after the time interval specified.  When set
  ## to 0 no time based rotation is performed.
  # rotation_interval = "0h"

  ## The logfile will be rotated when it becomes larger than the specified
  ## size.  When set to 0 no size based rotation is performed.
  # rotation_max_size = "0MB"

  ## Maximum number of rotated archives to keep, any older logs are deleted.
  ## If set to -1, no archives are removed.
  # rotation_max_archives = 5

  ## Data format to output.
  ## Each data format has its own unique set of configuration options, read
  ## more about them here:
  ## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md
  data_format = "influx"
[[outputs.http]]
  url = "XXX"
  data_format = "prometheusremotewrite"

@edeno1
Copy link

edeno1 commented Apr 4, 2023

Screen Shot 2023-04-04 at 11 21 08

@zak-pawel

@Hipska
Copy link
Contributor

Hipska commented Apr 4, 2023

@edeno1 how is that in any way related to these linter fixes?

@zak-pawel
Copy link
Collaborator Author

@edeno1 Can you create separate issue in which you provide Telegraf version, logs and describe everything?

@edeno1
Copy link

edeno1 commented Apr 4, 2023

@zak-pawel yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore ready for final review This pull request has been reviewed and/or tested by multiple users and is ready for a final review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants