From 82226a9d79768389ac3f8176635bd9387dae6020 Mon Sep 17 00:00:00 2001 From: Sven Rebhan Date: Thu, 11 Nov 2021 10:32:01 +0100 Subject: [PATCH] Add inputs.io to list of deprecated plugins. --- config/config.go | 3 +++ config/deprecation.go | 5 +++++ plugins/inputs/deprecations.go | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/config/config.go b/config/config.go index f0d6604d71a13..a02b94a619bf6 100644 --- a/config/config.go +++ b/config/config.go @@ -1143,6 +1143,9 @@ func (c *Config) addInput(name string, table *ast.Table) error { // Legacy support renaming io input to diskio if name == "io" { + if err := c.printUserDeprecation("inputs", name, nil); err != nil { + return err + } name = "diskio" } diff --git a/config/deprecation.go b/config/deprecation.go index 8dc691d63de2f..ca1d2d71c8dda 100644 --- a/config/deprecation.go +++ b/config/deprecation.go @@ -120,6 +120,11 @@ func (c *Config) collectDeprecationInfo(category, name string, plugin interface{ c.incrementPluginDeprecations(category) } + // Allow checking for names only. + if plugin == nil { + return info + } + // Check for deprecated options walkPluginStruct(reflect.ValueOf(plugin), func(field reflect.StructField, value reflect.Value) { // Try to report only those fields that are set diff --git a/plugins/inputs/deprecations.go b/plugins/inputs/deprecations.go index 3aaddc7f9ef31..b8b4adfc55fef 100644 --- a/plugins/inputs/deprecations.go +++ b/plugins/inputs/deprecations.go @@ -7,6 +7,10 @@ var Deprecations = map[string]telegraf.DeprecationInfo{ Since: "1.7", Notice: "use 'inputs.jolokia2' with the 'cassandra.conf' example configuration instead", }, + "io": { + Since: "1.20", + Notice: "use 'inputs.diskio' instead", + }, "http_listener_v2": { Since: "1.9", Notice: "has been renamed to 'influxdb_listener', use 'inputs.influxdb_listener' or 'inputs.influxdb_listener_v2' instead",