Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,11 @@ func (c *Config) addSecretStore(name, source string, table *ast.Table) error {
return fmt.Errorf("invalid secret-store ID %q, must only contain letters, numbers or underscore", storeID)
}

tags := map[string]string{
"_id": storeID,
"secretstore": name,
}

creator, ok := secretstores.SecretStores[name]
if !ok {
// Handle removed, deprecated plugins
Expand All @@ -1017,6 +1022,7 @@ func (c *Config) addSecretStore(name, source string, table *ast.Table) error {

logger := logging.New("secretstores", name, "")
models.SetLoggerOnPlugin(store, logger)
models.SetStatisticsOnPlugin(store, logger, tags)

if err := store.Init(); err != nil {
return fmt.Errorf("error initializing secret-store %q: %w", storeID, err)
Expand Down
1 change: 1 addition & 0 deletions models/running_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func NewRunningAggregator(aggregator telegraf.Aggregator, config *AggregatorConf
logger.Error(err)
}
SetLoggerOnPlugin(aggregator, logger)
SetStatisticsOnPlugin(aggregator, logger, tags)

return &RunningAggregator{
Aggregator: aggregator,
Expand Down
4 changes: 4 additions & 0 deletions models/running_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package models
import (
"errors"
"fmt"
"maps"
"time"

"github.com/influxdata/telegraf"
Expand Down Expand Up @@ -45,6 +46,8 @@ func NewRunningInput(input telegraf.Input, config *InputConfig) *RunningInput {
tags["alias"] = config.Alias
}

maps.Copy(tags, config.Tags)
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should do this! The target is to have the same tags as the model-level statistics...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The model level ones will also get this. Having these tags was the first thing I think of when seeing the spec, so that input plugin stats now also could have the tags defined on the plugin. Before there was no way to get this.

Maybe that should also go into an opt-in configuration parameter?

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the currently collected statistics will have these tags added right now. You are changing the statistics (and only for the inputs) and I don't want to open that box! Please remove the copy statement!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about a config parameter for this? I would really like to have it, as it will make it possible to have more performant queries to the TSDB when added.

Copy link
Member

Choose a reason for hiding this comment

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

How about removing the line from this PR and we discuss the matter in a separate PR?


inputErrorsRegister := selfstat.Register("gather", "errors", tags)
logger := logging.New("inputs", config.Name, config.Alias)
logger.RegisterErrorCallback(func() {
Expand All @@ -55,6 +58,7 @@ func NewRunningInput(input telegraf.Input, config *InputConfig) *RunningInput {
logger.Error(err)
}
SetLoggerOnPlugin(input, logger)
SetStatisticsOnPlugin(input, logger, tags)

return &RunningInput{
Input: input,
Expand Down
1 change: 1 addition & 0 deletions models/running_parsers.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func NewRunningParser(parser telegraf.Parser, config *ParserConfig) *RunningPars
logger.Error(err)
}
SetLoggerOnPlugin(parser, logger)
SetStatisticsOnPlugin(parser, logger, tags)

return &RunningParser{
Parser: parser,
Expand Down
1 change: 1 addition & 0 deletions models/running_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func NewRunningProcessor(processor telegraf.StreamingProcessor, config *Processo
logger.Error(err)
}
SetLoggerOnPlugin(processor, logger)
SetStatisticsOnPlugin(processor, logger, tags)

return &RunningProcessor{
Processor: processor,
Expand Down
1 change: 1 addition & 0 deletions models/running_serializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func NewRunningSerializer(serializer telegraf.Serializer, config *SerializerConf
logger.Error(err)
}
SetLoggerOnPlugin(serializer, logger)
SetStatisticsOnPlugin(serializer, logger, tags)

return &RunningSerializer{
Serializer: serializer,
Expand Down
Loading