Skip to content

Commit e096694

Browse files
sparrcgeodimm
authored andcommitted
Change pass/drop to namepass/namedrop for outputs
closes influxdata#730
1 parent 5d35809 commit e096694

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

docs/CONFIGURATION.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -209,22 +209,22 @@ configuring each output sink is different, but examples can be
209209
found by running `telegraf -sample-config`.
210210

211211
Outputs also support the same configurable options as inputs
212-
(pass, drop, tagpass, tagdrop)
212+
(namepass, namedrop, tagpass, tagdrop)
213213

214214
```toml
215215
[[outputs.influxdb]]
216216
urls = [ "http://localhost:8086" ]
217217
database = "telegraf"
218218
precision = "s"
219219
# Drop all measurements that start with "aerospike"
220-
drop = ["aerospike*"]
220+
namedrop = ["aerospike*"]
221221

222222
[[outputs.influxdb]]
223223
urls = [ "http://localhost:8086" ]
224224
database = "telegraf-aerospike-data"
225225
precision = "s"
226226
# Only accept aerospike data:
227-
pass = ["aerospike*"]
227+
namepass = ["aerospike*"]
228228

229229
[[outputs.influxdb]]
230230
urls = [ "http://localhost:8086" ]

etc/telegraf.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
# Whether to report total system cpu stats or not
9090
totalcpu = true
9191
# Comment this line if you want the raw CPU time metrics
92-
drop = ["time_*"]
92+
fielddrop = ["time_*"]
9393

9494
# Read metrics about disk usage by mount point
9595
[[inputs.disk]]

internal/config/config.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,8 @@ func (c *Config) addInput(name string, table *ast.Table) error {
477477
return nil
478478
}
479479

480-
// buildFilter builds a Filter (tagpass/tagdrop/pass/drop) to
480+
// buildFilter builds a Filter
481+
// (tagpass/tagdrop/namepass/namedrop/fieldpass/fielddrop) to
481482
// be inserted into the internal_models.OutputConfig/internal_models.InputConfig to be used for prefix
482483
// filtering on tags and measurements
483484
func buildFilter(tbl *ast.Table) internal_models.Filter {
@@ -752,5 +753,12 @@ func buildOutput(name string, tbl *ast.Table) (*internal_models.OutputConfig, er
752753
Name: name,
753754
Filter: buildFilter(tbl),
754755
}
756+
// Outputs don't support FieldDrop/FieldPass, so set to NameDrop/NamePass
757+
if len(oc.Filter.FieldDrop) > 0 {
758+
oc.Filter.NameDrop = oc.Filter.FieldDrop
759+
}
760+
if len(oc.Filter.FieldPass) > 0 {
761+
oc.Filter.NamePass = oc.Filter.FieldPass
762+
}
755763
return oc, nil
756764
}

internal/models/filter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type Filter struct {
2828
}
2929

3030
func (f Filter) ShouldMetricPass(metric telegraf.Metric) bool {
31-
if f.ShouldFieldsPass(metric.Name()) && f.ShouldTagsPass(metric.Tags()) {
31+
if f.ShouldNamePass(metric.Name()) && f.ShouldTagsPass(metric.Tags()) {
3232
return true
3333
}
3434
return false

plugins/inputs/system/cpu.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ var sampleConfig = `
3333
## Whether to report total system cpu stats or not
3434
totalcpu = true
3535
## Comment this line if you want the raw CPU time metrics
36-
drop = ["time_*"]
36+
fielddrop = ["time_*"]
3737
`
3838

3939
func (_ *CPUStats) SampleConfig() string {

0 commit comments

Comments
 (0)