2020-02-06 20:40:03 +00:00
|
|
|
package template
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
2020-04-13 17:57:48 +00:00
|
|
|
|
|
|
|
"github.com/influxdata/telegraf"
|
2020-02-06 20:40:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type TemplateMetric struct {
|
|
|
|
metric telegraf.Metric
|
|
|
|
}
|
|
|
|
|
2020-04-13 17:57:48 +00:00
|
|
|
func (m *TemplateMetric) Name() string {
|
|
|
|
return m.metric.Name()
|
2020-02-06 20:40:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *TemplateMetric) Tag(key string) string {
|
|
|
|
tagString, _ := m.metric.GetTag(key)
|
|
|
|
return tagString
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *TemplateMetric) Field(key string) interface{} {
|
|
|
|
field, _ := m.metric.GetField(key)
|
|
|
|
return field
|
|
|
|
}
|
|
|
|
|
|
|
|
func (m *TemplateMetric) Time() time.Time {
|
|
|
|
return m.metric.Time()
|
|
|
|
}
|