diff --git a/CHANGELOG.md b/CHANGELOG.md index 39c0c10bd..2c613a711 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,7 +25,7 @@ - [dedup](/plugins/processors/dedup/README.md) - Contributed by @igomura - [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 diff --git a/README.md b/README.md index 87d8f9b12..57615f9a8 100644 --- a/README.md +++ b/README.md @@ -369,7 +369,7 @@ For documentation on the latest development code see the [documentation index][d * [printer](/plugins/processors/printer) * [regex](/plugins/processors/regex) * [rename](/plugins/processors/rename) -* [s2_geo](/plugins/processors/s2_geo) +* [s2geo](/plugins/processors/s2geo) * [strings](/plugins/processors/strings) * [tag_limit](/plugins/processors/tag_limit) * [template](/plugins/processors/template) diff --git a/plugins/processors/s2_geo/README.md b/plugins/processors/s2geo/README.md similarity index 83% rename from plugins/processors/s2_geo/README.md rename to plugins/processors/s2geo/README.md index 5a65d5e7d..d48947fe6 100644 --- a/plugins/processors/s2_geo/README.md +++ b/plugins/processors/s2geo/README.md @@ -7,16 +7,17 @@ The `lat` and `lon` fields values should contain WGS-84 coordinates in decimal d ### Configuration ```toml -[[processors.geo]] - ## The name of the lat and lon fields containing WGS-84 latitude and longitude in decimal degrees - lat_field = "lat" - lon_field = "lon" +[[processors.s2geo]] + ## The name of the lat and lon fields containing WGS-84 latitude and + ## longitude in decimal degrees. + # lat_field = "lat" + # lon_field = "lon" ## 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 = 11 + # cell_level = 9 ``` ### Example diff --git a/plugins/processors/s2_geo/geo.go b/plugins/processors/s2geo/s2geo.go similarity index 86% rename from plugins/processors/s2_geo/geo.go rename to plugins/processors/s2geo/s2geo.go index 85f80c3df..5376a6657 100644 --- a/plugins/processors/s2_geo/geo.go +++ b/plugins/processors/s2geo/s2geo.go @@ -2,6 +2,7 @@ package geo import ( "fmt" + "github.com/golang/geo/s2" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/processors" @@ -15,15 +16,16 @@ type Geo struct { } var SampleConfig = ` - ## The name of the lat and lon fields containing WGS-84 latitude and longitude in decimal degrees - lat_field = "lat" - lon_field = "lon" + ## The name of the lat and lon fields containing WGS-84 latitude and + ## longitude in decimal degrees. + # lat_field = "lat" + # lon_field = "lon" ## 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 = 9 + # cell_level = 9 ` func (g *Geo) SampleConfig() string { @@ -31,7 +33,7 @@ func (g *Geo) SampleConfig() 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 { diff --git a/plugins/processors/s2_geo/geo_test.go b/plugins/processors/s2geo/s2geo_test.go similarity index 100% rename from plugins/processors/s2_geo/geo_test.go rename to plugins/processors/s2geo/s2geo_test.go