Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated and unused SetAggregate() and IsAggregate() functions. #8994

Merged
merged 1 commit into from
Apr 6, 2021
Merged
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
10 changes: 0 additions & 10 deletions metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,4 @@ type Metric interface {
// Drop marks the metric as processed successfully without being written
// to any output.
Drop()

// SetAggregate indicates the metric is an aggregated value.
//
// This method may be removed in the future and its use is discouraged.
SetAggregate(bool)

// IsAggregate returns true if the Metric is an aggregate.
//
// This method may be removed in the future and its use is discouraged.
IsAggregate() bool
}
33 changes: 11 additions & 22 deletions metric/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ type metric struct {
fields []*telegraf.Field
tm time.Time

tp telegraf.ValueType
aggregate bool
tp telegraf.ValueType
}

func New(
Expand Down Expand Up @@ -68,12 +67,11 @@ func New(
// removed.
func FromMetric(other telegraf.Metric) telegraf.Metric {
m := &metric{
name: other.Name(),
tags: make([]*telegraf.Tag, len(other.TagList())),
fields: make([]*telegraf.Field, len(other.FieldList())),
tm: other.Time(),
tp: other.Type(),
aggregate: other.IsAggregate(),
name: other.Name(),
tags: make([]*telegraf.Tag, len(other.TagList())),
fields: make([]*telegraf.Field, len(other.FieldList())),
tm: other.Time(),
tp: other.Type(),
}

for i, tag := range other.TagList() {
Expand Down Expand Up @@ -233,12 +231,11 @@ func (m *metric) SetTime(t time.Time) {

func (m *metric) Copy() telegraf.Metric {
m2 := &metric{
name: m.name,
tags: make([]*telegraf.Tag, len(m.tags)),
fields: make([]*telegraf.Field, len(m.fields)),
tm: m.tm,
tp: m.tp,
aggregate: m.aggregate,
name: m.name,
tags: make([]*telegraf.Tag, len(m.tags)),
fields: make([]*telegraf.Field, len(m.fields)),
tm: m.tm,
tp: m.tp,
}

for i, tag := range m.tags {
Expand All @@ -251,14 +248,6 @@ func (m *metric) Copy() telegraf.Metric {
return m2
}

func (m *metric) SetAggregate(aggregate bool) {
m.aggregate = aggregate
}

func (m *metric) IsAggregate() bool {
return m.aggregate
}

func (m *metric) HashID() uint64 {
h := fnv.New64a()
h.Write([]byte(m.name))
Expand Down
7 changes: 0 additions & 7 deletions metric/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,10 +333,3 @@ func TestValueType(t *testing.T) {

assert.Equal(t, telegraf.Gauge, m.Type())
}

func TestCopyAggregate(t *testing.T) {
m1 := baseMetric()
m1.SetAggregate(true)
m2 := m1.Copy()
assert.True(t, m2.IsAggregate())
}
4 changes: 0 additions & 4 deletions models/running_aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ func (r *RunningAggregator) MakeMetric(metric telegraf.Metric) telegraf.Metric {
r.Config.Tags,
nil)

if m != nil {
m.SetAggregate(true)
}

r.MetricsPushed.Incr(1)

return m
Expand Down