Skip to content

Commit

Permalink
make namespace optional
Browse files Browse the repository at this point in the history
  • Loading branch information
powersj committed Jun 20, 2023
1 parent 7ab1a7b commit 275c706
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugins/outputs/stackdriver/stackdriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (s *Stackdriver) Connect() error {
}

if s.Namespace == "" {
return fmt.Errorf("namespace is a required field for stackdriver output")
s.Log.Warn("plugin-level namespace is empty")
}

if s.ResourceType == "" {
Expand Down Expand Up @@ -296,7 +296,10 @@ func (s *Stackdriver) generateMetricName(m telegraf.Metric, key string) string {
return path.Join(s.MetricTypePrefix, s.Namespace, m.Name(), key)
}

name := s.Namespace + "_" + m.Name() + "_" + key
name := m.Name() + "_" + key
if s.Namespace != "" {
name = s.Namespace + "_" + m.Name() + "_" + key
}

var kind string
switch m.Type() {
Expand Down

0 comments on commit 275c706

Please sign in to comment.