From a6858b8024d1ac33004c759d2ef359e9f702db9c Mon Sep 17 00:00:00 2001 From: Sven Rebhan <36194019+srebhan@users.noreply.github.com> Date: Mon, 2 Oct 2023 18:39:21 +0200 Subject: [PATCH] chore(inputs.modbus): Deprecate aggressive optimization (#14030) --- plugins/inputs/modbus/README.md | 4 ---- plugins/inputs/modbus/configuration_request.go | 15 ++++++++++++++- plugins/inputs/modbus/sample_request.conf | 4 ---- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/plugins/inputs/modbus/README.md b/plugins/inputs/modbus/README.md index 5ba1a3070..71c60dc0f 100644 --- a/plugins/inputs/modbus/README.md +++ b/plugins/inputs/modbus/README.md @@ -157,10 +157,6 @@ See the [CONFIGURATION.md][CONFIGURATION.md] for more details. ## |---rearrange -- Rearrange request boundaries within consecutive address ranges ## | to reduce the number of requested registers by keeping ## | the number of requests. - ## |---aggressive -- Rearrange request boundaries similar to "rearrange" but - ## | allow to request registers not specified by the user to - ## | fill gaps. This usually reduces the number of requests at the - ## | cost of more requested registers. ## |---max_insert -- Rearrange request keeping the number of extra fields below the value ## provided in "optimization_max_register_fill". It is not necessary to define 'omitted' ## fields as the optimisation will add such field only where needed. diff --git a/plugins/inputs/modbus/configuration_request.go b/plugins/inputs/modbus/configuration_request.go index feadddec6..3384ab75e 100644 --- a/plugins/inputs/modbus/configuration_request.go +++ b/plugins/inputs/modbus/configuration_request.go @@ -7,6 +7,7 @@ import ( "hash/maphash" "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/models" ) //go:embed sample_request.conf @@ -67,7 +68,19 @@ func (c *ConfigurationPerRequest) Check() error { } // Check for valid optimization switch def.Optimization { - case "", "none", "shrink", "rearrange", "aggressive": + case "", "none", "shrink", "rearrange": + case "aggressive": + models.PrintOptionValueDeprecationNotice( + telegraf.Warn, + "inputs.modbus", + "optimization", + "aggressive", + telegraf.DeprecationInfo{ + Since: "1.28.2", + RemovalIn: "1.30.0", + Notice: `use "max_insert" instead`, + }, + ) case "max_insert": switch def.RegisterType { case "coil": diff --git a/plugins/inputs/modbus/sample_request.conf b/plugins/inputs/modbus/sample_request.conf index 1a53e87af..adab9b815 100644 --- a/plugins/inputs/modbus/sample_request.conf +++ b/plugins/inputs/modbus/sample_request.conf @@ -32,10 +32,6 @@ ## |---rearrange -- Rearrange request boundaries within consecutive address ranges ## | to reduce the number of requested registers by keeping ## | the number of requests. - ## |---aggressive -- Rearrange request boundaries similar to "rearrange" but - ## | allow to request registers not specified by the user to - ## | fill gaps. This usually reduces the number of requests at the - ## | cost of more requested registers. ## |---max_insert -- Rearrange request keeping the number of extra fields below the value ## provided in "optimization_max_register_fill". It is not necessary to define 'omitted' ## fields as the optimisation will add such field only where needed.