Skip to content

Commit

Permalink
Update Telegraf for changes in core v0.22.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pmm-sumo committed Mar 18, 2021
1 parent 62d41c5 commit 5fd8754
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions receiver/telegrafreceiver/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (mc metricConverter) Convert(m telegraf.Metric) (pdata.Metrics, error) {
dps.Resize(1)
dp := dps.At(0)
dp.SetValue(v)
dp.SetTimestamp(pdata.TimestampUnixNano(tim))
dp.SetTimestamp(pdata.Timestamp(tim))
if mc.separateField {
dp.LabelsMap().Insert(fieldLabel, f.Key)
}
Expand All @@ -97,7 +97,7 @@ func (mc metricConverter) Convert(m telegraf.Metric) (pdata.Metrics, error) {
dp.SetValue(int64(vv))
}

dp.SetTimestamp(pdata.TimestampUnixNano(tim))
dp.SetTimestamp(pdata.Timestamp(tim))
if mc.separateField {
dp.LabelsMap().Insert(fieldLabel, f.Key)
}
Expand Down
8 changes: 4 additions & 4 deletions receiver/telegrafreceiver/converter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func newMetricIntGauge(metric string, value int64, t time.Time) pdata.Metric {
dps.Resize(1)
dp := dps.At(0)
dp.SetValue(value)
dp.SetTimestamp(pdata.TimestampUnixNano(t.UnixNano()))
dp.SetTimestamp(pdata.Timestamp(t.UnixNano()))
return pm
}

Expand All @@ -355,7 +355,7 @@ func newMetricIntGaugeWithSeparateField(metric string, field string, value int64
dps.Resize(1)
dp := dps.At(0)
dp.SetValue(value)
dp.SetTimestamp(pdata.TimestampUnixNano(t.UnixNano()))
dp.SetTimestamp(pdata.Timestamp(t.UnixNano()))
dp.LabelsMap().Insert(fieldLabel, field)
return pm
}
Expand All @@ -369,7 +369,7 @@ func newMetricDoubleGauge(metric string, value float64, t time.Time) pdata.Metri
dps.Resize(1)
dp := dps.At(0)
dp.SetValue(value)
dp.SetTimestamp(pdata.TimestampUnixNano(t.UnixNano()))
dp.SetTimestamp(pdata.Timestamp(t.UnixNano()))
return pm
}

Expand All @@ -382,7 +382,7 @@ func newMetricDoubleGaugeWithSeparateField(metric string, field string, value fl
dps.Resize(1)
dp := dps.At(0)
dp.SetValue(value)
dp.SetTimestamp(pdata.TimestampUnixNano(t.UnixNano()))
dp.SetTimestamp(pdata.Timestamp(t.UnixNano()))
dp.LabelsMap().Insert(fieldLabel, field)
return pm
}
Expand Down
2 changes: 1 addition & 1 deletion receiver/telegrafreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.14
require (
github.com/influxdata/telegraf v1.17.3
github.com/stretchr/testify v1.7.0
go.opentelemetry.io/collector v0.21.0
go.opentelemetry.io/collector v0.22.0
go.uber.org/zap v1.16.0
)

Expand Down

0 comments on commit 5fd8754

Please sign in to comment.