Fix s2geo documentation and code to reflect current plugin name

This commit is contained in:
Daniel Nelson 2020-03-18 12:28:02 -07:00
parent ffaa9467a5
commit 35ef2559d3
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
5 changed files with 17 additions and 14 deletions

View File

@ -25,7 +25,7 @@
- [dedup](/plugins/processors/dedup/README.md) - Contributed by @igomura - [dedup](/plugins/processors/dedup/README.md) - Contributed by @igomura
- [template](/plugins/processors/template/README.md) - Contributed by @RobMalvern - [template](/plugins/processors/template/README.md) - Contributed by @RobMalvern
- [s2_geo](/plugins/processors/s2_geo/README.md) - Contributed by @alespour - [s2geo](/plugins/processors/s2geo/README.md) - Contributed by @alespour
#### New Outputs #### New Outputs

View File

@ -369,7 +369,7 @@ For documentation on the latest development code see the [documentation index][d
* [printer](/plugins/processors/printer) * [printer](/plugins/processors/printer)
* [regex](/plugins/processors/regex) * [regex](/plugins/processors/regex)
* [rename](/plugins/processors/rename) * [rename](/plugins/processors/rename)
* [s2_geo](/plugins/processors/s2_geo) * [s2geo](/plugins/processors/s2geo)
* [strings](/plugins/processors/strings) * [strings](/plugins/processors/strings)
* [tag_limit](/plugins/processors/tag_limit) * [tag_limit](/plugins/processors/tag_limit)
* [template](/plugins/processors/template) * [template](/plugins/processors/template)

View File

@ -7,16 +7,17 @@ The `lat` and `lon` fields values should contain WGS-84 coordinates in decimal d
### Configuration ### Configuration
```toml ```toml
[[processors.geo]] [[processors.s2geo]]
## The name of the lat and lon fields containing WGS-84 latitude and longitude in decimal degrees ## The name of the lat and lon fields containing WGS-84 latitude and
lat_field = "lat" ## longitude in decimal degrees.
lon_field = "lon" # lat_field = "lat"
# lon_field = "lon"
## New tag to create ## New tag to create
tag_key = "s2_cell_id" # tag_key = "s2_cell_id"
## Cell level (see https://s2geometry.io/resources/s2cell_statistics.html) ## Cell level (see https://s2geometry.io/resources/s2cell_statistics.html)
cell_level = 11 # cell_level = 9
``` ```
### Example ### Example

View File

@ -2,6 +2,7 @@ package geo
import ( import (
"fmt" "fmt"
"github.com/golang/geo/s2" "github.com/golang/geo/s2"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/plugins/processors" "github.com/influxdata/telegraf/plugins/processors"
@ -15,15 +16,16 @@ type Geo struct {
} }
var SampleConfig = ` var SampleConfig = `
## The name of the lat and lon fields containing WGS-84 latitude and longitude in decimal degrees ## The name of the lat and lon fields containing WGS-84 latitude and
lat_field = "lat" ## longitude in decimal degrees.
lon_field = "lon" # lat_field = "lat"
# lon_field = "lon"
## New tag to create ## New tag to create
tag_key = "s2_cell_id" # tag_key = "s2_cell_id"
## Cell level (see https://s2geometry.io/resources/s2cell_statistics.html) ## Cell level (see https://s2geometry.io/resources/s2cell_statistics.html)
cell_level = 9 # cell_level = 9
` `
func (g *Geo) SampleConfig() string { func (g *Geo) SampleConfig() string {
@ -31,7 +33,7 @@ func (g *Geo) SampleConfig() string {
} }
func (g *Geo) Description() string { func (g *Geo) Description() string {
return "Reads latitude and longitude fields and adds tag with with S2 cell ID token of specified level." return "Add the S2 Cell ID as a tag based on latitude and longitude fields"
} }
func (g *Geo) Init() error { func (g *Geo) Init() error {