package main import ( "fmt" "github.com/influxdb/telegraf/testutil" ) func main() { acc := testutil.Accumulator{} acc.AddFields("cpu", map[string]interface{}{"usage": 90}, map[string]string{"host": "server1"}) acc.AddFields("memory", map[string]interface{}{"usage": 50}, map[string]string{"host": "server1"}) acc.AddFields("cpu", map[string]interface{}{"usage": 80}, map[string]string{"host": "server2"}) acc.AddFields("memory", map[string]interface{}{"usage": 60}, map[string]string{"host": "server2"}) if err := acc.ValidateTaggedValue("cpu", map[string]interface{}{"usage": 90}, map[string]string{"host": "server1"}); err != nil { fmt.Println(err) } if err := acc.ValidateTaggedValue("memory", map[string]interface{}{"usage": 55}, map[string]string{"host": "server1"}); err != nil { fmt.Println(err) } }In this example, the testutil package is used to create an Accumulator and add fields with tags. The ValidateTaggedValue function is then used to check that a certain value exists in the accumulator with a specific tag. The first validation will pass, as the value exists in the accumulator with the correct tag. The second one will fail, as the value does not exist with a usage of 55 (it exists with a usage of 50).