diff --git a/.gitignore b/.gitignore index 459ae7d79..66a7c7c0a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -build +/build /telegraf /telegraf.gz -*~ -*# diff --git a/Godeps b/Godeps index 7af083c8c..1b1b4be37 100644 --- a/Godeps +++ b/Godeps @@ -73,8 +73,8 @@ github.com/Sirupsen/logrus 61e43dc76f7ee59a82bdf3d71033dc12bea4c77d github.com/soniah/gosnmp 5ad50dc75ab389f8a1c9f8a67d3a1cd85f67ed15 github.com/StackExchange/wmi f3e2bae1e0cb5aef83e319133eabfee30013a4a5 github.com/streadway/amqp 63795daa9a446c920826655f26ba31c81c860fd6 -github.com/stretchr/objx 1a9d0bb9f541897e62256577b352fdbc1fb4fd94 -github.com/stretchr/testify 4d4bfba8f1d1027c4fdbe371823030df51419987 +github.com/stretchr/objx facf9a85c22f48d2f52f2380e4efce1768749a89 +github.com/stretchr/testify 12b6f73e6084dad08a7c6e575284b177ecafbc71 github.com/tidwall/gjson 0623bd8fbdbf97cc62b98d15108832851a658e59 github.com/tidwall/match 173748da739a410c5b0b813b956f89ff94730b4c github.com/vjeantet/grok d73e972b60935c7fec0b4ffbc904ed39ecaf7efe diff --git a/Makefile b/Makefile index 3250e69ed..3e4b4f019 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ VERSION := $(shell git describe --exact-match --tags 2>/dev/null) BRANCH := $(shell git rev-parse --abbrev-ref HEAD) COMMIT := $(shell git rev-parse --short HEAD) GOFILES ?= $(shell git ls-files '*.go') -GOFMT ?= $(shell gofmt -l $(GOFILES)) +GOFMT ?= $(shell gofmt -l $(filter-out plugins/parsers/influx/machine.go, $(GOFILES))) ifdef GOBIN PATH := $(GOBIN):$(PATH) @@ -48,7 +48,7 @@ test: go test -short ./... fmt: - @gofmt -w $(GOFILES) + @gofmt -w $(filter-out plugins/parsers/influx/machine.go, $(GOFILES)) fmtcheck: @echo '[INFO] running gofmt to identify incorrectly formatted code...' @@ -73,8 +73,8 @@ test-windows: # vet runs the Go source code static analysis tool `vet` to find # any common errors. vet: - @echo 'go vet $$(go list ./...)' - @go vet $$(go list ./...) ; if [ $$? -eq 1 ]; then \ + @echo 'go vet $$(go list ./... | grep -v ./plugins/parsers/influx)' + @go vet $$(go list ./... | grep -v ./plugins/parsers/influx) ; if [ $$? -eq 1 ]; then \ echo ""; \ echo "go vet has found suspicious constructs. Please remediate any reported errors"; \ echo "to fix them before submitting code for review."; \ @@ -96,4 +96,7 @@ docker-image: cp build/telegraf*$(COMMIT)*.deb . docker build -f scripts/dev.docker --build-arg "package=telegraf*$(COMMIT)*.deb" -t "telegraf-dev:$(COMMIT)" . +plugins/parsers/influx/machine.go: plugins/parsers/influx/machine.go.rl + ragel -Z -G2 $^ -o $@ + .PHONY: deps telegraf install test test-windows lint vet test-all package clean docker-image fmtcheck diff --git a/agent/accumulator_test.go b/agent/accumulator_test.go index c3f552d9e..22fa3e409 100644 --- a/agent/accumulator_test.go +++ b/agent/accumulator_test.go @@ -15,63 +15,36 @@ import ( "github.com/stretchr/testify/require" ) -func TestAdd(t *testing.T) { - now := time.Now() - metrics := make(chan telegraf.Metric, 10) - defer close(metrics) - a := NewAccumulator(&TestMetricMaker{}, metrics) - - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{}) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - - testm := <-metrics - actual := testm.String() - assert.Contains(t, actual, "acctest value=101") - - testm = <-metrics - actual = testm.String() - assert.Contains(t, actual, "acctest,acc=test value=101") - - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", now.UnixNano()), - actual) -} - func TestAddFields(t *testing.T) { - now := time.Now() metrics := make(chan telegraf.Metric, 10) defer close(metrics) a := NewAccumulator(&TestMetricMaker{}, metrics) + tags := map[string]string{"foo": "bar"} fields := map[string]interface{}{ "usage": float64(99), } - a.AddFields("acctest", fields, map[string]string{}) - a.AddGauge("acctest", fields, map[string]string{"acc": "test"}) - a.AddCounter("acctest", fields, map[string]string{"acc": "test"}, now) + now := time.Now() + a.AddCounter("acctest", fields, tags, now) testm := <-metrics - actual := testm.String() - assert.Contains(t, actual, "acctest usage=99") - testm = <-metrics - actual = testm.String() - assert.Contains(t, actual, "acctest,acc=test usage=99") + require.Equal(t, "acctest", testm.Name()) + actual, ok := testm.GetField("usage") - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test usage=99 %d\n", now.UnixNano()), - actual) + require.True(t, ok) + require.Equal(t, float64(99), actual) + + actual, ok = testm.GetTag("foo") + require.True(t, ok) + require.Equal(t, "bar", actual) + + tm := testm.Time() + // okay if monotonic clock differs + require.True(t, now.Equal(tm)) + + tp := testm.Type() + require.Equal(t, telegraf.Counter, tp) } func TestAccAddError(t *testing.T) { @@ -98,215 +71,61 @@ func TestAccAddError(t *testing.T) { assert.Contains(t, string(errs[2]), "baz") } -func TestAddNoIntervalWithPrecision(t *testing.T) { - now := time.Date(2006, time.February, 10, 12, 0, 0, 82912748, time.UTC) - metrics := make(chan telegraf.Metric, 10) - defer close(metrics) - a := NewAccumulator(&TestMetricMaker{}, metrics) - a.SetPrecision(0, time.Second) +func TestSetPrecision(t *testing.T) { + tests := []struct { + name string + unset bool + precision time.Duration + interval time.Duration + timestamp time.Time + expected time.Time + }{ + { + name: "default precision is nanosecond", + unset: true, + timestamp: time.Date(2006, time.February, 10, 12, 0, 0, 82912748, time.UTC), + expected: time.Date(2006, time.February, 10, 12, 0, 0, 82912748, time.UTC), + }, + { + name: "second interval", + interval: time.Second, + timestamp: time.Date(2006, time.February, 10, 12, 0, 0, 82912748, time.UTC), + expected: time.Date(2006, time.February, 10, 12, 0, 0, 0, time.UTC), + }, + { + name: "microsecond interval", + interval: time.Microsecond, + timestamp: time.Date(2006, time.February, 10, 12, 0, 0, 82912748, time.UTC), + expected: time.Date(2006, time.February, 10, 12, 0, 0, 82913000, time.UTC), + }, + { + name: "2 second precision", + precision: 2 * time.Second, + timestamp: time.Date(2006, time.February, 10, 12, 0, 2, 4, time.UTC), + expected: time.Date(2006, time.February, 10, 12, 0, 2, 0, time.UTC), + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + metrics := make(chan telegraf.Metric, 10) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{}) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) + a := NewAccumulator(&TestMetricMaker{}, metrics) + if !tt.unset { + a.SetPrecision(tt.precision, tt.interval) + } - testm := <-metrics - actual := testm.String() - assert.Contains(t, actual, "acctest value=101") + a.AddFields("acctest", + map[string]interface{}{"value": float64(101)}, + map[string]string{}, + tt.timestamp, + ) - testm = <-metrics - actual = testm.String() - assert.Contains(t, actual, "acctest,acc=test value=101") + testm := <-metrics + require.Equal(t, tt.expected, testm.Time()) - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800000000000)), - actual) -} - -func TestAddDisablePrecision(t *testing.T) { - now := time.Date(2006, time.February, 10, 12, 0, 0, 82912748, time.UTC) - metrics := make(chan telegraf.Metric, 10) - defer close(metrics) - a := NewAccumulator(&TestMetricMaker{}, metrics) - - a.SetPrecision(time.Nanosecond, 0) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{}) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - - testm := <-metrics - actual := testm.String() - assert.Contains(t, actual, "acctest value=101") - - testm = <-metrics - actual = testm.String() - assert.Contains(t, actual, "acctest,acc=test value=101") - - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800082912748)), - actual) -} - -func TestAddNoPrecisionWithInterval(t *testing.T) { - now := time.Date(2006, time.February, 10, 12, 0, 0, 82912748, time.UTC) - metrics := make(chan telegraf.Metric, 10) - defer close(metrics) - a := NewAccumulator(&TestMetricMaker{}, metrics) - - a.SetPrecision(0, time.Second) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{}) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - - testm := <-metrics - actual := testm.String() - assert.Contains(t, actual, "acctest value=101") - - testm = <-metrics - actual = testm.String() - assert.Contains(t, actual, "acctest,acc=test value=101") - - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800000000000)), - actual) -} - -func TestDifferentPrecisions(t *testing.T) { - now := time.Date(2006, time.February, 10, 12, 0, 0, 82912748, time.UTC) - metrics := make(chan telegraf.Metric, 10) - defer close(metrics) - a := NewAccumulator(&TestMetricMaker{}, metrics) - - a.SetPrecision(0, time.Second) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - testm := <-metrics - actual := testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800000000000)), - actual) - - a.SetPrecision(0, time.Millisecond) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800083000000)), - actual) - - a.SetPrecision(0, time.Microsecond) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800082913000)), - actual) - - a.SetPrecision(0, time.Nanosecond) - a.AddFields("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", int64(1139572800082912748)), - actual) -} - -func TestAddGauge(t *testing.T) { - now := time.Now() - metrics := make(chan telegraf.Metric, 10) - defer close(metrics) - a := NewAccumulator(&TestMetricMaker{}, metrics) - - a.AddGauge("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{}) - a.AddGauge("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}) - a.AddGauge("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - - testm := <-metrics - actual := testm.String() - assert.Contains(t, actual, "acctest value=101") - assert.Equal(t, testm.Type(), telegraf.Gauge) - - testm = <-metrics - actual = testm.String() - assert.Contains(t, actual, "acctest,acc=test value=101") - assert.Equal(t, testm.Type(), telegraf.Gauge) - - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", now.UnixNano()), - actual) - assert.Equal(t, testm.Type(), telegraf.Gauge) -} - -func TestAddCounter(t *testing.T) { - now := time.Now() - metrics := make(chan telegraf.Metric, 10) - defer close(metrics) - a := NewAccumulator(&TestMetricMaker{}, metrics) - - a.AddCounter("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{}) - a.AddCounter("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}) - a.AddCounter("acctest", - map[string]interface{}{"value": float64(101)}, - map[string]string{"acc": "test"}, now) - - testm := <-metrics - actual := testm.String() - assert.Contains(t, actual, "acctest value=101") - assert.Equal(t, testm.Type(), telegraf.Counter) - - testm = <-metrics - actual = testm.String() - assert.Contains(t, actual, "acctest,acc=test value=101") - assert.Equal(t, testm.Type(), telegraf.Counter) - - testm = <-metrics - actual = testm.String() - assert.Equal(t, - fmt.Sprintf("acctest,acc=test value=101 %d\n", now.UnixNano()), - actual) - assert.Equal(t, testm.Type(), telegraf.Counter) + close(metrics) + }) + } } type TestMetricMaker struct { diff --git a/agent/agent.go b/agent/agent.go index 5ca3de882..2183ba42c 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -271,11 +271,9 @@ func (a *Agent) flusher(shutdown chan struct{}, metricC chan telegraf.Metric, ag // if dropOriginal is set to true, then we will only send this // metric to the aggregators, not the outputs. var dropOriginal bool - if !m.IsAggregate() { - for _, agg := range a.Config.Aggregators { - if ok := agg.Add(m.Copy()); ok { - dropOriginal = true - } + for _, agg := range a.Config.Aggregators { + if ok := agg.Add(m.Copy()); ok { + dropOriginal = true } } if !dropOriginal { diff --git a/internal/config/config.go b/internal/config/config.go index 8488df28a..db1e1f82b 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -9,6 +9,7 @@ import ( "math" "os" "path/filepath" + "regexp" "runtime" "sort" @@ -1366,6 +1367,30 @@ func buildSerializer(name string, tbl *ast.Table) (serializers.Serializer, error } } + if node, ok := tbl.Fields["influx_max_line_bytes"]; ok { + if kv, ok := node.(*ast.KeyValue); ok { + if integer, ok := kv.Value.(*ast.Integer); ok { + v, err := integer.Int() + if err != nil { + return nil, err + } + c.InfluxMaxLineBytes = int(v) + } + } + } + + if node, ok := tbl.Fields["influx_sort_fields"]; ok { + if kv, ok := node.(*ast.KeyValue); ok { + if b, ok := kv.Value.(*ast.Boolean); ok { + var err error + c.InfluxSortFields, err = b.Boolean() + if err != nil { + return nil, err + } + } + } + } + if node, ok := tbl.Fields["json_timestamp_units"]; ok { if kv, ok := node.(*ast.KeyValue); ok { if str, ok := kv.Value.(*ast.String); ok { @@ -1382,6 +1407,8 @@ func buildSerializer(name string, tbl *ast.Table) (serializers.Serializer, error } } + delete(tbl.Fields, "influx_max_line_bytes") + delete(tbl.Fields, "influx_sort_fields") delete(tbl.Fields, "data_format") delete(tbl.Fields, "prefix") delete(tbl.Fields, "template") diff --git a/internal/models/makemetric.go b/internal/models/makemetric.go index 19d10f589..b74e236cd 100644 --- a/internal/models/makemetric.go +++ b/internal/models/makemetric.go @@ -2,8 +2,6 @@ package models import ( "log" - "math" - "strings" "time" "github.com/influxdata/telegraf" @@ -78,84 +76,6 @@ func makemetric( } } - for k, v := range tags { - if strings.HasSuffix(k, `\`) { - log.Printf("D! Measurement [%s] tag [%s] "+ - "ends with a backslash, skipping", measurement, k) - delete(tags, k) - continue - } else if strings.HasSuffix(v, `\`) { - log.Printf("D! Measurement [%s] tag [%s] has a value "+ - "ending with a backslash, skipping", measurement, k) - delete(tags, k) - continue - } - } - - for k, v := range fields { - if strings.HasSuffix(k, `\`) { - log.Printf("D! Measurement [%s] field [%s] "+ - "ends with a backslash, skipping", measurement, k) - delete(fields, k) - continue - } - // Validate uint64 and float64 fields - // convert all int & uint types to int64 - switch val := v.(type) { - case nil: - // delete nil fields - delete(fields, k) - case uint: - fields[k] = int64(val) - continue - case uint8: - fields[k] = int64(val) - continue - case uint16: - fields[k] = int64(val) - continue - case uint32: - fields[k] = int64(val) - continue - case int: - fields[k] = int64(val) - continue - case int8: - fields[k] = int64(val) - continue - case int16: - fields[k] = int64(val) - continue - case int32: - fields[k] = int64(val) - continue - case uint64: - // InfluxDB does not support writing uint64 - if val < uint64(9223372036854775808) { - fields[k] = int64(val) - } else { - fields[k] = int64(9223372036854775807) - } - continue - case float32: - fields[k] = float64(val) - continue - case float64: - // NaNs are invalid values in influxdb, skip measurement - if math.IsNaN(val) || math.IsInf(val, 0) { - log.Printf("D! Measurement [%s] field [%s] has a NaN or Inf "+ - "field, skipping", - measurement, k) - delete(fields, k) - continue - } - case string: - fields[k] = v - default: - fields[k] = v - } - } - m, err := metric.New(measurement, tags, fields, t, mType) if err != nil { log.Printf("Error adding point [%s]: %s\n", measurement, err.Error()) diff --git a/internal/models/running_aggregator_test.go b/internal/models/running_aggregator_test.go index 30279f0ee..cf92fe675 100644 --- a/internal/models/running_aggregator_test.go +++ b/internal/models/running_aggregator_test.go @@ -1,7 +1,6 @@ package models import ( - "fmt" "sync" "sync/atomic" "testing" @@ -167,69 +166,6 @@ func TestAddDropOriginal(t *testing.T) { assert.False(t, ra.Add(m2)) } -// make an untyped, counter, & gauge metric -func TestMakeMetricA(t *testing.T) { - now := time.Now() - ra := NewRunningAggregator(&TestAggregator{}, &AggregatorConfig{ - Name: "TestRunningAggregator", - }) - assert.Equal(t, "aggregators.TestRunningAggregator", ra.Name()) - - m := ra.MakeMetric( - "RITest", - map[string]interface{}{"value": int(101)}, - map[string]string{}, - telegraf.Untyped, - now, - ) - assert.Equal( - t, - fmt.Sprintf("RITest value=101i %d\n", now.UnixNano()), - m.String(), - ) - assert.Equal( - t, - m.Type(), - telegraf.Untyped, - ) - - m = ra.MakeMetric( - "RITest", - map[string]interface{}{"value": int(101)}, - map[string]string{}, - telegraf.Counter, - now, - ) - assert.Equal( - t, - fmt.Sprintf("RITest value=101i %d\n", now.UnixNano()), - m.String(), - ) - assert.Equal( - t, - m.Type(), - telegraf.Counter, - ) - - m = ra.MakeMetric( - "RITest", - map[string]interface{}{"value": int(101)}, - map[string]string{}, - telegraf.Gauge, - now, - ) - assert.Equal( - t, - fmt.Sprintf("RITest value=101i %d\n", now.UnixNano()), - m.String(), - ) - assert.Equal( - t, - m.Type(), - telegraf.Gauge, - ) -} - type TestAggregator struct { sum int64 } diff --git a/internal/models/running_input.go b/internal/models/running_input.go index e9b757bbf..9cf4f6136 100644 --- a/internal/models/running_input.go +++ b/internal/models/running_input.go @@ -5,6 +5,7 @@ import ( "time" "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/plugins/serializers/influx" "github.com/influxdata/telegraf/selfstat" ) @@ -75,7 +76,11 @@ func (r *RunningInput) MakeMetric( ) if r.trace && m != nil { - fmt.Print("> " + m.String()) + s := influx.NewSerializer() + octets, err := s.Serialize(m) + if err == nil { + fmt.Print("> " + string(octets)) + } } r.MetricsGathered.Incr(1) diff --git a/internal/models/running_input_test.go b/internal/models/running_input_test.go index c653090e8..4d016851a 100644 --- a/internal/models/running_input_test.go +++ b/internal/models/running_input_test.go @@ -1,12 +1,11 @@ package models import ( - "fmt" - "math" "testing" "time" "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/metric" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -45,77 +44,17 @@ func TestMakeMetricNilFields(t *testing.T) { telegraf.Untyped, now, ) - assert.Equal( - t, - fmt.Sprintf("RITest value=101i %d\n", now.UnixNano()), - m.String(), - ) -} -// make an untyped, counter, & gauge metric -func TestMakeMetric(t *testing.T) { - now := time.Now() - ri := NewRunningInput(&testInput{}, &InputConfig{ - Name: "TestRunningInput", - }) - - ri.SetTrace(true) - assert.Equal(t, true, ri.Trace()) - assert.Equal(t, "inputs.TestRunningInput", ri.Name()) - - m := ri.MakeMetric( - "RITest", - map[string]interface{}{"value": int(101)}, + expected, err := metric.New("RITest", map[string]string{}, - telegraf.Untyped, + map[string]interface{}{ + "value": int(101), + }, now, ) - assert.Equal( - t, - fmt.Sprintf("RITest value=101i %d\n", now.UnixNano()), - m.String(), - ) - assert.Equal( - t, - m.Type(), - telegraf.Untyped, - ) + require.NoError(t, err) - m = ri.MakeMetric( - "RITest", - map[string]interface{}{"value": int(101)}, - map[string]string{}, - telegraf.Counter, - now, - ) - assert.Equal( - t, - fmt.Sprintf("RITest value=101i %d\n", now.UnixNano()), - m.String(), - ) - assert.Equal( - t, - m.Type(), - telegraf.Counter, - ) - - m = ri.MakeMetric( - "RITest", - map[string]interface{}{"value": int(101)}, - map[string]string{}, - telegraf.Gauge, - now, - ) - assert.Equal( - t, - fmt.Sprintf("RITest value=101i %d\n", now.UnixNano()), - m.String(), - ) - assert.Equal( - t, - m.Type(), - telegraf.Gauge, - ) + require.Equal(t, expected, m) } func TestMakeMetricWithPluginTags(t *testing.T) { @@ -137,11 +76,18 @@ func TestMakeMetricWithPluginTags(t *testing.T) { telegraf.Untyped, now, ) - assert.Equal( - t, - fmt.Sprintf("RITest,foo=bar value=101i %d\n", now.UnixNano()), - m.String(), + + expected, err := metric.New("RITest", + map[string]string{ + "foo": "bar", + }, + map[string]interface{}{ + "value": 101, + }, + now, ) + require.NoError(t, err) + require.Equal(t, expected, m) } func TestMakeMetricFilteredOut(t *testing.T) { @@ -187,87 +133,17 @@ func TestMakeMetricWithDaemonTags(t *testing.T) { telegraf.Untyped, now, ) - assert.Equal( - t, - fmt.Sprintf("RITest,foo=bar value=101i %d\n", now.UnixNano()), - m.String(), - ) -} - -// make an untyped, counter, & gauge metric -func TestMakeMetricInfFields(t *testing.T) { - inf := math.Inf(1) - ninf := math.Inf(-1) - now := time.Now() - ri := NewRunningInput(&testInput{}, &InputConfig{ - Name: "TestRunningInput", - }) - - ri.SetTrace(true) - assert.Equal(t, true, ri.Trace()) - - m := ri.MakeMetric( - "RITest", - map[string]interface{}{ - "value": int(101), - "inf": inf, - "ninf": ninf, + expected, err := metric.New("RITest", + map[string]string{ + "foo": "bar", + }, + map[string]interface{}{ + "value": 101, }, - map[string]string{}, - telegraf.Untyped, now, ) - assert.Equal( - t, - fmt.Sprintf("RITest value=101i %d\n", now.UnixNano()), - m.String(), - ) -} - -func TestMakeMetricAllFieldTypes(t *testing.T) { - now := time.Now() - ri := NewRunningInput(&testInput{}, &InputConfig{ - Name: "TestRunningInput", - }) - - ri.SetTrace(true) - assert.Equal(t, true, ri.Trace()) - - m := ri.MakeMetric( - "RITest", - map[string]interface{}{ - "a": int(10), - "b": int8(10), - "c": int16(10), - "d": int32(10), - "e": uint(10), - "f": uint8(10), - "g": uint16(10), - "h": uint32(10), - "i": uint64(10), - "j": float32(10), - "k": uint64(9223372036854775810), - "l": "foobar", - "m": true, - }, - map[string]string{}, - telegraf.Untyped, - now, - ) - assert.Contains(t, m.String(), "a=10i") - assert.Contains(t, m.String(), "b=10i") - assert.Contains(t, m.String(), "c=10i") - assert.Contains(t, m.String(), "d=10i") - assert.Contains(t, m.String(), "e=10i") - assert.Contains(t, m.String(), "f=10i") - assert.Contains(t, m.String(), "g=10i") - assert.Contains(t, m.String(), "h=10i") - assert.Contains(t, m.String(), "i=10i") - assert.Contains(t, m.String(), "j=10") - assert.NotContains(t, m.String(), "j=10i") - assert.Contains(t, m.String(), "k=9223372036854775807i") - assert.Contains(t, m.String(), "l=\"foobar\"") - assert.Contains(t, m.String(), "m=true") + require.NoError(t, err) + require.Equal(t, expected, m) } func TestMakeMetricNameOverride(t *testing.T) { @@ -284,11 +160,15 @@ func TestMakeMetricNameOverride(t *testing.T) { telegraf.Untyped, now, ) - assert.Equal( - t, - fmt.Sprintf("foobar value=101i %d\n", now.UnixNano()), - m.String(), + expected, err := metric.New("foobar", + nil, + map[string]interface{}{ + "value": 101, + }, + now, ) + require.NoError(t, err) + require.Equal(t, expected, m) } func TestMakeMetricNamePrefix(t *testing.T) { @@ -305,11 +185,15 @@ func TestMakeMetricNamePrefix(t *testing.T) { telegraf.Untyped, now, ) - assert.Equal( - t, - fmt.Sprintf("foobar_RITest value=101i %d\n", now.UnixNano()), - m.String(), + expected, err := metric.New("foobar_RITest", + nil, + map[string]interface{}{ + "value": 101, + }, + now, ) + require.NoError(t, err) + require.Equal(t, expected, m) } func TestMakeMetricNameSuffix(t *testing.T) { @@ -326,134 +210,15 @@ func TestMakeMetricNameSuffix(t *testing.T) { telegraf.Untyped, now, ) - assert.Equal( - t, - fmt.Sprintf("RITest_foobar value=101i %d\n", now.UnixNano()), - m.String(), + expected, err := metric.New("RITest_foobar", + nil, + map[string]interface{}{ + "value": 101, + }, + now, ) -} - -func TestMakeMetric_TrailingSlash(t *testing.T) { - now := time.Now() - - tests := []struct { - name string - measurement string - fields map[string]interface{} - tags map[string]string - expectedNil bool - expectedMeasurement string - expectedFields map[string]interface{} - expectedTags map[string]string - }{ - { - name: "Measurement cannot have trailing slash", - measurement: `cpu\`, - fields: map[string]interface{}{ - "value": int64(42), - }, - tags: map[string]string{}, - expectedNil: true, - }, - { - name: "Field key with trailing slash dropped", - measurement: `cpu`, - fields: map[string]interface{}{ - "value": int64(42), - `bad\`: `xyzzy`, - }, - tags: map[string]string{}, - expectedMeasurement: `cpu`, - expectedFields: map[string]interface{}{ - "value": int64(42), - }, - expectedTags: map[string]string{}, - }, - { - name: "Field value with trailing slash okay", - measurement: `cpu`, - fields: map[string]interface{}{ - "value": int64(42), - "ok": `xyzzy\`, - }, - tags: map[string]string{}, - expectedMeasurement: `cpu`, - expectedFields: map[string]interface{}{ - "value": int64(42), - "ok": `xyzzy\`, - }, - expectedTags: map[string]string{}, - }, - { - name: "Must have one field after dropped", - measurement: `cpu`, - fields: map[string]interface{}{ - "bad": math.NaN(), - }, - tags: map[string]string{}, - expectedNil: true, - }, - { - name: "Tag key with trailing slash dropped", - measurement: `cpu`, - fields: map[string]interface{}{ - "value": int64(42), - }, - tags: map[string]string{ - `host\`: "localhost", - "a": "x", - }, - expectedMeasurement: `cpu`, - expectedFields: map[string]interface{}{ - "value": int64(42), - }, - expectedTags: map[string]string{ - "a": "x", - }, - }, - { - name: "Tag value with trailing slash dropped", - measurement: `cpu`, - fields: map[string]interface{}{ - "value": int64(42), - }, - tags: map[string]string{ - `host`: `localhost\`, - "a": "x", - }, - expectedMeasurement: `cpu`, - expectedFields: map[string]interface{}{ - "value": int64(42), - }, - expectedTags: map[string]string{ - "a": "x", - }, - }, - } - - ri := NewRunningInput(&testInput{}, &InputConfig{ - Name: "TestRunningInput", - }) - - for _, tc := range tests { - t.Run(tc.name, func(t *testing.T) { - m := ri.MakeMetric( - tc.measurement, - tc.fields, - tc.tags, - telegraf.Untyped, - now) - - if tc.expectedNil { - require.Nil(t, m) - } else { - require.NotNil(t, m) - require.Equal(t, tc.expectedMeasurement, m.Name()) - require.Equal(t, tc.expectedFields, m.Fields()) - require.Equal(t, tc.expectedTags, m.Tags()) - } - }) - } + require.NoError(t, err) + require.Equal(t, expected, m) } type testInput struct{} diff --git a/metric.go b/metric.go index 3fb531358..970477403 100644 --- a/metric.go +++ b/metric.go @@ -17,48 +17,50 @@ const ( Histogram ) +type Tag struct { + Key string + Value string +} + +type Field struct { + Key string + Value interface{} +} + type Metric interface { - // Serialize serializes the metric into a line-protocol byte buffer, - // including a newline at the end. - Serialize() []byte - // same as Serialize, but avoids an allocation. - // returns number of bytes copied into dst. - SerializeTo(dst []byte) int - // String is the same as Serialize, but returns a string. - String() string - // Copy deep-copies the metric. - Copy() Metric - // Split will attempt to return multiple metrics with the same timestamp - // whose string representations are no longer than maxSize. - // Metrics with a single field may exceed the requested size. - Split(maxSize int) []Metric + // Getting data structure functions + Name() string + Tags() map[string]string + TagList() []*Tag + Fields() map[string]interface{} + FieldList() []*Field + Time() time.Time + Type() ValueType + + // Name functions + SetName(name string) + AddPrefix(prefix string) + AddSuffix(suffix string) // Tag functions + GetTag(key string) (string, bool) HasTag(key string) bool AddTag(key, value string) RemoveTag(key string) // Field functions + GetField(key string) (interface{}, bool) HasField(key string) bool AddField(key string, value interface{}) - RemoveField(key string) error + RemoveField(key string) - // Name functions - SetName(name string) - SetPrefix(prefix string) - SetSuffix(suffix string) - - // Getting data structure functions - Name() string - Tags() map[string]string - Fields() map[string]interface{} - Time() time.Time - UnixNano() int64 - Type() ValueType - Len() int // returns the length of the serialized metric, including newline + // HashID returns an unique identifier for the series. HashID() uint64 - // aggregator things: + // Copy returns a deep copy of the Metric. + Copy() Metric + + // Mark Metric as an aggregate SetAggregate(bool) IsAggregate() bool } diff --git a/metric/builder.go b/metric/builder.go new file mode 100644 index 000000000..d80f566fb --- /dev/null +++ b/metric/builder.go @@ -0,0 +1,51 @@ +package metric + +import ( + "time" + + "github.com/influxdata/telegraf" +) + +type TimeFunc func() time.Time + +type Builder struct { + TimeFunc + + *metric +} + +func NewBuilder() *Builder { + b := &Builder{ + TimeFunc: time.Now, + } + b.Reset() + return b +} + +func (b *Builder) SetName(name string) { + b.name = name +} + +func (b *Builder) AddTag(key string, value string) { + b.metric.AddTag(key, value) +} + +func (b *Builder) AddField(key string, value interface{}) { + b.metric.AddField(key, value) +} + +func (b *Builder) SetTime(tm time.Time) { + b.tm = tm +} + +func (b *Builder) Reset() { + b.metric = &metric{} +} + +func (b *Builder) Metric() (telegraf.Metric, error) { + if b.tm.IsZero() { + b.tm = b.TimeFunc() + } + + return b.metric, nil +} diff --git a/metric/escape.go b/metric/escape.go deleted file mode 100644 index cb040b7f2..000000000 --- a/metric/escape.go +++ /dev/null @@ -1,55 +0,0 @@ -package metric - -import ( - "strings" -) - -var ( - // escaper is for escaping: - // - tag keys - // - tag values - // - field keys - // see https://docs.influxdata.com/influxdb/v1.0/write_protocols/line_protocol_tutorial/#special-characters-and-keywords - escaper = strings.NewReplacer(`,`, `\,`, `"`, `\"`, ` `, `\ `, `=`, `\=`) - unEscaper = strings.NewReplacer(`\,`, `,`, `\"`, `"`, `\ `, ` `, `\=`, `=`) - - // nameEscaper is for escaping measurement names only. - // see https://docs.influxdata.com/influxdb/v1.0/write_protocols/line_protocol_tutorial/#special-characters-and-keywords - nameEscaper = strings.NewReplacer(`,`, `\,`, ` `, `\ `) - nameUnEscaper = strings.NewReplacer(`\,`, `,`, `\ `, ` `) - - // stringFieldEscaper is for escaping string field values only. - // see https://docs.influxdata.com/influxdb/v1.0/write_protocols/line_protocol_tutorial/#special-characters-and-keywords - stringFieldEscaper = strings.NewReplacer( - `"`, `\"`, - `\`, `\\`, - ) - stringFieldUnEscaper = strings.NewReplacer( - `\"`, `"`, - `\\`, `\`, - ) -) - -func escape(s string, t string) string { - switch t { - case "fieldkey", "tagkey", "tagval": - return escaper.Replace(s) - case "name": - return nameEscaper.Replace(s) - case "fieldval": - return stringFieldEscaper.Replace(s) - } - return s -} - -func unescape(s string, t string) string { - switch t { - case "fieldkey", "tagkey", "tagval": - return unEscaper.Replace(s) - case "name": - return nameUnEscaper.Replace(s) - case "fieldval": - return stringFieldUnEscaper.Replace(s) - } - return s -} diff --git a/metric/inline_strconv_parse_test.go b/metric/inline_strconv_parse_test.go deleted file mode 100644 index 2998d4c27..000000000 --- a/metric/inline_strconv_parse_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package metric - -import ( - "strconv" - "testing" - "testing/quick" -) - -func TestParseIntBytesEquivalenceFuzz(t *testing.T) { - f := func(b []byte, base int, bitSize int) bool { - exp, expErr := strconv.ParseInt(string(b), base, bitSize) - got, gotErr := parseIntBytes(b, base, bitSize) - - return exp == got && checkErrs(expErr, gotErr) - } - - cfg := &quick.Config{ - MaxCount: 10000, - } - - if err := quick.Check(f, cfg); err != nil { - t.Fatal(err) - } -} - -func TestParseIntBytesValid64bitBase10EquivalenceFuzz(t *testing.T) { - buf := []byte{} - f := func(n int64) bool { - buf = strconv.AppendInt(buf[:0], n, 10) - - exp, expErr := strconv.ParseInt(string(buf), 10, 64) - got, gotErr := parseIntBytes(buf, 10, 64) - - return exp == got && checkErrs(expErr, gotErr) - } - - cfg := &quick.Config{ - MaxCount: 10000, - } - - if err := quick.Check(f, cfg); err != nil { - t.Fatal(err) - } -} - -func TestParseFloatBytesEquivalenceFuzz(t *testing.T) { - f := func(b []byte, bitSize int) bool { - exp, expErr := strconv.ParseFloat(string(b), bitSize) - got, gotErr := parseFloatBytes(b, bitSize) - - return exp == got && checkErrs(expErr, gotErr) - } - - cfg := &quick.Config{ - MaxCount: 10000, - } - - if err := quick.Check(f, cfg); err != nil { - t.Fatal(err) - } -} - -func TestParseFloatBytesValid64bitEquivalenceFuzz(t *testing.T) { - buf := []byte{} - f := func(n float64) bool { - buf = strconv.AppendFloat(buf[:0], n, 'f', -1, 64) - - exp, expErr := strconv.ParseFloat(string(buf), 64) - got, gotErr := parseFloatBytes(buf, 64) - - return exp == got && checkErrs(expErr, gotErr) - } - - cfg := &quick.Config{ - MaxCount: 10000, - } - - if err := quick.Check(f, cfg); err != nil { - t.Fatal(err) - } -} - -func TestParseBoolBytesEquivalence(t *testing.T) { - var buf []byte - for _, s := range []string{"1", "t", "T", "TRUE", "true", "True", "0", "f", "F", "FALSE", "false", "False", "fail", "TrUe", "FAlSE", "numbers", ""} { - buf = append(buf[:0], s...) - - exp, expErr := strconv.ParseBool(s) - got, gotErr := parseBoolBytes(buf) - - if got != exp || !checkErrs(expErr, gotErr) { - t.Errorf("Failed to parse boolean value %q correctly: wanted (%t, %v), got (%t, %v)", s, exp, expErr, got, gotErr) - } - } -} - -func checkErrs(a, b error) bool { - if (a == nil) != (b == nil) { - return false - } - - return a == nil || a.Error() == b.Error() -} diff --git a/metric/metric.go b/metric/metric.go index e46cfd189..06e705a66 100644 --- a/metric/metric.go +++ b/metric/metric.go @@ -1,12 +1,9 @@ package metric import ( - "bytes" "fmt" "hash/fnv" "sort" - "strconv" - "strings" "time" "github.com/influxdata/telegraf" @@ -14,610 +11,282 @@ import ( const MaxInt = int(^uint(0) >> 1) +type metric struct { + name string + tags []*telegraf.Tag + fields []*telegraf.Field + tm time.Time + + tp telegraf.ValueType + aggregate bool +} + func New( name string, tags map[string]string, fields map[string]interface{}, - t time.Time, - mType ...telegraf.ValueType, + tm time.Time, + tp ...telegraf.ValueType, ) (telegraf.Metric, error) { - if len(name) == 0 { - return nil, fmt.Errorf("missing measurement name") - } - if len(fields) == 0 { - return nil, fmt.Errorf("%s: must have one or more fields", name) - } - if strings.HasSuffix(name, `\`) { - return nil, fmt.Errorf("%s: measurement name cannot end with a backslash", name) - } - - var thisType telegraf.ValueType - if len(mType) > 0 { - thisType = mType[0] + var vtype telegraf.ValueType + if len(tp) > 0 { + vtype = tp[0] } else { - thisType = telegraf.Untyped + vtype = telegraf.Untyped } m := &metric{ - name: []byte(escape(name, "name")), - t: []byte(fmt.Sprint(t.UnixNano())), - nsec: t.UnixNano(), - mType: thisType, + name: name, + tags: nil, + fields: nil, + tm: tm, + tp: vtype, } - // pre-allocate exact size of the tags slice - taglen := 0 - for k, v := range tags { - if strings.HasSuffix(k, `\`) { - return nil, fmt.Errorf("%s: tag key cannot end with a backslash: %s", name, k) + if len(tags) > 0 { + m.tags = make([]*telegraf.Tag, 0, len(tags)) + for k, v := range tags { + m.tags = append(m.tags, + &telegraf.Tag{Key: k, Value: v}) } - if strings.HasSuffix(v, `\`) { - return nil, fmt.Errorf("%s: tag value cannot end with a backslash: %s", name, v) - } - - if len(k) == 0 || len(v) == 0 { - continue - } - taglen += 2 + len(escape(k, "tagkey")) + len(escape(v, "tagval")) - } - m.tags = make([]byte, taglen) - - i := 0 - for k, v := range tags { - if len(k) == 0 || len(v) == 0 { - continue - } - m.tags[i] = ',' - i++ - i += copy(m.tags[i:], escape(k, "tagkey")) - m.tags[i] = '=' - i++ - i += copy(m.tags[i:], escape(v, "tagval")) + sort.Slice(m.tags, func(i, j int) bool { return m.tags[i].Key < m.tags[j].Key }) } - // pre-allocate capacity of the fields slice - fieldlen := 0 - for k, _ := range fields { - if strings.HasSuffix(k, `\`) { - return nil, fmt.Errorf("%s: field key cannot end with a backslash: %s", name, k) - } - - // 10 bytes is completely arbitrary, but will at least prevent some - // amount of allocations. There's a small possibility this will create - // slightly more allocations for a metric that has many short fields. - fieldlen += len(k) + 10 - } - m.fields = make([]byte, 0, fieldlen) - - i = 0 + m.fields = make([]*telegraf.Field, 0, len(fields)) for k, v := range fields { - if i != 0 { - m.fields = append(m.fields, ',') + v := convertField(v) + if v == nil { + continue } - m.fields = appendField(m.fields, k, v) - i++ + m.AddField(k, v) } return m, nil } -// indexUnescapedByte finds the index of the first byte equal to b in buf that -// is not escaped. Does not allow the escape char to be escaped. Returns -1 if -// not found. -func indexUnescapedByte(buf []byte, b byte) int { - var keyi int - for { - i := bytes.IndexByte(buf[keyi:], b) - if i == -1 { - return -1 - } else if i == 0 { - break - } - keyi += i - if buf[keyi-1] != '\\' { - break - } else { - keyi++ - } - } - return keyi -} - -// indexUnescapedByteBackslashEscaping finds the index of the first byte equal -// to b in buf that is not escaped. Allows for the escape char `\` to be -// escaped. Returns -1 if not found. -func indexUnescapedByteBackslashEscaping(buf []byte, b byte) int { - var keyi int - for { - i := bytes.IndexByte(buf[keyi:], b) - if i == -1 { - return -1 - } else if i == 0 { - break - } - keyi += i - if countBackslashes(buf, keyi-1)%2 == 0 { - break - } else { - keyi++ - } - } - return keyi -} - -// countBackslashes counts the number of preceding backslashes starting at -// the 'start' index. -func countBackslashes(buf []byte, index int) int { - var count int - for { - if index < 0 { - return count - } - if buf[index] == '\\' { - count++ - index-- - } else { - break - } - } - return count -} - -type metric struct { - name []byte - tags []byte - fields []byte - t []byte - - mType telegraf.ValueType - aggregate bool - - // cached values for reuse in "get" functions - hashID uint64 - nsec int64 -} - func (m *metric) String() string { - return string(m.name) + string(m.tags) + " " + string(m.fields) + " " + string(m.t) + "\n" + return fmt.Sprintf("%s %v %v %d", m.name, m.Tags(), m.Fields(), m.tm.UnixNano()) +} + +func (m *metric) Name() string { + return m.name +} + +func (m *metric) Tags() map[string]string { + tags := make(map[string]string, len(m.tags)) + for _, tag := range m.tags { + tags[tag.Key] = tag.Value + } + return tags +} + +func (m *metric) TagList() []*telegraf.Tag { + return m.tags +} + +func (m *metric) Fields() map[string]interface{} { + fields := make(map[string]interface{}, len(m.fields)) + for _, field := range m.fields { + fields[field.Key] = field.Value + } + + return fields +} + +func (m *metric) FieldList() []*telegraf.Field { + return m.fields +} + +func (m *metric) Time() time.Time { + return m.tm +} + +func (m *metric) Type() telegraf.ValueType { + return m.tp +} + +func (m *metric) SetName(name string) { + m.name = name +} + +func (m *metric) AddPrefix(prefix string) { + m.name = prefix + m.name +} + +func (m *metric) AddSuffix(suffix string) { + m.name = m.name + suffix +} + +func (m *metric) AddTag(key, value string) { + for i, tag := range m.tags { + if key > tag.Key { + continue + } + + if key == tag.Key { + tag.Value = value + } + + m.tags = append(m.tags, nil) + copy(m.tags[i+1:], m.tags[i:]) + m.tags[i] = &telegraf.Tag{Key: key, Value: value} + return + } + + m.tags = append(m.tags, &telegraf.Tag{Key: key, Value: value}) +} + +func (m *metric) HasTag(key string) bool { + for _, tag := range m.tags { + if tag.Key == key { + return true + } + } + return false +} + +func (m *metric) GetTag(key string) (string, bool) { + for _, tag := range m.tags { + if tag.Key == key { + return tag.Value, true + } + } + return "", false +} + +func (m *metric) RemoveTag(key string) { + for i, tag := range m.tags { + if tag.Key == key { + copy(m.tags[i:], m.tags[i+1:]) + m.tags[len(m.tags)-1] = nil + m.tags = m.tags[:len(m.tags)-1] + return + } + } +} + +func (m *metric) AddField(key string, value interface{}) { + for i, field := range m.fields { + if key == field.Key { + m.fields[i] = &telegraf.Field{Key: key, Value: convertField(value)} + } + } + m.fields = append(m.fields, &telegraf.Field{Key: key, Value: convertField(value)}) +} + +func (m *metric) HasField(key string) bool { + for _, field := range m.fields { + if field.Key == key { + return true + } + } + return false +} + +func (m *metric) GetField(key string) (interface{}, bool) { + for _, field := range m.fields { + if field.Key == key { + return field.Value, true + } + } + return nil, false +} + +func (m *metric) RemoveField(key string) { + for i, field := range m.fields { + if field.Key == key { + copy(m.fields[i:], m.fields[i+1:]) + m.fields[len(m.fields)-1] = nil + m.fields = m.fields[:len(m.fields)-1] + return + } + } +} + +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, + } + + for i, tag := range m.tags { + m2.tags[i] = tag + } + + for i, field := range m.fields { + m2.fields[i] = field + } + return m2 } func (m *metric) SetAggregate(b bool) { - m.aggregate = b + m.aggregate = true } func (m *metric) IsAggregate() bool { return m.aggregate } -func (m *metric) Type() telegraf.ValueType { - return m.mType -} - -func (m *metric) Len() int { - // 3 is for 2 spaces surrounding the fields array + newline at the end. - return len(m.name) + len(m.tags) + len(m.fields) + len(m.t) + 3 -} - -func (m *metric) Serialize() []byte { - tmp := make([]byte, m.Len()) - i := 0 - i += copy(tmp[i:], m.name) - i += copy(tmp[i:], m.tags) - tmp[i] = ' ' - i++ - i += copy(tmp[i:], m.fields) - tmp[i] = ' ' - i++ - i += copy(tmp[i:], m.t) - tmp[i] = '\n' - return tmp -} - -func (m *metric) SerializeTo(dst []byte) int { - i := 0 - if i >= len(dst) { - return i - } - - i += copy(dst[i:], m.name) - if i >= len(dst) { - return i - } - - i += copy(dst[i:], m.tags) - if i >= len(dst) { - return i - } - - dst[i] = ' ' - i++ - if i >= len(dst) { - return i - } - - i += copy(dst[i:], m.fields) - if i >= len(dst) { - return i - } - - dst[i] = ' ' - i++ - if i >= len(dst) { - return i - } - - i += copy(dst[i:], m.t) - if i >= len(dst) { - return i - } - dst[i] = '\n' - - return i + 1 -} - -func (m *metric) Split(maxSize int) []telegraf.Metric { - if m.Len() <= maxSize { - return []telegraf.Metric{m} - } - var out []telegraf.Metric - - // constant number of bytes for each metric (in addition to field bytes) - constant := len(m.name) + len(m.tags) + len(m.t) + 3 - // currently selected fields - fields := make([]byte, 0, maxSize) - - i := 0 - for { - if i >= len(m.fields) { - // hit the end of the field byte slice - if len(fields) > 0 { - out = append(out, copyWith(m.name, m.tags, fields, m.t)) - } - break - } - - // find the end of the next field - j := indexUnescapedByte(m.fields[i:], ',') - if j == -1 { - j = len(m.fields) - } else { - j += i - } - - // if true, then we need to create a metric _not_ including the currently - // selected field - if len(m.fields[i:j])+len(fields)+constant >= maxSize { - // if false, then we'll create a metric including the currently - // selected field anyways. This means that the given maxSize is too - // small for a single field to fit. - if len(fields) > 0 { - out = append(out, copyWith(m.name, m.tags, fields, m.t)) - } - - fields = make([]byte, 0, maxSize) - } - if len(fields) > 0 { - fields = append(fields, ',') - } - fields = append(fields, m.fields[i:j]...) - - i = j + 1 - } - return out -} - -func (m *metric) Fields() map[string]interface{} { - fieldMap := map[string]interface{}{} - i := 0 - for { - if i >= len(m.fields) { - break - } - // end index of field key - i1 := indexUnescapedByte(m.fields[i:], '=') - if i1 == -1 { - break - } - // start index of field value - i2 := i1 + 1 - - // end index of field value - var i3 int - if m.fields[i:][i2] == '"' { - i3 = indexUnescapedByteBackslashEscaping(m.fields[i:][i2+1:], '"') - if i3 == -1 { - i3 = len(m.fields[i:]) - } - i3 += i2 + 2 // increment index to the comma - } else { - i3 = indexUnescapedByte(m.fields[i:], ',') - if i3 == -1 { - i3 = len(m.fields[i:]) - } - } - - switch m.fields[i:][i2] { - case '"': - // string field - fieldMap[unescape(string(m.fields[i:][0:i1]), "fieldkey")] = unescape(string(m.fields[i:][i2+1:i3-1]), "fieldval") - case '-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9': - // number field - switch m.fields[i:][i3-1] { - case 'i': - // integer field - n, err := parseIntBytes(m.fields[i:][i2:i3-1], 10, 64) - if err == nil { - fieldMap[unescape(string(m.fields[i:][0:i1]), "fieldkey")] = n - } else { - // TODO handle error or just ignore field silently? - } - default: - // float field - n, err := parseFloatBytes(m.fields[i:][i2:i3], 64) - if err == nil { - fieldMap[unescape(string(m.fields[i:][0:i1]), "fieldkey")] = n - } else { - // TODO handle error or just ignore field silently? - } - } - case 'T', 't': - fieldMap[unescape(string(m.fields[i:][0:i1]), "fieldkey")] = true - case 'F', 'f': - fieldMap[unescape(string(m.fields[i:][0:i1]), "fieldkey")] = false - default: - // TODO handle unsupported field type - } - - i += i3 + 1 - } - - return fieldMap -} - -func (m *metric) Tags() map[string]string { - tagMap := map[string]string{} - if len(m.tags) == 0 { - return tagMap - } - - i := 0 - for { - // start index of tag key - i0 := indexUnescapedByte(m.tags[i:], ',') + 1 - if i0 == 0 { - // didn't find a tag start - break - } - // end index of tag key - i1 := indexUnescapedByte(m.tags[i:], '=') - // start index of tag value - i2 := i1 + 1 - // end index of tag value (starting from i2) - i3 := indexUnescapedByte(m.tags[i+i2:], ',') - if i3 == -1 { - tagMap[unescape(string(m.tags[i:][i0:i1]), "tagkey")] = unescape(string(m.tags[i:][i2:]), "tagval") - break - } - tagMap[unescape(string(m.tags[i:][i0:i1]), "tagkey")] = unescape(string(m.tags[i:][i2:i2+i3]), "tagval") - // increment start index for the next tag - i += i2 + i3 - } - - return tagMap -} - -func (m *metric) Name() string { - return unescape(string(m.name), "name") -} - -func (m *metric) Time() time.Time { - // assume metric has been verified already and ignore error: - if m.nsec == 0 { - m.nsec, _ = parseIntBytes(m.t, 10, 64) - } - return time.Unix(0, m.nsec) -} - -func (m *metric) UnixNano() int64 { - // assume metric has been verified already and ignore error: - if m.nsec == 0 { - m.nsec, _ = parseIntBytes(m.t, 10, 64) - } - return m.nsec -} - -func (m *metric) SetName(name string) { - m.hashID = 0 - m.name = []byte(nameEscaper.Replace(name)) -} - -func (m *metric) SetPrefix(prefix string) { - m.hashID = 0 - m.name = append([]byte(nameEscaper.Replace(prefix)), m.name...) -} - -func (m *metric) SetSuffix(suffix string) { - m.hashID = 0 - m.name = append(m.name, []byte(nameEscaper.Replace(suffix))...) -} - -func (m *metric) AddTag(key, value string) { - m.RemoveTag(key) - m.tags = append(m.tags, []byte(","+escape(key, "tagkey")+"="+escape(value, "tagval"))...) -} - -func (m *metric) HasTag(key string) bool { - i := bytes.Index(m.tags, []byte(escape(key, "tagkey")+"=")) - if i == -1 { - return false - } - return true -} - -func (m *metric) RemoveTag(key string) { - m.hashID = 0 - - i := bytes.Index(m.tags, []byte(escape(key, "tagkey")+"=")) - if i == -1 { - return - } - - tmp := m.tags[0 : i-1] - j := indexUnescapedByte(m.tags[i:], ',') - if j != -1 { - tmp = append(tmp, m.tags[i+j:]...) - } - m.tags = tmp - return -} - -func (m *metric) AddField(key string, value interface{}) { - m.fields = append(m.fields, ',') - m.fields = appendField(m.fields, key, value) -} - -func (m *metric) HasField(key string) bool { - i := bytes.Index(m.fields, []byte(escape(key, "tagkey")+"=")) - if i == -1 { - return false - } - return true -} - -func (m *metric) RemoveField(key string) error { - i := bytes.Index(m.fields, []byte(escape(key, "tagkey")+"=")) - if i == -1 { - return nil - } - - var tmp []byte - if i != 0 { - tmp = m.fields[0 : i-1] - } - j := indexUnescapedByte(m.fields[i:], ',') - if j != -1 { - tmp = append(tmp, m.fields[i+j:]...) - } - - if len(tmp) == 0 { - return fmt.Errorf("Metric cannot remove final field: %s", m.fields) - } - - m.fields = tmp - return nil -} - -func (m *metric) Copy() telegraf.Metric { - return copyWith(m.name, m.tags, m.fields, m.t) -} - -func copyWith(name, tags, fields, t []byte) telegraf.Metric { - out := metric{ - name: make([]byte, len(name)), - tags: make([]byte, len(tags)), - fields: make([]byte, len(fields)), - t: make([]byte, len(t)), - } - copy(out.name, name) - copy(out.tags, tags) - copy(out.fields, fields) - copy(out.t, t) - return &out -} - func (m *metric) HashID() uint64 { - if m.hashID == 0 { - h := fnv.New64a() - h.Write(m.name) - - tags := m.Tags() - tmp := make([]string, len(tags)) - i := 0 - for k, v := range tags { - tmp[i] = k + v - i++ - } - sort.Strings(tmp) - - for _, s := range tmp { - h.Write([]byte(s)) - } - - m.hashID = h.Sum64() + h := fnv.New64a() + h.Write([]byte(m.name)) + for _, tag := range m.tags { + h.Write([]byte(tag.Key)) + h.Write([]byte(tag.Value)) } - return m.hashID + return h.Sum64() } -func appendField(b []byte, k string, v interface{}) []byte { - if v == nil { - return b - } - b = append(b, []byte(escape(k, "tagkey")+"=")...) - - // check popular types first +// Convert field to a supported type or nil if unconvertible +func convertField(v interface{}) interface{} { switch v := v.(type) { case float64: - b = strconv.AppendFloat(b, v, 'f', -1, 64) + return v case int64: - b = strconv.AppendInt(b, v, 10) - b = append(b, 'i') + return v case string: - b = append(b, '"') - b = append(b, []byte(escape(v, "fieldval"))...) - b = append(b, '"') + if v == "" { + return nil + } else { + return v + } case bool: - b = strconv.AppendBool(b, v) - case int32: - b = strconv.AppendInt(b, int64(v), 10) - b = append(b, 'i') - case int16: - b = strconv.AppendInt(b, int64(v), 10) - b = append(b, 'i') - case int8: - b = strconv.AppendInt(b, int64(v), 10) - b = append(b, 'i') + return v case int: - b = strconv.AppendInt(b, int64(v), 10) - b = append(b, 'i') - case uint64: - // Cap uints above the maximum int value - var intv int64 - if v <= uint64(MaxInt) { - intv = int64(v) - } else { - intv = int64(MaxInt) - } - b = strconv.AppendInt(b, intv, 10) - b = append(b, 'i') - case uint32: - b = strconv.AppendInt(b, int64(v), 10) - b = append(b, 'i') - case uint16: - b = strconv.AppendInt(b, int64(v), 10) - b = append(b, 'i') - case uint8: - b = strconv.AppendInt(b, int64(v), 10) - b = append(b, 'i') + return int64(v) case uint: - // Cap uints above the maximum int value - var intv int64 if v <= uint(MaxInt) { - intv = int64(v) + return int64(v) } else { - intv = int64(MaxInt) + return int64(MaxInt) + } + case uint64: + if v <= uint64(MaxInt) { + return int64(v) + } else { + return int64(MaxInt) } - b = strconv.AppendInt(b, intv, 10) - b = append(b, 'i') - case float32: - b = strconv.AppendFloat(b, float64(v), 'f', -1, 32) case []byte: - b = append(b, v...) + return string(v) + case int32: + return int64(v) + case int16: + return int64(v) + case int8: + return int64(v) + case uint32: + return int64(v) + case uint16: + return int64(v) + case uint8: + return int64(v) + case float32: + return float64(v) default: - // Can't determine the type, so convert to string - b = append(b, '"') - b = append(b, []byte(escape(fmt.Sprintf("%v", v), "fieldval"))...) - b = append(b, '"') + return nil } - - return b } diff --git a/metric/metric_benchmark_test.go b/metric/metric_benchmark_test.go deleted file mode 100644 index 9383fb0dc..000000000 --- a/metric/metric_benchmark_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package metric - -import ( - "fmt" - "testing" - "time" - - "github.com/influxdata/telegraf" -) - -// vars for making sure that the compiler doesnt optimize out the benchmarks: -var ( - s string - I interface{} - tags map[string]string - fields map[string]interface{} -) - -func BenchmarkNewMetric(b *testing.B) { - var mt telegraf.Metric - for n := 0; n < b.N; n++ { - mt, _ = New("test_metric", - map[string]string{ - "test_tag_1": "tag_value_1", - "test_tag_2": "tag_value_2", - "test_tag_3": "tag_value_3", - }, - map[string]interface{}{ - "string_field": "string", - "int_field": int64(1000), - "float_field": float64(2.1), - }, - time.Now(), - ) - } - s = string(mt.String()) -} - -func BenchmarkAddTag(b *testing.B) { - var mt telegraf.Metric - mt = &metric{ - name: []byte("cpu"), - tags: []byte(",host=localhost"), - fields: []byte("a=101"), - t: []byte("1480614053000000000"), - } - for n := 0; n < b.N; n++ { - mt.AddTag("foo", "bar") - } - s = string(mt.String()) -} - -func BenchmarkSplit(b *testing.B) { - var mt telegraf.Metric - mt = &metric{ - name: []byte("cpu"), - tags: []byte(",host=localhost"), - fields: []byte("a=101,b=10i,c=10101,d=101010,e=42"), - t: []byte("1480614053000000000"), - } - var metrics []telegraf.Metric - for n := 0; n < b.N; n++ { - metrics = mt.Split(60) - } - s = string(metrics[0].String()) -} - -func BenchmarkTags(b *testing.B) { - for n := 0; n < b.N; n++ { - var mt, _ = New("test_metric", - map[string]string{ - "test_tag_1": "tag_value_1", - "test_tag_2": "tag_value_2", - "test_tag_3": "tag_value_3", - }, - map[string]interface{}{ - "string_field": "string", - "int_field": int64(1000), - "float_field": float64(2.1), - }, - time.Now(), - ) - tags = mt.Tags() - } - s = fmt.Sprint(tags) -} - -func BenchmarkFields(b *testing.B) { - for n := 0; n < b.N; n++ { - var mt, _ = New("test_metric", - map[string]string{ - "test_tag_1": "tag_value_1", - "test_tag_2": "tag_value_2", - "test_tag_3": "tag_value_3", - }, - map[string]interface{}{ - "string_field": "string", - "int_field": int64(1000), - "float_field": float64(2.1), - }, - time.Now(), - ) - fields = mt.Fields() - } - s = fmt.Sprint(fields) -} - -func BenchmarkString(b *testing.B) { - mt, _ := New("test_metric", - map[string]string{ - "test_tag_1": "tag_value_1", - "test_tag_2": "tag_value_2", - "test_tag_3": "tag_value_3", - }, - map[string]interface{}{ - "string_field": "string", - "int_field": int64(1000), - "float_field": float64(2.1), - }, - time.Now(), - ) - var S string - for n := 0; n < b.N; n++ { - S = mt.String() - } - s = S -} - -func BenchmarkSerialize(b *testing.B) { - mt, _ := New("test_metric", - map[string]string{ - "test_tag_1": "tag_value_1", - "test_tag_2": "tag_value_2", - "test_tag_3": "tag_value_3", - }, - map[string]interface{}{ - "string_field": "string", - "int_field": int64(1000), - "float_field": float64(2.1), - }, - time.Now(), - ) - var B []byte - for n := 0; n < b.N; n++ { - B = mt.Serialize() - } - s = string(B) -} diff --git a/metric/metric_test.go b/metric/metric_test.go index 062399d6e..31f1729d8 100644 --- a/metric/metric_test.go +++ b/metric/metric_test.go @@ -1,14 +1,10 @@ package metric import ( - "fmt" - "math" - "regexp" "testing" "time" "github.com/influxdata/telegraf" - "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) @@ -25,102 +21,184 @@ func TestNewMetric(t *testing.T) { "usage_busy": float64(1), } m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) + require.NoError(t, err) - assert.Equal(t, telegraf.Untyped, m.Type()) - assert.Equal(t, tags, m.Tags()) - assert.Equal(t, fields, m.Fields()) - assert.Equal(t, "cpu", m.Name()) - assert.Equal(t, now.UnixNano(), m.Time().UnixNano()) - assert.Equal(t, now.UnixNano(), m.UnixNano()) + require.Equal(t, "cpu", m.Name()) + require.Equal(t, tags, m.Tags()) + require.Equal(t, fields, m.Fields()) + require.Equal(t, 2, len(m.FieldList())) + require.Equal(t, now, m.Time()) } -func TestNewErrors(t *testing.T) { - // creating a metric with an empty name produces an error: - m, err := New( - "", - map[string]string{ - "datacenter": "us-east-1", - "mytag": "foo", - "another": "tag", - }, - map[string]interface{}{ - "value": float64(1), - }, - time.Now(), - ) - assert.Error(t, err) - assert.Nil(t, m) - - // creating a metric with empty fields produces an error: - m, err = New( - "foobar", - map[string]string{ - "datacenter": "us-east-1", - "mytag": "foo", - "another": "tag", - }, - map[string]interface{}{}, - time.Now(), - ) - assert.Error(t, err) - assert.Nil(t, m) -} - -func TestNewMetric_Tags(t *testing.T) { - now := time.Now() - tags := map[string]string{ - "host": "localhost", - "datacenter": "us-east-1", - } +func baseMetric() telegraf.Metric { + tags := map[string]string{} fields := map[string]interface{}{ "value": float64(1), } + now := time.Now() + m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) + if err != nil { + panic(err) + } + return m +} - assert.True(t, m.HasTag("host")) - assert.True(t, m.HasTag("datacenter")) +func TestHasTag(t *testing.T) { + m := baseMetric() - m.AddTag("newtag", "foo") - assert.True(t, m.HasTag("newtag")) + require.False(t, m.HasTag("host")) + m.AddTag("host", "localhost") + require.True(t, m.HasTag("host")) + m.RemoveTag("host") + require.False(t, m.HasTag("host")) +} + +func TestAddTagOverwrites(t *testing.T) { + m := baseMetric() + + m.AddTag("host", "localhost") + m.AddTag("host", "example.org") + + value, ok := m.GetTag("host") + require.True(t, ok) + require.Equal(t, "example.org", value) +} + +func TestRemoveTagNoEffectOnMissingTags(t *testing.T) { + m := baseMetric() + + m.RemoveTag("foo") + m.AddTag("a", "x") + m.RemoveTag("foo") + m.RemoveTag("bar") + value, ok := m.GetTag("a") + require.True(t, ok) + require.Equal(t, "x", value) +} + +func TestGetTag(t *testing.T) { + m := baseMetric() + + value, ok := m.GetTag("host") + require.False(t, ok) + + m.AddTag("host", "localhost") + + value, ok = m.GetTag("host") + require.True(t, ok) + require.Equal(t, "localhost", value) m.RemoveTag("host") - assert.False(t, m.HasTag("host")) - assert.True(t, m.HasTag("newtag")) - assert.True(t, m.HasTag("datacenter")) - - m.RemoveTag("datacenter") - assert.False(t, m.HasTag("datacenter")) - assert.True(t, m.HasTag("newtag")) - assert.Equal(t, map[string]string{"newtag": "foo"}, m.Tags()) - - m.RemoveTag("newtag") - assert.False(t, m.HasTag("newtag")) - assert.Equal(t, map[string]string{}, m.Tags()) - - assert.Equal(t, "cpu value=1 "+fmt.Sprint(now.UnixNano())+"\n", m.String()) + value, ok = m.GetTag("host") + require.False(t, ok) } -func TestSerialize(t *testing.T) { +func TestHasField(t *testing.T) { + m := baseMetric() + + require.False(t, m.HasField("x")) + m.AddField("x", 42.0) + require.True(t, m.HasField("x")) + m.RemoveTag("x") + require.False(t, m.HasTag("x")) +} + +func TestAddFieldOverwrites(t *testing.T) { + m := baseMetric() + + m.AddField("value", 1.0) + m.AddField("value", 42.0) + + value, ok := m.GetField("value") + require.True(t, ok) + require.Equal(t, 42.0, value) +} + +func TestAddFieldChangesType(t *testing.T) { + m := baseMetric() + + m.AddField("value", 1.0) + m.AddField("value", "xyzzy") + + value, ok := m.GetField("value") + require.True(t, ok) + require.Equal(t, "xyzzy", value) +} + +func TestRemoveFieldNoEffectOnMissingFields(t *testing.T) { + m := baseMetric() + + m.RemoveField("foo") + m.AddField("a", "x") + m.RemoveField("foo") + m.RemoveField("bar") + value, ok := m.GetField("a") + require.True(t, ok) + require.Equal(t, "x", value) +} + +func TestGetField(t *testing.T) { + m := baseMetric() + + value, ok := m.GetField("foo") + require.False(t, ok) + + m.AddField("foo", "bar") + + value, ok = m.GetField("foo") + require.True(t, ok) + require.Equal(t, "bar", value) + + m.RemoveTag("foo") + value, ok = m.GetTag("foo") + require.False(t, ok) +} + +func TestTagList_Sorted(t *testing.T) { + m := baseMetric() + + m.AddTag("b", "y") + m.AddTag("c", "z") + m.AddTag("a", "x") + + taglist := m.TagList() + require.Equal(t, "a", taglist[0].Key) + require.Equal(t, "b", taglist[1].Key) + require.Equal(t, "c", taglist[2].Key) +} + +func TestEquals(t *testing.T) { now := time.Now() - tags := map[string]string{ - "datacenter": "us-east-1", - } - fields := map[string]interface{}{ - "value": float64(1), - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) + m1, err := New("cpu", + map[string]string{ + "host": "localhost", + }, + map[string]interface{}{ + "value": 42.0, + }, + now, + ) + require.NoError(t, err) - assert.Equal(t, - []byte("cpu,datacenter=us-east-1 value=1 "+fmt.Sprint(now.UnixNano())+"\n"), - m.Serialize()) + m2, err := New("cpu", + map[string]string{ + "host": "localhost", + }, + map[string]interface{}{ + "value": 42.0, + }, + now, + ) + require.NoError(t, err) - m.RemoveTag("datacenter") - assert.Equal(t, - []byte("cpu value=1 "+fmt.Sprint(now.UnixNano())+"\n"), - m.Serialize()) + lhs := m1.(*metric) + require.Equal(t, lhs, m2) + + m3 := m2.Copy() + require.Equal(t, lhs, m3) + m3.AddTag("a", "x") + require.NotEqual(t, lhs, m3) } func TestHashID(t *testing.T) { @@ -171,567 +249,62 @@ func TestHashID_Consistency(t *testing.T) { ) hash := m.HashID() - for i := 0; i < 1000; i++ { - m2, _ := New( - "cpu", - map[string]string{ - "datacenter": "us-east-1", - "mytag": "foo", - "another": "tag", - }, - map[string]interface{}{ - "value": float64(1), - }, - time.Now(), - ) - assert.Equal(t, hash, m2.HashID()) - } + m2, _ := New( + "cpu", + map[string]string{ + "datacenter": "us-east-1", + "mytag": "foo", + "another": "tag", + }, + map[string]interface{}{ + "value": float64(1), + }, + time.Now(), + ) + assert.Equal(t, hash, m2.HashID()) + + m3 := m.Copy() + assert.Equal(t, m2.HashID(), m3.HashID()) } -func TestNewMetric_NameModifiers(t *testing.T) { +func TestSetName(t *testing.T) { + m := baseMetric() + m.SetName("foo") + require.Equal(t, "foo", m.Name()) +} + +func TestAddPrefix(t *testing.T) { + m := baseMetric() + m.AddPrefix("foo_") + require.Equal(t, "foo_cpu", m.Name()) + m.AddPrefix("foo_") + require.Equal(t, "foo_foo_cpu", m.Name()) +} + +func TestAddSuffix(t *testing.T) { + m := baseMetric() + m.AddSuffix("_foo") + require.Equal(t, "cpu_foo", m.Name()) + m.AddSuffix("_foo") + require.Equal(t, "cpu_foo_foo", m.Name()) +} + +func TestValueType(t *testing.T) { now := time.Now() + tags := map[string]string{} fields := map[string]interface{}{ - "value": float64(1), - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - hash := m.HashID() - suffix := fmt.Sprintf(" value=1 %d\n", now.UnixNano()) - assert.Equal(t, "cpu"+suffix, m.String()) - - m.SetPrefix("pre_") - assert.NotEqual(t, hash, m.HashID()) - hash = m.HashID() - assert.Equal(t, "pre_cpu"+suffix, m.String()) - - m.SetSuffix("_post") - assert.NotEqual(t, hash, m.HashID()) - hash = m.HashID() - assert.Equal(t, "pre_cpu_post"+suffix, m.String()) - - m.SetName("mem") - assert.NotEqual(t, hash, m.HashID()) - assert.Equal(t, "mem"+suffix, m.String()) -} - -func TestNewMetric_FieldModifiers(t *testing.T) { - now := time.Now() - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "value": float64(1), - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - assert.True(t, m.HasField("value")) - assert.False(t, m.HasField("foo")) - - m.AddField("newfield", "foo") - assert.True(t, m.HasField("newfield")) - - assert.NoError(t, m.RemoveField("newfield")) - assert.False(t, m.HasField("newfield")) - - // don't allow user to remove all fields: - assert.Error(t, m.RemoveField("value")) - - m.AddField("value2", int64(101)) - assert.NoError(t, m.RemoveField("value")) - assert.False(t, m.HasField("value")) -} - -func TestNewMetric_Fields(t *testing.T) { - now := time.Now() - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "float": float64(1), - "int": int64(1), - "bool": true, - "false": false, - "string": "test", - "quote_string": `x"y`, - "backslash_quote_string": `x\"y`, - "backslash": `x\y`, - "ends_with_backslash": `x\`, - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - assert.Equal(t, fields, m.Fields()) -} - -func TestNewMetric_Time(t *testing.T) { - now := time.Now() - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "float": float64(1), - "int": int64(1), - "bool": true, - "false": false, - "string": "test", - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - m = m.Copy() - m2 := m.Copy() - - assert.Equal(t, now.UnixNano(), m.Time().UnixNano()) - assert.Equal(t, now.UnixNano(), m2.UnixNano()) -} - -func TestNewMetric_Copy(t *testing.T) { - now := time.Now() - tags := map[string]string{} - fields := map[string]interface{}{ - "float": float64(1), - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - m2 := m.Copy() - - assert.Equal(t, - fmt.Sprintf("cpu float=1 %d\n", now.UnixNano()), - m.String()) - m.AddTag("host", "localhost") - assert.Equal(t, - fmt.Sprintf("cpu,host=localhost float=1 %d\n", now.UnixNano()), - m.String()) - - assert.Equal(t, - fmt.Sprintf("cpu float=1 %d\n", now.UnixNano()), - m2.String()) -} - -func TestNewMetric_AllTypes(t *testing.T) { - now := time.Now() - tags := map[string]string{} - fields := map[string]interface{}{ - "float64": float64(1), - "float32": float32(1), - "int64": int64(1), - "int32": int32(1), - "int16": int16(1), - "int8": int8(1), - "int": int(1), - "uint64": uint64(1), - "uint32": uint32(1), - "uint16": uint16(1), - "uint8": uint8(1), - "uint": uint(1), - "bytes": []byte("foo"), - "nil": nil, - "maxuint64": uint64(MaxInt) + 10, - "maxuint": uint(MaxInt) + 10, - "unsupported": []int{1, 2}, - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - assert.Contains(t, m.String(), "float64=1") - assert.Contains(t, m.String(), "float32=1") - assert.Contains(t, m.String(), "int64=1i") - assert.Contains(t, m.String(), "int32=1i") - assert.Contains(t, m.String(), "int16=1i") - assert.Contains(t, m.String(), "int8=1i") - assert.Contains(t, m.String(), "int=1i") - assert.Contains(t, m.String(), "uint64=1i") - assert.Contains(t, m.String(), "uint32=1i") - assert.Contains(t, m.String(), "uint16=1i") - assert.Contains(t, m.String(), "uint8=1i") - assert.Contains(t, m.String(), "uint=1i") - assert.NotContains(t, m.String(), "nil") - assert.Contains(t, m.String(), fmt.Sprintf("maxuint64=%di", MaxInt)) - assert.Contains(t, m.String(), fmt.Sprintf("maxuint=%di", MaxInt)) -} - -func TestIndexUnescapedByte(t *testing.T) { - tests := []struct { - in []byte - b byte - expected int - }{ - { - in: []byte(`foobar`), - b: 'b', - expected: 3, - }, - { - in: []byte(`foo\bar`), - b: 'b', - expected: -1, - }, - { - in: []byte(`foo\\bar`), - b: 'b', - expected: -1, - }, - { - in: []byte(`foobar`), - b: 'f', - expected: 0, - }, - { - in: []byte(`foobar`), - b: 'r', - expected: 5, - }, - { - in: []byte(`\foobar`), - b: 'f', - expected: -1, - }, - } - - for _, test := range tests { - got := indexUnescapedByte(test.in, test.b) - assert.Equal(t, test.expected, got) - } -} - -func TestNewGaugeMetric(t *testing.T) { - now := time.Now() - - tags := map[string]string{ - "host": "localhost", - "datacenter": "us-east-1", - } - fields := map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), + "value": float64(42), } m, err := New("cpu", tags, fields, now, telegraf.Gauge) assert.NoError(t, err) assert.Equal(t, telegraf.Gauge, m.Type()) - assert.Equal(t, tags, m.Tags()) - assert.Equal(t, fields, m.Fields()) - assert.Equal(t, "cpu", m.Name()) - assert.Equal(t, now.UnixNano(), m.Time().UnixNano()) - assert.Equal(t, now.UnixNano(), m.UnixNano()) } -func TestNewCounterMetric(t *testing.T) { - now := time.Now() - - tags := map[string]string{ - "host": "localhost", - "datacenter": "us-east-1", - } - fields := map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), - } - m, err := New("cpu", tags, fields, now, telegraf.Counter) - assert.NoError(t, err) - - assert.Equal(t, telegraf.Counter, m.Type()) - assert.Equal(t, tags, m.Tags()) - assert.Equal(t, fields, m.Fields()) - assert.Equal(t, "cpu", m.Name()) - assert.Equal(t, now.UnixNano(), m.Time().UnixNano()) - assert.Equal(t, now.UnixNano(), m.UnixNano()) -} - -// test splitting metric into various max lengths -func TestSplitMetric(t *testing.T) { - now := time.Unix(0, 1480940990034083306) - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "float": float64(100001), - "int": int64(100001), - "bool": true, - "false": false, - "string": "test", - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - split80 := m.Split(80) - assert.Len(t, split80, 2) - - split70 := m.Split(70) - assert.Len(t, split70, 3) - - split60 := m.Split(60) - assert.Len(t, split60, 5) -} - -// test splitting metric into various max lengths -// use a simple regex check to verify that the split metrics are valid -func TestSplitMetric_RegexVerify(t *testing.T) { - now := time.Unix(0, 1480940990034083306) - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "foo": float64(98934259085), - "bar": float64(19385292), - "number": float64(19385292), - "another": float64(19385292), - "n": float64(19385292), - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - // verification regex - re := regexp.MustCompile(`cpu,host=localhost \w+=\d+(,\w+=\d+)* 1480940990034083306`) - - split90 := m.Split(90) - assert.Len(t, split90, 2) - for _, splitM := range split90 { - assert.True(t, re.Match(splitM.Serialize()), splitM.String()) - } - - split70 := m.Split(70) - assert.Len(t, split70, 3) - for _, splitM := range split70 { - assert.True(t, re.Match(splitM.Serialize()), splitM.String()) - } - - split20 := m.Split(20) - assert.Len(t, split20, 5) - for _, splitM := range split20 { - assert.True(t, re.Match(splitM.Serialize()), splitM.String()) - } -} - -// test splitting metric even when given length is shorter than -// shortest possible length -// Split should split metric as short as possible, ie, 1 field per metric -func TestSplitMetric_TooShort(t *testing.T) { - now := time.Unix(0, 1480940990034083306) - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "float": float64(100001), - "int": int64(100001), - "bool": true, - "false": false, - "string": "test", - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - split := m.Split(10) - assert.Len(t, split, 5) - strings := make([]string, 5) - for i, splitM := range split { - strings[i] = splitM.String() - } - - assert.Contains(t, strings, "cpu,host=localhost float=100001 1480940990034083306\n") - assert.Contains(t, strings, "cpu,host=localhost int=100001i 1480940990034083306\n") - assert.Contains(t, strings, "cpu,host=localhost bool=true 1480940990034083306\n") - assert.Contains(t, strings, "cpu,host=localhost false=false 1480940990034083306\n") - assert.Contains(t, strings, "cpu,host=localhost string=\"test\" 1480940990034083306\n") -} - -func TestSplitMetric_NoOp(t *testing.T) { - now := time.Unix(0, 1480940990034083306) - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "float": float64(100001), - "int": int64(100001), - "bool": true, - "false": false, - "string": "test", - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - split := m.Split(1000) - assert.Len(t, split, 1) - assert.Equal(t, m, split[0]) -} - -func TestSplitMetric_OneField(t *testing.T) { - now := time.Unix(0, 1480940990034083306) - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "float": float64(100001), - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - assert.Equal(t, "cpu,host=localhost float=100001 1480940990034083306\n", m.String()) - - split := m.Split(1000) - assert.Len(t, split, 1) - assert.Equal(t, "cpu,host=localhost float=100001 1480940990034083306\n", split[0].String()) - - split = m.Split(1) - assert.Len(t, split, 1) - assert.Equal(t, "cpu,host=localhost float=100001 1480940990034083306\n", split[0].String()) - - split = m.Split(40) - assert.Len(t, split, 1) - assert.Equal(t, "cpu,host=localhost float=100001 1480940990034083306\n", split[0].String()) -} - -func TestSplitMetric_ExactSize(t *testing.T) { - now := time.Unix(0, 1480940990034083306) - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "float": float64(100001), - "int": int64(100001), - "bool": true, - "false": false, - "string": "test", - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - actual := m.Split(m.Len()) - // check that no copy was made - require.Equal(t, &m, &actual[0]) -} - -func TestSplitMetric_NoRoomForNewline(t *testing.T) { - now := time.Unix(0, 1480940990034083306) - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "float": float64(100001), - "int": int64(100001), - "bool": true, - "false": false, - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - actual := m.Split(m.Len() - 1) - require.Equal(t, 2, len(actual)) -} - -func TestNewMetricAggregate(t *testing.T) { - now := time.Now() - - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "usage_idle": float64(99), - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - assert.False(t, m.IsAggregate()) - m.SetAggregate(true) - assert.True(t, m.IsAggregate()) -} - -func TestNewMetricString(t *testing.T) { - now := time.Now() - - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "usage_idle": float64(99), - } - m, err := New("cpu", tags, fields, now) - assert.NoError(t, err) - - lineProto := fmt.Sprintf("cpu,host=localhost usage_idle=99 %d\n", - now.UnixNano()) - assert.Equal(t, lineProto, m.String()) -} - -func TestNewMetricFailNaN(t *testing.T) { - now := time.Now() - - tags := map[string]string{ - "host": "localhost", - } - fields := map[string]interface{}{ - "usage_idle": math.NaN(), - } - - _, err := New("cpu", tags, fields, now) - assert.NoError(t, err) -} - -func TestEmptyTagValueOrKey(t *testing.T) { - now := time.Now() - - tags := map[string]string{ - "host": "localhost", - "emptytag": "", - "": "valuewithoutkey", - } - fields := map[string]interface{}{ - "usage_idle": float64(99), - } - m, err := New("cpu", tags, fields, now) - - assert.True(t, m.HasTag("host")) - assert.False(t, m.HasTag("emptytag")) - assert.Equal(t, - fmt.Sprintf("cpu,host=localhost usage_idle=99 %d\n", now.UnixNano()), - m.String()) - - assert.NoError(t, err) - -} - -func TestNewMetric_TrailingSlash(t *testing.T) { - now := time.Now() - - tests := []struct { - name string - tags map[string]string - fields map[string]interface{} - }{ - { - name: `cpu\`, - fields: map[string]interface{}{ - "value": int64(42), - }, - }, - { - name: "cpu", - fields: map[string]interface{}{ - `value\`: "x", - }, - }, - { - name: "cpu", - tags: map[string]string{ - `host\`: "localhost", - }, - fields: map[string]interface{}{ - "value": int64(42), - }, - }, - { - name: "cpu", - tags: map[string]string{ - "host": `localhost\`, - }, - fields: map[string]interface{}{ - "value": int64(42), - }, - }, - } - - for _, tc := range tests { - _, err := New(tc.name, tc.tags, tc.fields, now) - assert.Error(t, err) - } +func TestCopyAggreate(t *testing.T) { + m1 := baseMetric() + m1.SetAggregate(true) + m2 := m1.Copy() + assert.True(t, m2.IsAggregate()) } diff --git a/metric/parse.go b/metric/parse.go deleted file mode 100644 index 0fccbeb32..000000000 --- a/metric/parse.go +++ /dev/null @@ -1,680 +0,0 @@ -package metric - -import ( - "bytes" - "errors" - "fmt" - "strconv" - "time" - - "github.com/influxdata/telegraf" -) - -var ( - ErrInvalidNumber = errors.New("invalid number") -) - -const ( - // the number of characters for the largest possible int64 (9223372036854775807) - maxInt64Digits = 19 - - // the number of characters for the smallest possible int64 (-9223372036854775808) - minInt64Digits = 20 - - // the number of characters required for the largest float64 before a range check - // would occur during parsing - maxFloat64Digits = 25 - - // the number of characters required for smallest float64 before a range check occur - // would occur during parsing - minFloat64Digits = 27 - - MaxKeyLength = 65535 -) - -// The following constants allow us to specify which state to move to -// next, when scanning sections of a Point. -const ( - tagKeyState = iota - tagValueState - fieldsState -) - -func Parse(buf []byte) ([]telegraf.Metric, error) { - return ParseWithDefaultTimePrecision(buf, time.Now(), "") -} - -func ParseWithDefaultTime(buf []byte, t time.Time) ([]telegraf.Metric, error) { - return ParseWithDefaultTimePrecision(buf, t, "") -} - -func ParseWithDefaultTimePrecision( - buf []byte, - t time.Time, - precision string, -) ([]telegraf.Metric, error) { - if len(buf) == 0 { - return []telegraf.Metric{}, nil - } - if len(buf) <= 6 { - return []telegraf.Metric{}, makeError("buffer too short", buf, 0) - } - metrics := make([]telegraf.Metric, 0, bytes.Count(buf, []byte("\n"))+1) - var errStr string - i := 0 - for { - j := bytes.IndexByte(buf[i:], '\n') - if j == -1 { - break - } - if len(buf[i:i+j]) < 2 { - i += j + 1 // increment i past the previous newline - continue - } - - m, err := parseMetric(buf[i:i+j], t, precision) - if err != nil { - i += j + 1 // increment i past the previous newline - errStr += " " + err.Error() - continue - } - i += j + 1 // increment i past the previous newline - - metrics = append(metrics, m) - } - - if len(errStr) > 0 { - return metrics, fmt.Errorf(errStr) - } - return metrics, nil -} - -func parseMetric(buf []byte, - defaultTime time.Time, - precision string, -) (telegraf.Metric, error) { - var dTime string - // scan the first block which is measurement[,tag1=value1,tag2=value=2...] - pos, key, err := scanKey(buf, 0) - if err != nil { - return nil, err - } - - // measurement name is required - if len(key) == 0 { - return nil, fmt.Errorf("missing measurement") - } - - if len(key) > MaxKeyLength { - return nil, fmt.Errorf("max key length exceeded: %v > %v", len(key), MaxKeyLength) - } - - // scan the second block is which is field1=value1[,field2=value2,...] - pos, fields, err := scanFields(buf, pos) - if err != nil { - return nil, err - } - - // at least one field is required - if len(fields) == 0 { - return nil, fmt.Errorf("missing fields") - } - - // scan the last block which is an optional integer timestamp - pos, ts, err := scanTime(buf, pos) - if err != nil { - return nil, err - } - - // apply precision multiplier - var nsec int64 - multiplier := getPrecisionMultiplier(precision) - if len(ts) > 0 && multiplier > 1 { - tsint, err := parseIntBytes(ts, 10, 64) - if err != nil { - return nil, err - } - - nsec := multiplier * tsint - ts = []byte(strconv.FormatInt(nsec, 10)) - } - - m := &metric{ - fields: fields, - t: ts, - nsec: nsec, - } - - // parse out the measurement name - // namei is the index at which the "name" ends - namei := indexUnescapedByte(key, ',') - if namei < 1 { - // no tags - m.name = key - } else { - m.name = key[0:namei] - m.tags = key[namei:] - } - - if len(m.t) == 0 { - if len(dTime) == 0 { - dTime = fmt.Sprint(defaultTime.UnixNano()) - } - // use default time - m.t = []byte(dTime) - } - - // here we copy on return because this allows us to later call - // AddTag, AddField, RemoveTag, RemoveField, etc. without worrying about - // modifying 'tag' bytes having an affect on 'field' bytes, for example. - return m.Copy(), nil -} - -// scanKey scans buf starting at i for the measurement and tag portion of the point. -// It returns the ending position and the byte slice of key within buf. If there -// are tags, they will be sorted if they are not already. -func scanKey(buf []byte, i int) (int, []byte, error) { - start := skipWhitespace(buf, i) - i = start - - // First scan the Point's measurement. - state, i, err := scanMeasurement(buf, i) - if err != nil { - return i, buf[start:i], err - } - - // Optionally scan tags if needed. - if state == tagKeyState { - i, err = scanTags(buf, i) - if err != nil { - return i, buf[start:i], err - } - } - - return i, buf[start:i], nil -} - -// scanMeasurement examines the measurement part of a Point, returning -// the next state to move to, and the current location in the buffer. -func scanMeasurement(buf []byte, i int) (int, int, error) { - // Check first byte of measurement, anything except a comma is fine. - // It can't be a space, since whitespace is stripped prior to this - // function call. - if i >= len(buf) || buf[i] == ',' { - return -1, i, makeError("missing measurement", buf, i) - } - - for { - i++ - if i >= len(buf) { - // cpu - return -1, i, makeError("missing fields", buf, i) - } - - if buf[i-1] == '\\' { - // Skip character (it's escaped). - continue - } - - // Unescaped comma; move onto scanning the tags. - if buf[i] == ',' { - return tagKeyState, i + 1, nil - } - - // Unescaped space; move onto scanning the fields. - if buf[i] == ' ' { - // cpu value=1.0 - return fieldsState, i, nil - } - } -} - -// scanTags examines all the tags in a Point, keeping track of and -// returning the updated indices slice, number of commas and location -// in buf where to start examining the Point fields. -func scanTags(buf []byte, i int) (int, error) { - var ( - err error - state = tagKeyState - ) - - for { - switch state { - case tagKeyState: - i, err = scanTagsKey(buf, i) - state = tagValueState // tag value always follows a tag key - case tagValueState: - state, i, err = scanTagsValue(buf, i) - case fieldsState: - return i, nil - } - - if err != nil { - return i, err - } - } -} - -// scanTagsKey scans each character in a tag key. -func scanTagsKey(buf []byte, i int) (int, error) { - // First character of the key. - if i >= len(buf) || buf[i] == ' ' || buf[i] == ',' || buf[i] == '=' { - // cpu,{'', ' ', ',', '='} - return i, makeError("missing tag key", buf, i) - } - - // Examine each character in the tag key until we hit an unescaped - // equals (the tag value), or we hit an error (i.e., unescaped - // space or comma). - for { - i++ - - // Either we reached the end of the buffer or we hit an - // unescaped comma or space. - if i >= len(buf) || - ((buf[i] == ' ' || buf[i] == ',') && buf[i-1] != '\\') { - // cpu,tag{'', ' ', ','} - return i, makeError("missing tag value", buf, i) - } - - if buf[i] == '=' && buf[i-1] != '\\' { - // cpu,tag= - return i + 1, nil - } - } -} - -// scanTagsValue scans each character in a tag value. -func scanTagsValue(buf []byte, i int) (int, int, error) { - // Tag value cannot be empty. - if i >= len(buf) || buf[i] == ',' || buf[i] == ' ' { - // cpu,tag={',', ' '} - return -1, i, makeError("missing tag value", buf, i) - } - - // Examine each character in the tag value until we hit an unescaped - // comma (move onto next tag key), an unescaped space (move onto - // fields), or we error out. - for { - i++ - if i >= len(buf) { - // cpu,tag=value - return -1, i, makeError("missing fields", buf, i) - } - - // An unescaped equals sign is an invalid tag value. - if buf[i] == '=' && buf[i-1] != '\\' { - // cpu,tag={'=', 'fo=o'} - return -1, i, makeError("invalid tag format", buf, i) - } - - if buf[i] == ',' && buf[i-1] != '\\' { - // cpu,tag=foo, - return tagKeyState, i + 1, nil - } - - // cpu,tag=foo value=1.0 - // cpu, tag=foo\= value=1.0 - if buf[i] == ' ' && buf[i-1] != '\\' { - return fieldsState, i, nil - } - } -} - -// scanFields scans buf, starting at i for the fields section of a point. It returns -// the ending position and the byte slice of the fields within buf -func scanFields(buf []byte, i int) (int, []byte, error) { - start := skipWhitespace(buf, i) - i = start - - // track how many '"" we've seen since last '=' - quotes := 0 - - // tracks how many '=' we've seen - equals := 0 - - // tracks how many commas we've seen - commas := 0 - - for { - // reached the end of buf? - if i >= len(buf) { - break - } - - // escaped characters? - if buf[i] == '\\' && i+1 < len(buf) { - i += 2 - continue - } - - // If the value is quoted, scan until we get to the end quote - // Only quote values in the field value since quotes are not significant - // in the field key - if buf[i] == '"' && equals > commas { - i++ - quotes++ - if quotes > 2 { - break - } - continue - } - - // If we see an =, ensure that there is at least on char before and after it - if buf[i] == '=' && quotes != 1 { - quotes = 0 - equals++ - - // check for "... =123" but allow "a\ =123" - if buf[i-1] == ' ' && buf[i-2] != '\\' { - return i, buf[start:i], makeError("missing field key", buf, i) - } - - // check for "...a=123,=456" but allow "a=123,a\,=456" - if buf[i-1] == ',' && buf[i-2] != '\\' { - return i, buf[start:i], makeError("missing field key", buf, i) - } - - // check for "... value=" - if i+1 >= len(buf) { - return i, buf[start:i], makeError("missing field value", buf, i) - } - - // check for "... value=,value2=..." - if buf[i+1] == ',' || buf[i+1] == ' ' { - return i, buf[start:i], makeError("missing field value", buf, i) - } - - if isNumeric(buf[i+1]) || buf[i+1] == '-' || buf[i+1] == 'N' || buf[i+1] == 'n' { - var err error - i, err = scanNumber(buf, i+1) - if err != nil { - return i, buf[start:i], err - } - continue - } - // If next byte is not a double-quote, the value must be a boolean - if buf[i+1] != '"' { - var err error - i, _, err = scanBoolean(buf, i+1) - if err != nil { - return i, buf[start:i], err - } - continue - } - } - - if buf[i] == ',' && quotes != 1 { - commas++ - } - - // reached end of block? - if buf[i] == ' ' && quotes != 1 { - break - } - i++ - } - - if quotes != 0 && quotes != 2 { - return i, buf[start:i], makeError("unbalanced quotes", buf, i) - } - - // check that all field sections had key and values (e.g. prevent "a=1,b" - if equals == 0 || commas != equals-1 { - return i, buf[start:i], makeError("invalid field format", buf, i) - } - - return i, buf[start:i], nil -} - -// scanTime scans buf, starting at i for the time section of a point. It -// returns the ending position and the byte slice of the timestamp within buf -// and and error if the timestamp is not in the correct numeric format. -func scanTime(buf []byte, i int) (int, []byte, error) { - start := skipWhitespace(buf, i) - i = start - - for { - // reached the end of buf? - if i >= len(buf) { - break - } - - // Reached end of block or trailing whitespace? - if buf[i] == '\n' || buf[i] == ' ' { - break - } - - // Handle negative timestamps - if i == start && buf[i] == '-' { - i++ - continue - } - - // Timestamps should be integers, make sure they are so we don't need - // to actually parse the timestamp until needed. - if buf[i] < '0' || buf[i] > '9' { - return i, buf[start:i], makeError("invalid timestamp", buf, i) - } - i++ - } - return i, buf[start:i], nil -} - -func isNumeric(b byte) bool { - return (b >= '0' && b <= '9') || b == '.' -} - -// scanNumber returns the end position within buf, start at i after -// scanning over buf for an integer, or float. It returns an -// error if a invalid number is scanned. -func scanNumber(buf []byte, i int) (int, error) { - start := i - var isInt bool - - // Is negative number? - if i < len(buf) && buf[i] == '-' { - i++ - // There must be more characters now, as just '-' is illegal. - if i == len(buf) { - return i, ErrInvalidNumber - } - } - - // how many decimal points we've see - decimal := false - - // indicates the number is float in scientific notation - scientific := false - - for { - if i >= len(buf) { - break - } - - if buf[i] == ',' || buf[i] == ' ' { - break - } - - if buf[i] == 'i' && i > start && !isInt { - isInt = true - i++ - continue - } - - if buf[i] == '.' { - // Can't have more than 1 decimal (e.g. 1.1.1 should fail) - if decimal { - return i, ErrInvalidNumber - } - decimal = true - } - - // `e` is valid for floats but not as the first char - if i > start && (buf[i] == 'e' || buf[i] == 'E') { - scientific = true - i++ - continue - } - - // + and - are only valid at this point if they follow an e (scientific notation) - if (buf[i] == '+' || buf[i] == '-') && (buf[i-1] == 'e' || buf[i-1] == 'E') { - i++ - continue - } - - // NaN is an unsupported value - if i+2 < len(buf) && (buf[i] == 'N' || buf[i] == 'n') { - return i, ErrInvalidNumber - } - - if !isNumeric(buf[i]) { - return i, ErrInvalidNumber - } - i++ - } - - if isInt && (decimal || scientific) { - return i, ErrInvalidNumber - } - - numericDigits := i - start - if isInt { - numericDigits-- - } - if decimal { - numericDigits-- - } - if buf[start] == '-' { - numericDigits-- - } - - if numericDigits == 0 { - return i, ErrInvalidNumber - } - - // It's more common that numbers will be within min/max range for their type but we need to prevent - // out or range numbers from being parsed successfully. This uses some simple heuristics to decide - // if we should parse the number to the actual type. It does not do it all the time because it incurs - // extra allocations and we end up converting the type again when writing points to disk. - if isInt { - // Make sure the last char is an 'i' for integers (e.g. 9i10 is not valid) - if buf[i-1] != 'i' { - return i, ErrInvalidNumber - } - // Parse the int to check bounds the number of digits could be larger than the max range - // We subtract 1 from the index to remove the `i` from our tests - if len(buf[start:i-1]) >= maxInt64Digits || len(buf[start:i-1]) >= minInt64Digits { - if _, err := parseIntBytes(buf[start:i-1], 10, 64); err != nil { - return i, makeError(fmt.Sprintf("unable to parse integer %s: %s", buf[start:i-1], err), buf, i) - } - } - } else { - // Parse the float to check bounds if it's scientific or the number of digits could be larger than the max range - if scientific || len(buf[start:i]) >= maxFloat64Digits || len(buf[start:i]) >= minFloat64Digits { - if _, err := parseFloatBytes(buf[start:i], 10); err != nil { - return i, makeError("invalid float", buf, i) - } - } - } - - return i, nil -} - -// scanBoolean returns the end position within buf, start at i after -// scanning over buf for boolean. Valid values for a boolean are -// t, T, true, TRUE, f, F, false, FALSE. It returns an error if a invalid boolean -// is scanned. -func scanBoolean(buf []byte, i int) (int, []byte, error) { - start := i - - if i < len(buf) && (buf[i] != 't' && buf[i] != 'f' && buf[i] != 'T' && buf[i] != 'F') { - return i, buf[start:i], makeError("invalid value", buf, i) - } - - i++ - for { - if i >= len(buf) { - break - } - - if buf[i] == ',' || buf[i] == ' ' { - break - } - i++ - } - - // Single char bool (t, T, f, F) is ok - if i-start == 1 { - return i, buf[start:i], nil - } - - // length must be 4 for true or TRUE - if (buf[start] == 't' || buf[start] == 'T') && i-start != 4 { - return i, buf[start:i], makeError("invalid boolean", buf, i) - } - - // length must be 5 for false or FALSE - if (buf[start] == 'f' || buf[start] == 'F') && i-start != 5 { - return i, buf[start:i], makeError("invalid boolean", buf, i) - } - - // Otherwise - valid := false - switch buf[start] { - case 't': - valid = bytes.Equal(buf[start:i], []byte("true")) - case 'f': - valid = bytes.Equal(buf[start:i], []byte("false")) - case 'T': - valid = bytes.Equal(buf[start:i], []byte("TRUE")) || bytes.Equal(buf[start:i], []byte("True")) - case 'F': - valid = bytes.Equal(buf[start:i], []byte("FALSE")) || bytes.Equal(buf[start:i], []byte("False")) - } - - if !valid { - return i, buf[start:i], makeError("invalid boolean", buf, i) - } - - return i, buf[start:i], nil - -} - -// skipWhitespace returns the end position within buf, starting at i after -// scanning over spaces in tags -func skipWhitespace(buf []byte, i int) int { - for i < len(buf) { - if buf[i] != ' ' && buf[i] != '\t' && buf[i] != 0 { - break - } - i++ - } - return i -} - -// makeError is a helper function for making a metric parsing error. -// reason is the reason why the error occurred. -// buf should be the current buffer we are parsing. -// i is the current index, to give some context on where in the buffer we are. -func makeError(reason string, buf []byte, i int) error { - return fmt.Errorf("metric parsing error, reason: [%s], buffer: [%s], index: [%d]", - reason, buf, i) -} - -// getPrecisionMultiplier will return a multiplier for the precision specified. -func getPrecisionMultiplier(precision string) int64 { - d := time.Nanosecond - switch precision { - case "u": - d = time.Microsecond - case "ms": - d = time.Millisecond - case "s": - d = time.Second - case "m": - d = time.Minute - case "h": - d = time.Hour - } - return int64(d) -} diff --git a/metric/parse_test.go b/metric/parse_test.go deleted file mode 100644 index 27185224a..000000000 --- a/metric/parse_test.go +++ /dev/null @@ -1,413 +0,0 @@ -package metric - -import ( - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -const trues = `booltest b=T -booltest b=t -booltest b=True -booltest b=TRUE -booltest b=true -` - -const falses = `booltest b=F -booltest b=f -booltest b=False -booltest b=FALSE -booltest b=false -` - -const withEscapes = `w\,\ eather,host=local temp=99 1465839830100400200 -w\,eather,host=local temp=99 1465839830100400200 -weather,location=us\,midwest temperature=82 1465839830100400200 -weather,location=us-midwest temp\=rature=82 1465839830100400200 -weather,location\ place=us-midwest temperature=82 1465839830100400200 -weather,location=us-midwest temperature="too\"hot\"" 1465839830100400200 -` - -const withTimestamps = `cpu usage=99 1480595849000000000 -cpu usage=99 1480595850000000000 -cpu usage=99 1480595851700030000 -cpu usage=99 1480595852000000300 -` - -const sevenMetrics = `cpu,host=foo,datacenter=us-east idle=99,busy=1i,b=true,s="string" -cpu,host=foo,datacenter=us-east idle=99,busy=1i,b=true,s="string" -cpu,host=foo,datacenter=us-east idle=99,busy=1i,b=true,s="string" -cpu,host=foo,datacenter=us-east idle=99,busy=1i,b=true,s="string" -cpu,host=foo,datacenter=us-east idle=99,busy=1i,b=true,s="string" -cpu,host=foo,datacenter=us-east idle=99,busy=1i,b=true,s="string" -cpu,host=foo,datacenter=us-east idle=99,busy=1i,b=true,s="string" -` - -const negMetrics = `weather,host=local temp=-99i,temp_float=-99.4 1465839830100400200 -` - -// some metrics are invalid -const someInvalid = `cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,cpu=cpu3, host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,cpu=cpu4 , usage_idle=99,usage_busy=1 -cpu 1480595852000000300 -cpu usage=99 1480595852foobar300 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -` - -func TestParse(t *testing.T) { - start := time.Now() - metrics, err := Parse([]byte(sevenMetrics)) - assert.NoError(t, err) - assert.Len(t, metrics, 7) - - // all metrics parsed together w/o a timestamp should have the same time. - firstTime := metrics[0].Time() - for _, m := range metrics { - assert.Equal(t, - map[string]interface{}{ - "idle": float64(99), - "busy": int64(1), - "b": true, - "s": "string", - }, - m.Fields(), - ) - assert.Equal(t, - map[string]string{ - "host": "foo", - "datacenter": "us-east", - }, - m.Tags(), - ) - assert.True(t, m.Time().After(start)) - assert.True(t, m.Time().Equal(firstTime)) - } -} - -func TestParseNegNumbers(t *testing.T) { - metrics, err := Parse([]byte(negMetrics)) - assert.NoError(t, err) - assert.Len(t, metrics, 1) - - assert.Equal(t, - map[string]interface{}{ - "temp": int64(-99), - "temp_float": float64(-99.4), - }, - metrics[0].Fields(), - ) - assert.Equal(t, - map[string]string{ - "host": "local", - }, - metrics[0].Tags(), - ) -} - -func TestParseErrors(t *testing.T) { - start := time.Now() - metrics, err := Parse([]byte(someInvalid)) - assert.Error(t, err) - assert.Len(t, metrics, 4) - - // all metrics parsed together w/o a timestamp should have the same time. - firstTime := metrics[0].Time() - for _, m := range metrics { - assert.Equal(t, - map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), - }, - m.Fields(), - ) - assert.Equal(t, - map[string]string{ - "host": "foo", - "datacenter": "us-east", - }, - m.Tags(), - ) - assert.True(t, m.Time().After(start)) - assert.True(t, m.Time().Equal(firstTime)) - } -} - -func TestParseWithTimestamps(t *testing.T) { - metrics, err := Parse([]byte(withTimestamps)) - assert.NoError(t, err) - assert.Len(t, metrics, 4) - - expectedTimestamps := []time.Time{ - time.Unix(0, 1480595849000000000), - time.Unix(0, 1480595850000000000), - time.Unix(0, 1480595851700030000), - time.Unix(0, 1480595852000000300), - } - - // all metrics parsed together w/o a timestamp should have the same time. - for i, m := range metrics { - assert.Equal(t, - map[string]interface{}{ - "usage": float64(99), - }, - m.Fields(), - ) - assert.True(t, m.Time().Equal(expectedTimestamps[i])) - } -} - -func TestParseEscapes(t *testing.T) { - metrics, err := Parse([]byte(withEscapes)) - assert.NoError(t, err) - assert.Len(t, metrics, 6) - - tests := []struct { - name string - fields map[string]interface{} - tags map[string]string - }{ - { - name: `w, eather`, - fields: map[string]interface{}{"temp": float64(99)}, - tags: map[string]string{"host": "local"}, - }, - { - name: `w,eather`, - fields: map[string]interface{}{"temp": float64(99)}, - tags: map[string]string{"host": "local"}, - }, - { - name: `weather`, - fields: map[string]interface{}{"temperature": float64(82)}, - tags: map[string]string{"location": `us,midwest`}, - }, - { - name: `weather`, - fields: map[string]interface{}{`temp=rature`: float64(82)}, - tags: map[string]string{"location": `us-midwest`}, - }, - { - name: `weather`, - fields: map[string]interface{}{"temperature": float64(82)}, - tags: map[string]string{`location place`: `us-midwest`}, - }, - { - name: `weather`, - fields: map[string]interface{}{`temperature`: `too"hot"`}, - tags: map[string]string{"location": `us-midwest`}, - }, - } - - for i, test := range tests { - assert.Equal(t, test.name, metrics[i].Name()) - assert.Equal(t, test.fields, metrics[i].Fields()) - assert.Equal(t, test.tags, metrics[i].Tags()) - } -} - -func TestParseTrueBooleans(t *testing.T) { - metrics, err := Parse([]byte(trues)) - assert.NoError(t, err) - assert.Len(t, metrics, 5) - - for _, metric := range metrics { - assert.Equal(t, "booltest", metric.Name()) - assert.Equal(t, true, metric.Fields()["b"]) - } -} - -func TestParseFalseBooleans(t *testing.T) { - metrics, err := Parse([]byte(falses)) - assert.NoError(t, err) - assert.Len(t, metrics, 5) - - for _, metric := range metrics { - assert.Equal(t, "booltest", metric.Name()) - assert.Equal(t, false, metric.Fields()["b"]) - } -} - -func TestParsePointBadNumber(t *testing.T) { - for _, tt := range []string{ - "cpu v=- ", - "cpu v=-i ", - "cpu v=-. ", - "cpu v=. ", - "cpu v=1.0i ", - "cpu v=1ii ", - "cpu v=1a ", - "cpu v=-e-e-e ", - "cpu v=42+3 ", - "cpu v= ", - } { - _, err := Parse([]byte(tt + "\n")) - assert.Error(t, err, tt) - } -} - -func TestParseTagsMissingParts(t *testing.T) { - for _, tt := range []string{ - `cpu,host`, - `cpu,host,`, - `cpu,host=`, - `cpu,f=oo=bar value=1`, - `cpu,host value=1i`, - `cpu,host=serverA,region value=1i`, - `cpu,host=serverA,region= value=1i`, - `cpu,host=serverA,region=,zone=us-west value=1i`, - `cpu, value=1`, - `cpu, ,,`, - `cpu,,,`, - `cpu,host=serverA,=us-east value=1i`, - `cpu,host=serverAa\,,=us-east value=1i`, - `cpu,host=serverA\,,=us-east value=1i`, - `cpu, =serverA value=1i`, - } { - _, err := Parse([]byte(tt + "\n")) - assert.Error(t, err, tt) - } -} - -func TestParsePointWhitespace(t *testing.T) { - for _, tt := range []string{ - `cpu value=1.0 1257894000000000000`, - `cpu value=1.0 1257894000000000000`, - `cpu value=1.0 1257894000000000000`, - `cpu value=1.0 1257894000000000000 `, - } { - m, err := Parse([]byte(tt + "\n")) - assert.NoError(t, err, tt) - assert.Equal(t, "cpu", m[0].Name()) - assert.Equal(t, map[string]interface{}{"value": float64(1)}, m[0].Fields()) - } -} - -func TestParsePointInvalidFields(t *testing.T) { - for _, tt := range []string{ - "test,foo=bar a=101,=value", - "test,foo=bar =value", - "test,foo=bar a=101,key=", - "test,foo=bar key=", - `test,foo=bar a=101,b="foo`, - } { - _, err := Parse([]byte(tt + "\n")) - assert.Error(t, err, tt) - } -} - -func TestParsePointNoFields(t *testing.T) { - for _, tt := range []string{ - "cpu_load_short,host=server01,region=us-west", - "very_long_measurement_name", - "cpu,host==", - "============", - "cpu", - "cpu\n\n\n\n\n\n\n", - " ", - } { - _, err := Parse([]byte(tt + "\n")) - assert.Error(t, err, tt) - } -} - -// a b=1 << this is the shortest possible metric -// any shorter is just ignored -func TestParseBufTooShort(t *testing.T) { - for _, tt := range []string{ - "", - "a", - "a ", - "a b=", - } { - _, err := Parse([]byte(tt + "\n")) - assert.Error(t, err, tt) - } -} - -func TestParseInvalidBooleans(t *testing.T) { - for _, tt := range []string{ - "test b=tru", - "test b=fals", - "test b=faLse", - "test q=foo", - "test b=lambchops", - } { - _, err := Parse([]byte(tt + "\n")) - assert.Error(t, err, tt) - } -} - -func TestParseInvalidNumbers(t *testing.T) { - for _, tt := range []string{ - "test b=-", - "test b=1.1.1", - "test b=nan", - "test b=9i10", - "test b=9999999999999999999i", - } { - _, err := Parse([]byte(tt + "\n")) - assert.Error(t, err, tt) - } -} - -func TestParseNegativeTimestamps(t *testing.T) { - for _, tt := range []string{ - "test foo=101 -1257894000000000000", - } { - metrics, err := Parse([]byte(tt + "\n")) - assert.NoError(t, err, tt) - assert.True(t, metrics[0].Time().Equal(time.Unix(0, -1257894000000000000))) - } -} - -func TestParsePrecision(t *testing.T) { - for _, tt := range []struct { - line string - precision string - expected int64 - }{ - {"test v=42 1491847420", "s", 1491847420000000000}, - {"test v=42 1491847420123", "ms", 1491847420123000000}, - {"test v=42 1491847420123456", "u", 1491847420123456000}, - {"test v=42 1491847420123456789", "ns", 1491847420123456789}, - - {"test v=42 1491847420123456789", "1s", 1491847420123456789}, - {"test v=42 1491847420123456789", "asdf", 1491847420123456789}, - } { - metrics, err := ParseWithDefaultTimePrecision( - []byte(tt.line+"\n"), time.Now(), tt.precision) - assert.NoError(t, err) - assert.Equal(t, tt.expected, metrics[0].UnixNano()) - } -} - -func TestParsePrecisionUnsetTime(t *testing.T) { - for _, tt := range []struct { - line string - precision string - }{ - {"test v=42", "s"}, - {"test v=42", "ns"}, - } { - _, err := ParseWithDefaultTimePrecision( - []byte(tt.line+"\n"), time.Now(), tt.precision) - assert.NoError(t, err) - } -} - -func TestParseMaxKeyLength(t *testing.T) { - key := "" - for { - if len(key) > MaxKeyLength { - break - } - key += "test" - } - - _, err := Parse([]byte(key + " value=1\n")) - assert.Error(t, err) -} diff --git a/metric/reader.go b/metric/reader.go deleted file mode 100644 index ef9d2977d..000000000 --- a/metric/reader.go +++ /dev/null @@ -1,159 +0,0 @@ -package metric - -import ( - "io" - - "github.com/influxdata/telegraf" -) - -type state int - -const ( - _ state = iota - // normal state copies whole metrics into the given buffer until we can't - // fit the next metric. - normal - // split state means that we have a metric that we were able to split, so - // that we can fit it into multiple metrics (and calls to Read) - split - // overflow state means that we have a metric that didn't fit into a single - // buffer, and needs to be split across multiple calls to Read. - overflow - // splitOverflow state means that a split metric didn't fit into a single - // buffer, and needs to be split across multiple calls to Read. - splitOverflow - // done means we're done reading metrics, and now always return (0, io.EOF) - done -) - -type reader struct { - metrics []telegraf.Metric - splitMetrics []telegraf.Metric - buf []byte - state state - - // metric index - iM int - // split metric index - iSM int - // buffer index - iB int -} - -func NewReader(metrics []telegraf.Metric) io.Reader { - return &reader{ - metrics: metrics, - state: normal, - } -} - -func (r *reader) Read(p []byte) (n int, err error) { - var i int - switch r.state { - case done: - return 0, io.EOF - case normal: - for { - // this for-loop is the sunny-day scenario, where we are given a - // buffer that is large enough to hold at least a single metric. - // all of the cases below it are edge-cases. - if r.metrics[r.iM].Len() <= len(p[i:]) { - i += r.metrics[r.iM].SerializeTo(p[i:]) - } else { - break - } - r.iM++ - if r.iM == len(r.metrics) { - r.state = done - return i, io.EOF - } - } - - // if we haven't written any bytes, check if we can split the current - // metric into multiple full metrics at a smaller size. - if i == 0 { - tmp := r.metrics[r.iM].Split(len(p)) - if len(tmp) > 1 { - r.splitMetrics = tmp - r.state = split - if r.splitMetrics[0].Len() <= len(p) { - i += r.splitMetrics[0].SerializeTo(p) - r.iSM = 1 - } else { - // splitting didn't quite work, so we'll drop down and - // overflow the metric. - r.state = normal - r.iSM = 0 - } - } - } - - // if we haven't written any bytes and we're not at the end of the metrics - // slice, then it means we have a single metric that is larger than the - // provided buffer. - if i == 0 { - r.buf = r.metrics[r.iM].Serialize() - i += copy(p, r.buf[r.iB:]) - r.iB += i - r.state = overflow - } - - case split: - if r.splitMetrics[r.iSM].Len() <= len(p) { - // write the current split metric - i += r.splitMetrics[r.iSM].SerializeTo(p) - r.iSM++ - if r.iSM >= len(r.splitMetrics) { - // done writing the current split metrics - r.iSM = 0 - r.iM++ - if r.iM == len(r.metrics) { - r.state = done - return i, io.EOF - } - r.state = normal - } - } else { - // This would only happen if we split the metric, and then a - // subsequent buffer was smaller than the initial one given, - // so that our split metric no longer fits. - r.buf = r.splitMetrics[r.iSM].Serialize() - i += copy(p, r.buf[r.iB:]) - r.iB += i - r.state = splitOverflow - } - - case splitOverflow: - i = copy(p, r.buf[r.iB:]) - r.iB += i - if r.iB >= len(r.buf) { - r.iB = 0 - r.iSM++ - if r.iSM == len(r.splitMetrics) { - r.iM++ - if r.iM == len(r.metrics) { - r.state = done - return i, io.EOF - } - r.state = normal - } else { - r.state = split - } - } - - case overflow: - i = copy(p, r.buf[r.iB:]) - r.iB += i - if r.iB >= len(r.buf) { - r.iB = 0 - r.iM++ - if r.iM == len(r.metrics) { - r.state = done - return i, io.EOF - } - r.state = normal - } - } - - return i, nil -} diff --git a/metric/reader_test.go b/metric/reader_test.go deleted file mode 100644 index 1f2ffd6ea..000000000 --- a/metric/reader_test.go +++ /dev/null @@ -1,713 +0,0 @@ -package metric - -import ( - "io" - "io/ioutil" - "regexp" - "strings" - "testing" - "time" - - "github.com/influxdata/telegraf" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func BenchmarkMetricReader(b *testing.B) { - metrics := make([]telegraf.Metric, 10) - for i := 0; i < 10; i++ { - metrics[i], _ = New("foo", map[string]string{}, - map[string]interface{}{"value": int64(1)}, time.Now()) - } - for n := 0; n < b.N; n++ { - r := NewReader(metrics) - io.Copy(ioutil.Discard, r) - } -} - -func TestMetricReader(t *testing.T) { - ts := time.Unix(1481032190, 0) - metrics := make([]telegraf.Metric, 10) - for i := 0; i < 10; i++ { - metrics[i], _ = New("foo", map[string]string{}, - map[string]interface{}{"value": int64(1)}, ts) - } - - r := NewReader(metrics) - - buf := make([]byte, 35) - for i := 0; i < 10; i++ { - n, err := r.Read(buf) - if err != nil { - assert.True(t, err == io.EOF, err.Error()) - } - assert.Equal(t, 33, n) - assert.Equal(t, "foo value=1i 1481032190000000000\n", string(buf[0:n])) - } - - // reader should now be done, and always return 0, io.EOF - for i := 0; i < 10; i++ { - n, err := r.Read(buf) - assert.True(t, err == io.EOF, err.Error()) - assert.Equal(t, 0, n) - } -} - -func TestMetricReader_OverflowMetric(t *testing.T) { - ts := time.Unix(1481032190, 0) - m, _ := New("foo", map[string]string{}, - map[string]interface{}{"value": int64(10)}, ts) - metrics := []telegraf.Metric{m} - - r := NewReader(metrics) - buf := make([]byte, 5) - - tests := []struct { - exp string - err error - n int - }{ - { - "foo v", - nil, - 5, - }, - { - "alue=", - nil, - 5, - }, - { - "10i 1", - nil, - 5, - }, - { - "48103", - nil, - 5, - }, - { - "21900", - nil, - 5, - }, - { - "00000", - nil, - 5, - }, - { - "000\n", - io.EOF, - 4, - }, - { - "", - io.EOF, - 0, - }, - } - - for _, test := range tests { - n, err := r.Read(buf) - assert.Equal(t, test.n, n) - assert.Equal(t, test.exp, string(buf[0:n])) - assert.Equal(t, test.err, err) - } -} - -// Regression test for when a metric is the same size as the buffer. -// -// Previously EOF would not be set until the next call to Read. -func TestMetricReader_MetricSizeEqualsBufferSize(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{"a": int64(1)}, ts) - metrics := []telegraf.Metric{m1} - - r := NewReader(metrics) - buf := make([]byte, m1.Len()) - - for { - n, err := r.Read(buf) - // Should never read 0 bytes unless at EOF, unless input buffer is 0 length - if n == 0 { - require.Equal(t, io.EOF, err) - break - } - // Lines should be terminated with a LF - if err == io.EOF { - require.Equal(t, uint8('\n'), buf[n-1]) - break - } - require.NoError(t, err) - } -} - -// Regression test for when a metric requires to be split and one of the -// split metrics is exactly the size of the buffer. -// -// Previously an empty string would be returned on the next Read without error, -// and then next Read call would panic. -func TestMetricReader_SplitWithExactLengthSplit(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{"a": int64(1), "bb": int64(2)}, ts) - metrics := []telegraf.Metric{m1} - - r := NewReader(metrics) - buf := make([]byte, 30) - - // foo a=1i,bb=2i 1481032190000000000\n // len 35 - // - // Requires this specific split order: - // foo a=1i 1481032190000000000\n // len 29 - // foo bb=2i 1481032190000000000\n // len 30 - - for { - n, err := r.Read(buf) - // Should never read 0 bytes unless at EOF, unless input buffer is 0 length - if n == 0 { - require.Equal(t, io.EOF, err) - break - } - // Lines should be terminated with a LF - if err == io.EOF { - require.Equal(t, uint8('\n'), buf[n-1]) - break - } - require.NoError(t, err) - } -} - -// Regression test for when a metric requires to be split and one of the -// split metrics is larger than the buffer. -// -// Previously the metric index would be set incorrectly causing a panic. -func TestMetricReader_SplitOverflowOversized(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "a": int64(1), - "bbb": int64(2), - }, ts) - metrics := []telegraf.Metric{m1} - - r := NewReader(metrics) - buf := make([]byte, 30) - - // foo a=1i,bbb=2i 1481032190000000000\n // len 36 - // - // foo a=1i 1481032190000000000\n // len 29 - // foo bbb=2i 1481032190000000000\n // len 31 - - for { - n, err := r.Read(buf) - // Should never read 0 bytes unless at EOF, unless input buffer is 0 length - if n == 0 { - require.Equal(t, io.EOF, err) - break - } - // Lines should be terminated with a LF - if err == io.EOF { - require.Equal(t, uint8('\n'), buf[n-1]) - break - } - require.NoError(t, err) - } -} - -// Regression test for when a split metric exactly fits in the buffer. -// -// Previously the metric would be overflow split when not required. -func TestMetricReader_SplitOverflowUneeded(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{"a": int64(1), "b": int64(2)}, ts) - metrics := []telegraf.Metric{m1} - - r := NewReader(metrics) - buf := make([]byte, 29) - - // foo a=1i,b=2i 1481032190000000000\n // len 34 - // - // foo a=1i 1481032190000000000\n // len 29 - // foo b=2i 1481032190000000000\n // len 29 - - for { - n, err := r.Read(buf) - // Should never read 0 bytes unless at EOF, unless input buffer is 0 length - if n == 0 { - require.Equal(t, io.EOF, err) - break - } - // Lines should be terminated with a LF - if err == io.EOF { - require.Equal(t, uint8('\n'), buf[n-1]) - break - } - require.NoError(t, err) - } -} - -func TestMetricReader_OverflowMultipleMetrics(t *testing.T) { - ts := time.Unix(1481032190, 0) - m, _ := New("foo", map[string]string{}, - map[string]interface{}{"value": int64(10)}, ts) - metrics := []telegraf.Metric{m, m.Copy()} - - r := NewReader(metrics) - buf := make([]byte, 10) - - tests := []struct { - exp string - err error - n int - }{ - { - "foo value=", - nil, - 10, - }, - { - "10i 148103", - nil, - 10, - }, - { - "2190000000", - nil, - 10, - }, - { - "000\n", - nil, - 4, - }, - { - "foo value=", - nil, - 10, - }, - { - "10i 148103", - nil, - 10, - }, - { - "2190000000", - nil, - 10, - }, - { - "000\n", - io.EOF, - 4, - }, - { - "", - io.EOF, - 0, - }, - } - - for _, test := range tests { - n, err := r.Read(buf) - assert.Equal(t, test.n, n) - assert.Equal(t, test.exp, string(buf[0:n])) - assert.Equal(t, test.err, err) - } -} - -// test splitting a metric -func TestMetricReader_SplitMetric(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "value1": int64(10), - "value2": int64(10), - "value3": int64(10), - "value4": int64(10), - "value5": int64(10), - "value6": int64(10), - }, - ts, - ) - metrics := []telegraf.Metric{m1} - - r := NewReader(metrics) - buf := make([]byte, 60) - - tests := []struct { - expRegex string - err error - n int - }{ - { - `foo value\d=10i,value\d=10i,value\d=10i 1481032190000000000\n`, - nil, - 57, - }, - { - `foo value\d=10i,value\d=10i,value\d=10i 1481032190000000000\n`, - io.EOF, - 57, - }, - { - "", - io.EOF, - 0, - }, - } - - for _, test := range tests { - n, err := r.Read(buf) - assert.Equal(t, test.n, n) - re := regexp.MustCompile(test.expRegex) - assert.True(t, re.MatchString(string(buf[0:n])), string(buf[0:n])) - assert.Equal(t, test.err, err) - } -} - -// test an array with one split metric and one unsplit -func TestMetricReader_SplitMetric2(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "value1": int64(10), - "value2": int64(10), - "value3": int64(10), - "value4": int64(10), - "value5": int64(10), - "value6": int64(10), - }, - ts, - ) - m2, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "value1": int64(10), - }, - ts, - ) - metrics := []telegraf.Metric{m1, m2} - - r := NewReader(metrics) - buf := make([]byte, 60) - - tests := []struct { - expRegex string - err error - n int - }{ - { - `foo value\d=10i,value\d=10i,value\d=10i 1481032190000000000\n`, - nil, - 57, - }, - { - `foo value\d=10i,value\d=10i,value\d=10i 1481032190000000000\n`, - nil, - 57, - }, - { - `foo value1=10i 1481032190000000000\n`, - io.EOF, - 35, - }, - { - "", - io.EOF, - 0, - }, - } - - for _, test := range tests { - n, err := r.Read(buf) - assert.Equal(t, test.n, n) - re := regexp.MustCompile(test.expRegex) - assert.True(t, re.MatchString(string(buf[0:n])), string(buf[0:n])) - assert.Equal(t, test.err, err) - } -} - -// test split that results in metrics that are still too long, which results in -// the reader falling back to regular overflow. -func TestMetricReader_SplitMetricTooLong(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "value1": int64(10), - "value2": int64(10), - }, - ts, - ) - metrics := []telegraf.Metric{m1} - - r := NewReader(metrics) - buf := make([]byte, 30) - - tests := []struct { - expRegex string - err error - n int - }{ - { - `foo value\d=10i,value\d=10i 1481`, - nil, - 30, - }, - { - `032190000000000\n`, - io.EOF, - 16, - }, - { - "", - io.EOF, - 0, - }, - } - - for _, test := range tests { - n, err := r.Read(buf) - assert.Equal(t, test.n, n) - re := regexp.MustCompile(test.expRegex) - assert.True(t, re.MatchString(string(buf[0:n])), string(buf[0:n])) - assert.Equal(t, test.err, err) - } -} - -// test split with a changing buffer size in the middle of subsequent calls -// to Read -func TestMetricReader_SplitMetricChangingBuffer(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "value1": int64(10), - "value2": int64(10), - "value3": int64(10), - }, - ts, - ) - m2, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "value1": int64(10), - }, - ts, - ) - metrics := []telegraf.Metric{m1, m2} - - r := NewReader(metrics) - - tests := []struct { - expRegex string - err error - n int - buf []byte - }{ - { - `foo value\d=10i 1481032190000000000\n`, - nil, - 35, - make([]byte, 36), - }, - { - `foo value\d=10i 148103219000000`, - nil, - 30, - make([]byte, 30), - }, - { - `0000\n`, - nil, - 5, - make([]byte, 30), - }, - { - `foo value\d=10i 1481032190000000000\n`, - nil, - 35, - make([]byte, 36), - }, - { - `foo value1=10i 1481032190000000000\n`, - io.EOF, - 35, - make([]byte, 36), - }, - { - "", - io.EOF, - 0, - make([]byte, 36), - }, - } - - for _, test := range tests { - n, err := r.Read(test.buf) - assert.Equal(t, test.n, n, test.expRegex) - re := regexp.MustCompile(test.expRegex) - assert.True(t, re.MatchString(string(test.buf[0:n])), string(test.buf[0:n])) - assert.Equal(t, test.err, err, test.expRegex) - } -} - -// test split with a changing buffer size in the middle of subsequent calls -// to Read -func TestMetricReader_SplitMetricChangingBuffer2(t *testing.T) { - ts := time.Unix(1481032190, 0) - m1, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "value1": int64(10), - "value2": int64(10), - }, - ts, - ) - m2, _ := New("foo", map[string]string{}, - map[string]interface{}{ - "value1": int64(10), - }, - ts, - ) - metrics := []telegraf.Metric{m1, m2} - - r := NewReader(metrics) - - tests := []struct { - expRegex string - err error - n int - buf []byte - }{ - { - `foo value\d=10i 1481032190000000000\n`, - nil, - 35, - make([]byte, 36), - }, - { - `foo value\d=10i 148103219000000`, - nil, - 30, - make([]byte, 30), - }, - { - `0000\n`, - nil, - 5, - make([]byte, 30), - }, - { - `foo value1=10i 1481032190000000000\n`, - io.EOF, - 35, - make([]byte, 36), - }, - { - "", - io.EOF, - 0, - make([]byte, 36), - }, - } - - for _, test := range tests { - n, err := r.Read(test.buf) - assert.Equal(t, test.n, n, test.expRegex) - re := regexp.MustCompile(test.expRegex) - assert.True(t, re.MatchString(string(test.buf[0:n])), string(test.buf[0:n])) - assert.Equal(t, test.err, err, test.expRegex) - } -} - -func TestReader_Read(t *testing.T) { - epoch := time.Unix(0, 0) - - type args struct { - name string - tags map[string]string - fields map[string]interface{} - t time.Time - mType []telegraf.ValueType - } - tests := []struct { - name string - args args - expected []byte - }{ - { - name: "escape backslashes in string field", - args: args{ - name: "cpu", - tags: map[string]string{}, - fields: map[string]interface{}{"value": `test\`}, - t: epoch, - }, - expected: []byte(`cpu value="test\\" 0`), - }, - { - name: "escape quote in string field", - args: args{ - name: "cpu", - tags: map[string]string{}, - fields: map[string]interface{}{"value": `test"`}, - t: epoch, - }, - expected: []byte(`cpu value="test\"" 0`), - }, - { - name: "escape quote and backslash in string field", - args: args{ - name: "cpu", - tags: map[string]string{}, - fields: map[string]interface{}{"value": `test\"`}, - t: epoch, - }, - expected: []byte(`cpu value="test\\\"" 0`), - }, - { - name: "escape multiple backslash in string field", - args: args{ - name: "cpu", - tags: map[string]string{}, - fields: map[string]interface{}{"value": `test\\`}, - t: epoch, - }, - expected: []byte(`cpu value="test\\\\" 0`), - }, - } - - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - buf := make([]byte, 512) - m, err := New(tt.args.name, tt.args.tags, tt.args.fields, tt.args.t, tt.args.mType...) - require.NoError(t, err) - - r := NewReader([]telegraf.Metric{m}) - num, err := r.Read(buf) - if err != io.EOF { - require.NoError(t, err) - } - line := string(buf[:num]) - // This is done so that we can use raw strings in the test spec - noeol := strings.TrimRight(line, "\n") - require.Equal(t, string(tt.expected), noeol) - require.Equal(t, len(tt.expected)+1, num) - }) - } -} - -func TestMetricRoundtrip(t *testing.T) { - const lp = `nstat,bu=linux,cls=server,dc=cer,env=production,host=hostname,name=netstat,sr=database IpExtInBcastOctets=12570626154i,IpExtInBcastPkts=95541226i,IpExtInCEPkts=0i,IpExtInCsumErrors=0i,IpExtInECT0Pkts=55674i,IpExtInECT1Pkts=0i,IpExtInMcastOctets=5928296i,IpExtInMcastPkts=174365i,IpExtInNoECTPkts=17965863529i,IpExtInNoRoutes=20i,IpExtInOctets=3334866321815i,IpExtInTruncatedPkts=0i,IpExtOutBcastOctets=0i,IpExtOutBcastPkts=0i,IpExtOutMcastOctets=0i,IpExtOutMcastPkts=0i,IpExtOutOctets=31397892391399i,TcpExtArpFilter=0i,TcpExtBusyPollRxPackets=0i,TcpExtDelayedACKLocked=14094i,TcpExtDelayedACKLost=302083i,TcpExtDelayedACKs=55486507i,TcpExtEmbryonicRsts=11879i,TcpExtIPReversePathFilter=0i,TcpExtListenDrops=1736i,TcpExtListenOverflows=0i,TcpExtLockDroppedIcmps=0i,TcpExtOfoPruned=0i,TcpExtOutOfWindowIcmps=8i,TcpExtPAWSActive=0i,TcpExtPAWSEstab=974i,TcpExtPAWSPassive=0i,TcpExtPruneCalled=0i,TcpExtRcvPruned=0i,TcpExtSyncookiesFailed=12593i,TcpExtSyncookiesRecv=0i,TcpExtSyncookiesSent=0i,TcpExtTCPACKSkippedChallenge=0i,TcpExtTCPACKSkippedFinWait2=0i,TcpExtTCPACKSkippedPAWS=806i,TcpExtTCPACKSkippedSeq=519i,TcpExtTCPACKSkippedSynRecv=0i,TcpExtTCPACKSkippedTimeWait=0i,TcpExtTCPAbortFailed=0i,TcpExtTCPAbortOnClose=22i,TcpExtTCPAbortOnData=36593i,TcpExtTCPAbortOnLinger=0i,TcpExtTCPAbortOnMemory=0i,TcpExtTCPAbortOnTimeout=674i,TcpExtTCPAutoCorking=494253233i,TcpExtTCPBacklogDrop=0i,TcpExtTCPChallengeACK=281i,TcpExtTCPDSACKIgnoredNoUndo=93354i,TcpExtTCPDSACKIgnoredOld=336i,TcpExtTCPDSACKOfoRecv=0i,TcpExtTCPDSACKOfoSent=7i,TcpExtTCPDSACKOldSent=302073i,TcpExtTCPDSACKRecv=215884i,TcpExtTCPDSACKUndo=7633i,TcpExtTCPDeferAcceptDrop=0i,TcpExtTCPDirectCopyFromBacklog=0i,TcpExtTCPDirectCopyFromPrequeue=0i,TcpExtTCPFACKReorder=1320i,TcpExtTCPFastOpenActive=0i,TcpExtTCPFastOpenActiveFail=0i,TcpExtTCPFastOpenCookieReqd=0i,TcpExtTCPFastOpenListenOverflow=0i,TcpExtTCPFastOpenPassive=0i,TcpExtTCPFastOpenPassiveFail=0i,TcpExtTCPFastRetrans=350681i,TcpExtTCPForwardRetrans=142168i,TcpExtTCPFromZeroWindowAdv=4317i,TcpExtTCPFullUndo=29502i,TcpExtTCPHPAcks=10267073000i,TcpExtTCPHPHits=5629837098i,TcpExtTCPHPHitsToUser=0i,TcpExtTCPHystartDelayCwnd=285127i,TcpExtTCPHystartDelayDetect=12318i,TcpExtTCPHystartTrainCwnd=69160570i,TcpExtTCPHystartTrainDetect=3315799i,TcpExtTCPLossFailures=109i,TcpExtTCPLossProbeRecovery=110819i,TcpExtTCPLossProbes=233995i,TcpExtTCPLossUndo=5276i,TcpExtTCPLostRetransmit=397i,TcpExtTCPMD5NotFound=0i,TcpExtTCPMD5Unexpected=0i,TcpExtTCPMemoryPressures=0i,TcpExtTCPMinTTLDrop=0i,TcpExtTCPOFODrop=0i,TcpExtTCPOFOMerge=7i,TcpExtTCPOFOQueue=15196i,TcpExtTCPOrigDataSent=29055119435i,TcpExtTCPPartialUndo=21320i,TcpExtTCPPrequeueDropped=0i,TcpExtTCPPrequeued=0i,TcpExtTCPPureAcks=1236441827i,TcpExtTCPRcvCoalesce=225590473i,TcpExtTCPRcvCollapsed=0i,TcpExtTCPRenoFailures=0i,TcpExtTCPRenoRecovery=0i,TcpExtTCPRenoRecoveryFail=0i,TcpExtTCPRenoReorder=0i,TcpExtTCPReqQFullDoCookies=0i,TcpExtTCPReqQFullDrop=0i,TcpExtTCPRetransFail=41i,TcpExtTCPSACKDiscard=0i,TcpExtTCPSACKReneging=0i,TcpExtTCPSACKReorder=4307i,TcpExtTCPSYNChallenge=244i,TcpExtTCPSackFailures=1698i,TcpExtTCPSackMerged=184668i,TcpExtTCPSackRecovery=97369i,TcpExtTCPSackRecoveryFail=381i,TcpExtTCPSackShiftFallback=2697079i,TcpExtTCPSackShifted=760299i,TcpExtTCPSchedulerFailed=0i,TcpExtTCPSlowStartRetrans=9276i,TcpExtTCPSpuriousRTOs=959i,TcpExtTCPSpuriousRtxHostQueues=2973i,TcpExtTCPSynRetrans=200970i,TcpExtTCPTSReorder=15221i,TcpExtTCPTimeWaitOverflow=0i,TcpExtTCPTimeouts=70127i,TcpExtTCPToZeroWindowAdv=4317i,TcpExtTCPWantZeroWindowAdv=2133i,TcpExtTW=24809813i,TcpExtTWKilled=0i,TcpExtTWRecycled=0i 1496460785000000000 -nstat,bu=linux,cls=server,dc=cer,env=production,host=hostname,name=snmp,sr=database IcmpInAddrMaskReps=0i,IcmpInAddrMasks=90i,IcmpInCsumErrors=0i,IcmpInDestUnreachs=284401i,IcmpInEchoReps=9i,IcmpInEchos=1761912i,IcmpInErrors=407i,IcmpInMsgs=2047767i,IcmpInParmProbs=0i,IcmpInRedirects=0i,IcmpInSrcQuenchs=0i,IcmpInTimeExcds=46i,IcmpInTimestampReps=0i,IcmpInTimestamps=1309i,IcmpMsgInType0=9i,IcmpMsgInType11=46i,IcmpMsgInType13=1309i,IcmpMsgInType17=90i,IcmpMsgInType3=284401i,IcmpMsgInType8=1761912i,IcmpMsgOutType0=1761912i,IcmpMsgOutType14=1248i,IcmpMsgOutType3=108709i,IcmpMsgOutType8=9i,IcmpOutAddrMaskReps=0i,IcmpOutAddrMasks=0i,IcmpOutDestUnreachs=108709i,IcmpOutEchoReps=1761912i,IcmpOutEchos=9i,IcmpOutErrors=0i,IcmpOutMsgs=1871878i,IcmpOutParmProbs=0i,IcmpOutRedirects=0i,IcmpOutSrcQuenchs=0i,IcmpOutTimeExcds=0i,IcmpOutTimestampReps=1248i,IcmpOutTimestamps=0i,IpDefaultTTL=64i,IpForwDatagrams=0i,IpForwarding=2i,IpFragCreates=0i,IpFragFails=0i,IpFragOKs=0i,IpInAddrErrors=0i,IpInDelivers=17658795773i,IpInDiscards=0i,IpInHdrErrors=0i,IpInReceives=17659269339i,IpInUnknownProtos=0i,IpOutDiscards=236976i,IpOutNoRoutes=1009i,IpOutRequests=23466783734i,IpReasmFails=0i,IpReasmOKs=0i,IpReasmReqds=0i,IpReasmTimeout=0i,TcpActiveOpens=23308977i,TcpAttemptFails=3757543i,TcpCurrEstab=280i,TcpEstabResets=184792i,TcpInCsumErrors=0i,TcpInErrs=232i,TcpInSegs=17536573089i,TcpMaxConn=-1i,TcpOutRsts=4051451i,TcpOutSegs=29836254873i,TcpPassiveOpens=176546974i,TcpRetransSegs=878085i,TcpRtoAlgorithm=1i,TcpRtoMax=120000i,TcpRtoMin=200i,UdpInCsumErrors=0i,UdpInDatagrams=24441661i,UdpInErrors=0i,UdpLiteInCsumErrors=0i,UdpLiteInDatagrams=0i,UdpLiteInErrors=0i,UdpLiteNoPorts=0i,UdpLiteOutDatagrams=0i,UdpLiteRcvbufErrors=0i,UdpLiteSndbufErrors=0i,UdpNoPorts=17660i,UdpOutDatagrams=51807896i,UdpRcvbufErrors=0i,UdpSndbufErrors=236922i 1496460785000000000 -` - metrics, err := Parse([]byte(lp)) - require.NoError(t, err) - r := NewReader(metrics) - buf := make([]byte, 128) - _, err = r.Read(buf) - require.NoError(t, err) - metrics, err = Parse(buf) - require.NoError(t, err) -} diff --git a/plugins/inputs/exec/exec_test.go b/plugins/inputs/exec/exec_test.go index 52bcd1fb4..c7c181b17 100644 --- a/plugins/inputs/exec/exec_test.go +++ b/plugins/inputs/exec/exec_test.go @@ -144,83 +144,6 @@ func TestCommandError(t *testing.T) { assert.Equal(t, acc.NFields(), 0, "No new points should have been added") } -func TestLineProtocolParse(t *testing.T) { - parser, _ := parsers.NewInfluxParser() - e := &Exec{ - runner: newRunnerMock([]byte(lineProtocol), nil), - Commands: []string{"line-protocol"}, - parser: parser, - } - - var acc testutil.Accumulator - require.NoError(t, acc.GatherError(e.Gather)) - - fields := map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), - } - tags := map[string]string{ - "host": "foo", - "datacenter": "us-east", - } - acc.AssertContainsTaggedFields(t, "cpu", fields, tags) -} - -func TestLineProtocolEmptyParse(t *testing.T) { - parser, _ := parsers.NewInfluxParser() - e := &Exec{ - runner: newRunnerMock([]byte(lineProtocolEmpty), nil), - Commands: []string{"line-protocol"}, - parser: parser, - } - - var acc testutil.Accumulator - err := e.Gather(&acc) - require.NoError(t, err) -} - -func TestLineProtocolShortParse(t *testing.T) { - parser, _ := parsers.NewInfluxParser() - e := &Exec{ - runner: newRunnerMock([]byte(lineProtocolShort), nil), - Commands: []string{"line-protocol"}, - parser: parser, - } - - var acc testutil.Accumulator - err := acc.GatherError(e.Gather) - require.Error(t, err) - assert.Contains(t, err.Error(), "buffer too short", "A buffer too short error was expected") -} - -func TestLineProtocolParseMultiple(t *testing.T) { - parser, _ := parsers.NewInfluxParser() - e := &Exec{ - runner: newRunnerMock([]byte(lineProtocolMulti), nil), - Commands: []string{"line-protocol"}, - parser: parser, - } - - var acc testutil.Accumulator - err := acc.GatherError(e.Gather) - require.NoError(t, err) - - fields := map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), - } - tags := map[string]string{ - "host": "foo", - "datacenter": "us-east", - } - cpuTags := []string{"cpu0", "cpu1", "cpu2", "cpu3", "cpu4", "cpu5", "cpu6"} - - for _, cpu := range cpuTags { - tags["cpu"] = cpu - acc.AssertContainsTaggedFields(t, "cpu", fields, tags) - } -} - func TestExecCommandWithGlob(t *testing.T) { parser, _ := parsers.NewValueParser("metric", "string", nil) e := NewExec() diff --git a/plugins/inputs/http_listener/http_listener.go b/plugins/inputs/http_listener/http_listener.go index 834a0b2ab..cccd39472 100644 --- a/plugins/inputs/http_listener/http_listener.go +++ b/plugins/inputs/http_listener/http_listener.go @@ -53,9 +53,10 @@ type HTTPListener struct { listener net.Listener - parser influx.InfluxParser - acc telegraf.Accumulator - pool *pool + handler *influx.MetricHandler + parser *influx.Parser + acc telegraf.Accumulator + pool *pool BytesRecv selfstat.Stat RequestsServed selfstat.Stat @@ -176,6 +177,9 @@ func (h *HTTPListener) Start(acc telegraf.Accumulator) error { h.listener = listener h.Port = listener.Addr().(*net.TCPAddr).Port + h.handler = influx.NewMetricHandler() + h.parser = influx.NewParser(h.handler) + h.wg.Add(1) go func() { defer h.wg.Done() @@ -336,7 +340,11 @@ func (h *HTTPListener) serveWrite(res http.ResponseWriter, req *http.Request) { } func (h *HTTPListener) parse(b []byte, t time.Time, precision string) error { - metrics, err := h.parser.ParseWithDefaultTimePrecision(b, t, precision) + h.handler.SetPrecision(getPrecisionMultiplier(precision)) + metrics, err := h.parser.Parse(b) + if err != nil { + return err + } for _, m := range metrics { h.acc.AddFields(m.Name(), m.Fields(), m.Tags(), m.Time()) @@ -408,6 +416,23 @@ func (h *HTTPListener) AuthenticateIfSet(handler http.HandlerFunc, res http.Resp } } +func getPrecisionMultiplier(precision string) time.Duration { + d := time.Nanosecond + switch precision { + case "u": + d = time.Microsecond + case "ms": + d = time.Millisecond + case "s": + d = time.Second + case "m": + d = time.Minute + case "h": + d = time.Hour + } + return d +} + func init() { inputs.Add("http_listener", func() telegraf.Input { return &HTTPListener{ diff --git a/plugins/inputs/logparser/grok/grok.go b/plugins/inputs/logparser/grok/grok.go index 491a13748..66715ef37 100644 --- a/plugins/inputs/logparser/grok/grok.go +++ b/plugins/inputs/logparser/grok/grok.go @@ -326,6 +326,10 @@ func (p *Parser) ParseLine(line string) (telegraf.Metric, error) { } } + if len(fields) == 0 { + return nil, fmt.Errorf("logparser_grok: must have one or more fields") + } + return metric.New(p.Measurement, tags, fields, p.tsModder.tsMod(timestamp)) } diff --git a/plugins/inputs/logparser/grok/grok_test.go b/plugins/inputs/logparser/grok/grok_test.go index 480502d6c..e5e124b9c 100644 --- a/plugins/inputs/logparser/grok/grok_test.go +++ b/plugins/inputs/logparser/grok/grok_test.go @@ -799,7 +799,7 @@ func TestTimezoneEmptyCompileFileAndParse(t *testing.T) { }, metricA.Fields()) assert.Equal(t, map[string]string{"response_code": "200"}, metricA.Tags()) - assert.Equal(t, int64(1465040505000000000), metricA.UnixNano()) + assert.Equal(t, int64(1465040505000000000), metricA.Time().UnixNano()) metricB, err := p.ParseLine(`[04/06/2016--12:41:45] 1.25 mystring dropme nomodifier`) require.NotNil(t, metricB) @@ -812,7 +812,7 @@ func TestTimezoneEmptyCompileFileAndParse(t *testing.T) { }, metricB.Fields()) assert.Equal(t, map[string]string{}, metricB.Tags()) - assert.Equal(t, int64(1465044105000000000), metricB.UnixNano()) + assert.Equal(t, int64(1465044105000000000), metricB.Time().UnixNano()) } func TestTimezoneMalformedCompileFileAndParse(t *testing.T) { @@ -835,7 +835,7 @@ func TestTimezoneMalformedCompileFileAndParse(t *testing.T) { }, metricA.Fields()) assert.Equal(t, map[string]string{"response_code": "200"}, metricA.Tags()) - assert.Equal(t, int64(1465040505000000000), metricA.UnixNano()) + assert.Equal(t, int64(1465040505000000000), metricA.Time().UnixNano()) metricB, err := p.ParseLine(`[04/06/2016--12:41:45] 1.25 mystring dropme nomodifier`) require.NotNil(t, metricB) @@ -848,7 +848,7 @@ func TestTimezoneMalformedCompileFileAndParse(t *testing.T) { }, metricB.Fields()) assert.Equal(t, map[string]string{}, metricB.Tags()) - assert.Equal(t, int64(1465044105000000000), metricB.UnixNano()) + assert.Equal(t, int64(1465044105000000000), metricB.Time().UnixNano()) } func TestTimezoneEuropeCompileFileAndParse(t *testing.T) { @@ -871,7 +871,7 @@ func TestTimezoneEuropeCompileFileAndParse(t *testing.T) { }, metricA.Fields()) assert.Equal(t, map[string]string{"response_code": "200"}, metricA.Tags()) - assert.Equal(t, int64(1465040505000000000), metricA.UnixNano()) + assert.Equal(t, int64(1465040505000000000), metricA.Time().UnixNano()) metricB, err := p.ParseLine(`[04/06/2016--12:41:45] 1.25 mystring dropme nomodifier`) require.NotNil(t, metricB) @@ -884,7 +884,7 @@ func TestTimezoneEuropeCompileFileAndParse(t *testing.T) { }, metricB.Fields()) assert.Equal(t, map[string]string{}, metricB.Tags()) - assert.Equal(t, int64(1465036905000000000), metricB.UnixNano()) + assert.Equal(t, int64(1465036905000000000), metricB.Time().UnixNano()) } func TestTimezoneAmericasCompileFileAndParse(t *testing.T) { @@ -907,7 +907,7 @@ func TestTimezoneAmericasCompileFileAndParse(t *testing.T) { }, metricA.Fields()) assert.Equal(t, map[string]string{"response_code": "200"}, metricA.Tags()) - assert.Equal(t, int64(1465040505000000000), metricA.UnixNano()) + assert.Equal(t, int64(1465040505000000000), metricA.Time().UnixNano()) metricB, err := p.ParseLine(`[04/06/2016--12:41:45] 1.25 mystring dropme nomodifier`) require.NotNil(t, metricB) @@ -920,7 +920,7 @@ func TestTimezoneAmericasCompileFileAndParse(t *testing.T) { }, metricB.Fields()) assert.Equal(t, map[string]string{}, metricB.Tags()) - assert.Equal(t, int64(1465058505000000000), metricB.UnixNano()) + assert.Equal(t, int64(1465058505000000000), metricB.Time().UnixNano()) } func TestTimezoneLocalCompileFileAndParse(t *testing.T) { @@ -943,7 +943,7 @@ func TestTimezoneLocalCompileFileAndParse(t *testing.T) { }, metricA.Fields()) assert.Equal(t, map[string]string{"response_code": "200"}, metricA.Tags()) - assert.Equal(t, int64(1465040505000000000), metricA.UnixNano()) + assert.Equal(t, int64(1465040505000000000), metricA.Time().UnixNano()) metricB, err := p.ParseLine(`[04/06/2016--12:41:45] 1.25 mystring dropme nomodifier`) require.NotNil(t, metricB) @@ -956,5 +956,5 @@ func TestTimezoneLocalCompileFileAndParse(t *testing.T) { }, metricB.Fields()) assert.Equal(t, map[string]string{}, metricB.Tags()) - assert.Equal(t, time.Date(2016, time.June, 4, 12, 41, 45, 0, time.Local).UnixNano(), metricB.UnixNano()) + assert.Equal(t, time.Date(2016, time.June, 4, 12, 41, 45, 0, time.Local).UnixNano(), metricB.Time().UnixNano()) } diff --git a/plugins/inputs/nats_consumer/nats_consumer_test.go b/plugins/inputs/nats_consumer/nats_consumer_test.go index 30ba0d2af..a6897b714 100644 --- a/plugins/inputs/nats_consumer/nats_consumer_test.go +++ b/plugins/inputs/nats_consumer/nats_consumer_test.go @@ -59,7 +59,7 @@ func TestRunParserInvalidMsg(t *testing.T) { in <- natsMsg(invalidMsg) acc.WaitError(1) - assert.Contains(t, acc.Errors[0].Error(), "E! subject: telegraf, error: metric parsing error") + assert.Contains(t, acc.Errors[0].Error(), "E! subject: telegraf, error: metric parse error") assert.EqualValues(t, 0, acc.NMetrics()) } diff --git a/plugins/inputs/prometheus/parser_test.go b/plugins/inputs/prometheus/parser_test.go index 4f2a8516f..7b2bfeca2 100644 --- a/plugins/inputs/prometheus/parser_test.go +++ b/plugins/inputs/prometheus/parser_test.go @@ -111,9 +111,11 @@ func TestParseValidPrometheus(t *testing.T) { "gauge": float64(1), }, metrics[0].Fields()) assert.Equal(t, map[string]string{ - "osVersion": "CentOS Linux 7 (Core)", - "dockerVersion": "1.8.2", - "kernelVersion": "3.10.0-229.20.1.el7.x86_64", + "osVersion": "CentOS Linux 7 (Core)", + "cadvisorRevision": "", + "cadvisorVersion": "", + "dockerVersion": "1.8.2", + "kernelVersion": "3.10.0-229.20.1.el7.x86_64", }, metrics[0].Tags()) // Counter value diff --git a/plugins/inputs/udp_listener/udp_listener_test.go b/plugins/inputs/udp_listener/udp_listener_test.go index 4d78a1a42..e0e0e862e 100644 --- a/plugins/inputs/udp_listener/udp_listener_test.go +++ b/plugins/inputs/udp_listener/udp_listener_test.go @@ -47,11 +47,13 @@ func TestHighTrafficUDP(t *testing.T) { ServiceAddress: ":8126", AllowedPendingMessages: 100000, } - listener.parser, _ = parsers.NewInfluxParser() + var err error + listener.parser, err = parsers.NewInfluxParser() + require.NoError(t, err) acc := &testutil.Accumulator{} // send multiple messages to socket - err := listener.Start(acc) + err = listener.Start(acc) require.NoError(t, err) conn, err := net.Dial("udp", "127.0.0.1:8126") diff --git a/plugins/outputs/file/file.go b/plugins/outputs/file/file.go index 4f0bcca77..3a763b792 100644 --- a/plugins/outputs/file/file.go +++ b/plugins/outputs/file/file.go @@ -97,7 +97,7 @@ func (f *File) Write(metrics []telegraf.Metric) error { } _, err = f.writer.Write(b) if err != nil { - return fmt.Errorf("failed to write message: %s, %s", metric.Serialize(), err) + return fmt.Errorf("failed to write message: %s, %s", b, err) } } return nil diff --git a/plugins/outputs/graylog/graylog.go b/plugins/outputs/graylog/graylog.go index e77eae558..4b2c1693a 100644 --- a/plugins/outputs/graylog/graylog.go +++ b/plugins/outputs/graylog/graylog.go @@ -7,12 +7,13 @@ import ( "encoding/binary" ejson "encoding/json" "fmt" - "github.com/influxdata/telegraf" - "github.com/influxdata/telegraf/plugins/outputs" "io" "math" "net" "os" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/plugins/outputs" ) const ( @@ -212,7 +213,7 @@ func serialize(metric telegraf.Metric) ([]string, error) { m := make(map[string]interface{}) m["version"] = "1.1" - m["timestamp"] = metric.UnixNano() / 1000000000 + m["timestamp"] = metric.Time().UnixNano() / 1000000000 m["short_message"] = "telegraf" m["name"] = metric.Name() diff --git a/plugins/outputs/influxdb/README.md b/plugins/outputs/influxdb/README.md index 35f896523..9547292ed 100644 --- a/plugins/outputs/influxdb/README.md +++ b/plugins/outputs/influxdb/README.md @@ -1,35 +1,40 @@ # InfluxDB Output Plugin -This plugin writes to [InfluxDB](https://www.influxdb.com) via HTTP or UDP. +This InfluxDB output plugin writes metrics to the [InfluxDB](https://github.com/influxdata/influxdb) HTTP or UDP service. ### Configuration: ```toml -# Configuration for influxdb server to send metrics to +# Configuration for sending metrics to InfluxDB [[outputs.influxdb]] ## The full HTTP or UDP URL for your InfluxDB instance. ## - ## Multiple urls can be specified as part of the same cluster, - ## this means that only ONE of the urls will be written to each interval. - # urls = ["udp://127.0.0.1:8089"] # UDP endpoint example - urls = ["http://127.0.0.1:8086"] # required - ## The target database for metrics (telegraf will create it if not exists). - database = "telegraf" # required + ## Multiple URLs can be specified for a single cluster, only ONE of the + ## urls will be written to each interval. + # urls = ["udp://127.0.0.1:8089"] + # urls = ["http://127.0.0.1:8086"] + + ## The target database for metrics; will be created as needed. + # database = "telegraf" ## Name of existing retention policy to write to. Empty string writes to ## the default retention policy. - retention_policy = "" - ## Write consistency (clusters only), can be: "any", "one", "quorum", "all" - write_consistency = "any" + # retention_policy = "" - ## Write timeout (for the InfluxDB client), formatted as a string. - ## If not provided, will default to 5s. 0s means no timeout (not recommended). - timeout = "5s" + ## Write consistency (clusters only), can be: "any", "one", "quorum", "all" + # write_consistency = "any" + + ## Timeout for HTTP messages. + # timeout = "5s" + + ## HTTP Basic Auth # username = "telegraf" # password = "metricsmetricsmetricsmetrics" - ## Set the user agent for HTTP POSTs (can be useful for log differentiation) + + ## HTTP User-Agent # user_agent = "telegraf" - ## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes) + + ## UDP payload size is the maximum packet size to send. # udp_payload = 512 ## Optional SSL Config @@ -39,37 +44,14 @@ This plugin writes to [InfluxDB](https://www.influxdb.com) via HTTP or UDP. ## Use SSL but skip chain & host verification # insecure_skip_verify = false - ## HTTP Proxy Config + ## HTTP Proxy override, if unset values the standard proxy environment + ## variables are consulted to determine which proxy, if any, should be used. # http_proxy = "http://corporate.proxy:3128" - ## Optional HTTP headers + ## Additional HTTP headers # http_headers = {"X-Special-Header" = "Special-Value"} - ## Compress each HTTP request payload using GZIP. - # content_encoding = "gzip" + ## HTTP Content-Encoding for write request body, can be set to "gzip" to + ## compress body or "identity" to apply no encoding. + # content_encoding = "identity" ``` - -### Required parameters: - -* `urls`: List of strings, this is for InfluxDB clustering -support. On each flush interval, Telegraf will randomly choose one of the urls -to write to. Each URL should start with either `http://` or `udp://` -* `database`: The name of the database to write to. - - -### Optional parameters: - -* `write_consistency`: Write consistency (clusters only), can be: "any", "one", "quorum", "all". -* `retention_policy`: Name of existing retention policy to write to. Empty string writes to the default retention policy. -* `timeout`: Write timeout (for the InfluxDB client), formatted as a string. If not provided, will default to 5s. 0s means no timeout (not recommended). -* `username`: Username for influxdb -* `password`: Password for influxdb -* `user_agent`: Set the user agent for HTTP POSTs (can be useful for log differentiation) -* `udp_payload`: Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes) -* `ssl_ca`: SSL CA -* `ssl_cert`: SSL CERT -* `ssl_key`: SSL key -* `insecure_skip_verify`: Use SSL but skip chain & host verification (default: false) -* `http_proxy`: HTTP Proxy URI -* `http_headers`: HTTP headers to add to each HTTP request -* `content_encoding`: Compress each HTTP request payload using gzip if set to: "gzip" diff --git a/plugins/outputs/influxdb/client/client.go b/plugins/outputs/influxdb/client/client.go deleted file mode 100644 index 4bcaceb74..000000000 --- a/plugins/outputs/influxdb/client/client.go +++ /dev/null @@ -1,16 +0,0 @@ -package client - -import "io" - -type Client interface { - Query(command string) error - WriteStream(b io.Reader) error - Close() error -} - -type WriteParams struct { - Database string - RetentionPolicy string - Precision string - Consistency string -} diff --git a/plugins/outputs/influxdb/client/http.go b/plugins/outputs/influxdb/client/http.go deleted file mode 100644 index 601e40386..000000000 --- a/plugins/outputs/influxdb/client/http.go +++ /dev/null @@ -1,277 +0,0 @@ -package client - -import ( - "bytes" - "compress/gzip" - "crypto/tls" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "path" - "time" -) - -var ( - defaultRequestTimeout = time.Second * 5 -) - -func NewHTTP(config HTTPConfig, defaultWP WriteParams) (Client, error) { - // validate required parameters: - if len(config.URL) == 0 { - return nil, fmt.Errorf("config.URL is required to create an HTTP client") - } - if len(defaultWP.Database) == 0 { - return nil, fmt.Errorf("A default database is required to create an HTTP client") - } - - // set defaults: - if config.Timeout == 0 { - config.Timeout = defaultRequestTimeout - } - - // parse URL: - u, err := url.Parse(config.URL) - if err != nil { - return nil, fmt.Errorf("error parsing config.URL: %s", err) - } - if u.Scheme != "http" && u.Scheme != "https" { - return nil, fmt.Errorf("config.URL scheme must be http(s), got %s", u.Scheme) - } - - var transport http.Transport - if len(config.HTTPProxy) > 0 { - proxyURL, err := url.Parse(config.HTTPProxy) - if err != nil { - return nil, fmt.Errorf("error parsing config.HTTPProxy: %s", err) - } - - transport = http.Transport{ - Proxy: http.ProxyURL(proxyURL), - TLSClientConfig: config.TLSConfig, - } - } else { - transport = http.Transport{ - Proxy: http.ProxyFromEnvironment, - TLSClientConfig: config.TLSConfig, - } - } - - return &httpClient{ - writeURL: writeURL(u, defaultWP), - config: config, - url: u, - client: &http.Client{ - Timeout: config.Timeout, - Transport: &transport, - }, - }, nil -} - -type HTTPHeaders map[string]string - -type HTTPConfig struct { - // URL should be of the form "http://host:port" (REQUIRED) - URL string - - // UserAgent sets the User-Agent header. - UserAgent string - - // Timeout specifies a time limit for requests made by this - // Client. The timeout includes connection time, any - // redirects, and reading the response body. The timer remains - // running after Get, Head, Post, or Do return and will - // interrupt reading of the Response.Body. - // - // A Timeout of zero means no timeout. - Timeout time.Duration - - // Username is the basic auth username for the server. - Username string - // Password is the basic auth password for the server. - Password string - - // TLSConfig is the tls auth settings to use for each request. - TLSConfig *tls.Config - - // Proxy URL should be of the form "http://host:port" - HTTPProxy string - - // HTTP headers to append to HTTP requests. - HTTPHeaders HTTPHeaders - - // The content encoding mechanism to use for each request. - ContentEncoding string -} - -// Response represents a list of statement results. -type Response struct { - // ignore Results: - Results []interface{} `json:"-"` - Err string `json:"error,omitempty"` -} - -// Error returns the first error from any statement. -// Returns nil if no errors occurred on any statements. -func (r *Response) Error() error { - if r.Err != "" { - return fmt.Errorf(r.Err) - } - return nil -} - -type httpClient struct { - writeURL string - config HTTPConfig - client *http.Client - url *url.URL -} - -func (c *httpClient) Query(command string) error { - req, err := c.makeRequest(queryURL(c.url, command), bytes.NewReader([]byte(""))) - if err != nil { - return err - } - return c.doRequest(req, http.StatusOK) -} - -func (c *httpClient) WriteStream(r io.Reader) error { - req, err := c.makeWriteRequest(r, c.writeURL) - if err != nil { - return err - } - - return c.doRequest(req, http.StatusNoContent) -} - -func (c *httpClient) doRequest( - req *http.Request, - expectedCode int, -) error { - resp, err := c.client.Do(req) - if err != nil { - return err - } - - code := resp.StatusCode - // If it's a "no content" response, then release and return nil - if code == http.StatusNoContent { - return nil - } - - // not a "no content" response, so parse the result: - var response Response - body, err := ioutil.ReadAll(resp.Body) - if err != nil { - return fmt.Errorf("Fatal error reading body: %s", err) - } - decErr := json.Unmarshal(body, &response) - - // If we got a JSON decode error, send that back - if decErr != nil { - err = fmt.Errorf("Unable to decode json: received status code %d err: %s", code, decErr) - } - // Unexpected response code OR error in JSON response body overrides - // a JSON decode error: - if code != expectedCode || response.Error() != nil { - err = fmt.Errorf("Response Error: Status Code [%d], expected [%d], [%v]", - code, expectedCode, response.Error()) - } - - return err -} - -func (c *httpClient) makeWriteRequest( - body io.Reader, - writeURL string, -) (*http.Request, error) { - req, err := c.makeRequest(writeURL, body) - if err != nil { - return nil, err - } - if c.config.ContentEncoding == "gzip" { - req.Header.Set("Content-Encoding", "gzip") - } - return req, nil -} - -func (c *httpClient) makeRequest(uri string, body io.Reader) (*http.Request, error) { - var req *http.Request - var err error - if c.config.ContentEncoding == "gzip" { - body, err = compressWithGzip(body) - if err != nil { - return nil, err - } - } - req, err = http.NewRequest("POST", uri, body) - if err != nil { - return nil, err - } - - req.Header.Set("Content-Type", "text/plain; charset=utf-8") - - for header, value := range c.config.HTTPHeaders { - req.Header.Set(header, value) - } - - req.Header.Set("User-Agent", c.config.UserAgent) - if c.config.Username != "" && c.config.Password != "" { - req.SetBasicAuth(c.config.Username, c.config.Password) - } - return req, nil -} - -func compressWithGzip(data io.Reader) (io.Reader, error) { - pr, pw := io.Pipe() - gw := gzip.NewWriter(pw) - var err error - - go func() { - _, err = io.Copy(gw, data) - gw.Close() - pw.Close() - }() - - return pr, err -} - -func (c *httpClient) Close() error { - // Nothing to do. - return nil -} - -func writeURL(u *url.URL, wp WriteParams) string { - params := url.Values{} - params.Set("db", wp.Database) - if wp.RetentionPolicy != "" { - params.Set("rp", wp.RetentionPolicy) - } - if wp.Precision != "n" && wp.Precision != "" { - params.Set("precision", wp.Precision) - } - if wp.Consistency != "one" && wp.Consistency != "" { - params.Set("consistency", wp.Consistency) - } - - u.RawQuery = params.Encode() - p := u.Path - u.Path = path.Join(p, "write") - s := u.String() - u.Path = p - return s -} - -func queryURL(u *url.URL, command string) string { - params := url.Values{} - params.Set("q", command) - - u.RawQuery = params.Encode() - p := u.Path - u.Path = path.Join(p, "query") - s := u.String() - u.Path = p - return s -} diff --git a/plugins/outputs/influxdb/client/http_test.go b/plugins/outputs/influxdb/client/http_test.go deleted file mode 100644 index 2cb0182e8..000000000 --- a/plugins/outputs/influxdb/client/http_test.go +++ /dev/null @@ -1,335 +0,0 @@ -package client - -import ( - "bytes" - "compress/gzip" - "fmt" - "net/http" - "net/http/httptest" - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestHTTPClient_Write(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/write": - // test form values: - if r.FormValue("db") != "test" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"wrong db name"}`) - } - if r.FormValue("rp") != "policy" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"wrong rp name"}`) - } - if r.FormValue("precision") != "ns" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"wrong precision"}`) - } - if r.FormValue("consistency") != "all" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"wrong consistency"}`) - } - // test that user agent is set properly - if r.UserAgent() != "test-agent" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"wrong agent name"}`) - } - // test basic auth params - user, pass, ok := r.BasicAuth() - if !ok { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"basic auth not set"}`) - } - if user != "test-user" || pass != "test-password" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"basic auth incorrect"}`) - } - - // test that user-specified http header is set properly - if r.Header.Get("X-Test-Header") != "Test-Value" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"wrong http header value"}`) - } - - // Validate Content-Length Header - if r.ContentLength != 13 { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - msg := fmt.Sprintf(`{"results":[{}],"error":"Content-Length: expected [13], got [%d]"}`, r.ContentLength) - fmt.Fprintln(w, msg) - } - - // Validate the request body: - buf := make([]byte, 100) - n, _ := r.Body.Read(buf) - expected := "cpu value=99" - got := string(buf[0 : n-1]) - if expected != got { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - msg := fmt.Sprintf(`{"results":[{}],"error":"expected [%s], got [%s]"}`, expected, got) - fmt.Fprintln(w, msg) - } - - w.WriteHeader(http.StatusNoContent) - w.Header().Set("Content-Type", "application/json") - case "/query": - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}]}`) - } - })) - defer ts.Close() - - config := HTTPConfig{ - URL: ts.URL, - UserAgent: "test-agent", - Username: "test-user", - Password: "test-password", - HTTPHeaders: HTTPHeaders{ - "X-Test-Header": "Test-Value", - }, - } - wp := WriteParams{ - Database: "test", - RetentionPolicy: "policy", - Precision: "ns", - Consistency: "all", - } - client, err := NewHTTP(config, wp) - defer client.Close() - assert.NoError(t, err) - - err = client.WriteStream(bytes.NewReader([]byte("cpu value=99\n"))) - assert.NoError(t, err) -} - -func TestHTTPClient_Write_Errors(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/write": - w.WriteHeader(http.StatusTeapot) - case "/query": - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}]}`) - } - })) - defer ts.Close() - - config := HTTPConfig{ - URL: ts.URL, - } - defaultWP := WriteParams{ - Database: "test", - } - client, err := NewHTTP(config, defaultWP) - defer client.Close() - assert.NoError(t, err) - - lp := []byte("cpu value=99\n") - err = client.WriteStream(bytes.NewReader(lp)) - assert.Error(t, err) -} - -func TestNewHTTPErrors(t *testing.T) { - // No URL: - config := HTTPConfig{} - defaultWP := WriteParams{ - Database: "test", - } - client, err := NewHTTP(config, defaultWP) - assert.Error(t, err) - assert.Nil(t, client) - - // No Database: - config = HTTPConfig{ - URL: "http://localhost:8086", - } - defaultWP = WriteParams{} - client, err = NewHTTP(config, defaultWP) - assert.Nil(t, client) - assert.Error(t, err) - - // Invalid URL: - config = HTTPConfig{ - URL: "http://192.168.0.%31:8080/", - } - defaultWP = WriteParams{ - Database: "test", - } - client, err = NewHTTP(config, defaultWP) - assert.Nil(t, client) - assert.Error(t, err) - - // Invalid URL scheme: - config = HTTPConfig{ - URL: "mailto://localhost:8086", - } - defaultWP = WriteParams{ - Database: "test", - } - client, err = NewHTTP(config, defaultWP) - assert.Nil(t, client) - assert.Error(t, err) -} - -func TestHTTPClient_Query(t *testing.T) { - command := "CREATE DATABASE test" - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/write": - w.WriteHeader(http.StatusNoContent) - case "/query": - // validate the create database command is correct - got := r.FormValue("q") - if got != command { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - msg := fmt.Sprintf(`{"results":[{}],"error":"got %s, expected %s"}`, got, command) - fmt.Fprintln(w, msg) - } - - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}]}`) - } - })) - defer ts.Close() - - config := HTTPConfig{ - URL: ts.URL, - } - defaultWP := WriteParams{ - Database: "test", - } - client, err := NewHTTP(config, defaultWP) - defer client.Close() - assert.NoError(t, err) - err = client.Query(command) - assert.NoError(t, err) -} - -func TestHTTPClient_Query_ResponseError(t *testing.T) { - command := "CREATE DATABASE test" - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/write": - w.WriteHeader(http.StatusNoContent) - case "/query": - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - msg := fmt.Sprintf(`{"results":[{}],"error":"couldnt create database"}`) - fmt.Fprintln(w, msg) - } - })) - defer ts.Close() - - config := HTTPConfig{ - URL: ts.URL, - } - defaultWP := WriteParams{ - Database: "test", - } - client, err := NewHTTP(config, defaultWP) - defer client.Close() - assert.NoError(t, err) - err = client.Query(command) - assert.Error(t, err) -} - -func TestHTTPClient_Query_JSONDecodeError(t *testing.T) { - command := "CREATE DATABASE test" - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/write": - w.WriteHeader(http.StatusNoContent) - case "/query": - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - // write JSON missing a ']' - msg := fmt.Sprintf(`{"results":[{}}`) - fmt.Fprintln(w, msg) - } - })) - defer ts.Close() - - config := HTTPConfig{ - URL: ts.URL, - } - defaultWP := WriteParams{ - Database: "test", - } - client, err := NewHTTP(config, defaultWP) - defer client.Close() - assert.NoError(t, err) - err = client.Query(command) - assert.Error(t, err) - assert.Contains(t, err.Error(), "json") -} - -func TestGzipCompression(t *testing.T) { - influxLine := "cpu value=99\n" - - // Compress the payload using GZIP. - payload := bytes.NewReader([]byte(influxLine)) - compressed, err := compressWithGzip(payload) - assert.Nil(t, err) - - // Decompress the compressed payload and make sure - // that its original value has not changed. - gr, err := gzip.NewReader(compressed) - assert.Nil(t, err) - gr.Close() - - var uncompressed bytes.Buffer - _, err = uncompressed.ReadFrom(gr) - assert.Nil(t, err) - - assert.Equal(t, []byte(influxLine), uncompressed.Bytes()) -} - -func TestHTTPClient_PathPrefix(t *testing.T) { - prefix := "/some/random/prefix" - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case prefix + "/write": - w.WriteHeader(http.StatusNoContent) - w.Header().Set("Content-Type", "application/json") - case prefix + "/query": - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}]}`) - default: - w.WriteHeader(http.StatusNotFound) - msg := fmt.Sprintf("Path not found: %s", r.URL.Path) - fmt.Fprintln(w, msg) - } - })) - defer ts.Close() - - config := HTTPConfig{ - URL: ts.URL + prefix, - } - wp := WriteParams{ - Database: "test", - } - client, err := NewHTTP(config, wp) - defer client.Close() - assert.NoError(t, err) - err = client.Query("CREATE DATABASE test") - assert.NoError(t, err) - err = client.WriteStream(bytes.NewReader([]byte("cpu value=99\n"))) - assert.NoError(t, err) -} diff --git a/plugins/outputs/influxdb/client/udp.go b/plugins/outputs/influxdb/client/udp.go deleted file mode 100644 index 786b047fa..000000000 --- a/plugins/outputs/influxdb/client/udp.go +++ /dev/null @@ -1,105 +0,0 @@ -package client - -import ( - "fmt" - "io" - "log" - "net" - "net/url" -) - -const ( - // UDPPayloadSize is a reasonable default payload size for UDP packets that - // could be travelling over the internet. - UDPPayloadSize = 512 -) - -// UDPConfig is the config data needed to create a UDP Client -type UDPConfig struct { - // URL should be of the form "udp://host:port" - // or "udp://[ipv6-host%zone]:port". - URL string - - // PayloadSize is the maximum size of a UDP client message, optional - // Tune this based on your network. Defaults to UDPPayloadSize. - PayloadSize int -} - -// NewUDP will return an instance of the telegraf UDP output plugin for influxdb -func NewUDP(config UDPConfig) (Client, error) { - p, err := url.Parse(config.URL) - if err != nil { - return nil, fmt.Errorf("Error parsing UDP url [%s]: %s", config.URL, err) - } - - udpAddr, err := net.ResolveUDPAddr("udp", p.Host) - if err != nil { - return nil, fmt.Errorf("Error resolving UDP Address [%s]: %s", p.Host, err) - } - - conn, err := net.DialUDP("udp", nil, udpAddr) - if err != nil { - return nil, fmt.Errorf("Error dialing UDP address [%s]: %s", - udpAddr.String(), err) - } - - size := config.PayloadSize - if size == 0 { - size = UDPPayloadSize - } - buf := make([]byte, size) - return &udpClient{conn: conn, buffer: buf}, nil -} - -type udpClient struct { - conn *net.UDPConn - buffer []byte -} - -// Query will send the provided query command to the client, returning an error if any issues arise -func (c *udpClient) Query(command string) error { - return nil -} - -// WriteStream will send the provided data through to the client, contentLength is ignored by the UDP client -func (c *udpClient) WriteStream(r io.Reader) error { - var totaln int - for { - nR, err := r.Read(c.buffer) - if nR == 0 { - break - } - if err != io.EOF && err != nil { - return err - } - - if c.buffer[nR-1] == uint8('\n') { - nW, err := c.conn.Write(c.buffer[0:nR]) - totaln += nW - if err != nil { - return err - } - } else { - log.Printf("E! Could not fit point into UDP payload; dropping") - // Scan forward until next line break to realign. - for { - nR, err := r.Read(c.buffer) - if nR == 0 { - break - } - if err != io.EOF && err != nil { - return err - } - if c.buffer[nR-1] == uint8('\n') { - break - } - } - } - } - return nil -} - -// Close will terminate the provided client connection -func (c *udpClient) Close() error { - return c.conn.Close() -} diff --git a/plugins/outputs/influxdb/client/udp_test.go b/plugins/outputs/influxdb/client/udp_test.go deleted file mode 100644 index 545f142f5..000000000 --- a/plugins/outputs/influxdb/client/udp_test.go +++ /dev/null @@ -1,89 +0,0 @@ -package client - -import ( - "net" - "testing" - "time" - - "github.com/influxdata/telegraf" - "github.com/influxdata/telegraf/metric" - - "github.com/stretchr/testify/assert" -) - -func TestUDPClient(t *testing.T) { - config := UDPConfig{ - URL: "udp://localhost:8089", - } - client, err := NewUDP(config) - assert.NoError(t, err) - - err = client.Query("ANY QUERY RETURNS NIL") - assert.NoError(t, err) - - assert.NoError(t, client.Close()) -} - -func TestNewUDPClient_Errors(t *testing.T) { - // url.Parse Error - config := UDPConfig{ - URL: "udp://localhost%35:8089", - } - _, err := NewUDP(config) - assert.Error(t, err) - - // ResolveUDPAddr Error - config = UDPConfig{ - URL: "udp://localhost:999999", - } - _, err = NewUDP(config) - assert.Error(t, err) -} - -func TestUDPClient_Write(t *testing.T) { - config := UDPConfig{ - URL: "udp://localhost:8199", - } - client, err := NewUDP(config) - assert.NoError(t, err) - - packets := make(chan string, 100) - address, err := net.ResolveUDPAddr("udp", "localhost:8199") - assert.NoError(t, err) - listener, err := net.ListenUDP("udp", address) - defer listener.Close() - assert.NoError(t, err) - go func() { - buf := make([]byte, 200) - for { - n, _, err := listener.ReadFromUDP(buf) - if err != nil { - packets <- err.Error() - } - packets <- string(buf[0:n]) - } - }() - - assert.NoError(t, client.Close()) - - config = UDPConfig{ - URL: "udp://localhost:8199", - PayloadSize: 40, - } - client4, err := NewUDP(config) - assert.NoError(t, err) - - ts := time.Unix(1484142943, 0) - m1, _ := metric.New("test", map[string]string{}, - map[string]interface{}{"this_is_a_very_long_field_name": 1.1}, ts) - m2, _ := metric.New("test", map[string]string{}, - map[string]interface{}{"value": 1.1}, ts) - ms := []telegraf.Metric{m1, m2} - reader := metric.NewReader(ms) - err = client4.WriteStream(reader) - assert.NoError(t, err) - pkt := <-packets - assert.Equal(t, "test value=1.1 1484142943000000000\n", pkt) - - assert.NoError(t, client4.Close()) -} diff --git a/plugins/outputs/influxdb/http.go b/plugins/outputs/influxdb/http.go new file mode 100644 index 000000000..852784f0d --- /dev/null +++ b/plugins/outputs/influxdb/http.go @@ -0,0 +1,404 @@ +package influxdb + +import ( + "compress/gzip" + "context" + "crypto/tls" + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "net/url" + "path" + "strings" + "time" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/plugins/serializers/influx" +) + +type APIErrorType int + +const ( + _ APIErrorType = iota + DatabaseNotFound +) + +const ( + defaultRequestTimeout = time.Second * 5 + defaultDatabase = "telegraf" + defaultUserAgent = "telegraf" + + errStringDatabaseNotFound = "database not found" + errStringHintedHandoffNotEmpty = "hinted handoff queue not empty" + errStringPartialWrite = "partial write" + errStringPointsBeyondRP = "points beyond retention policy" + errStringUnableToParse = "unable to parse" +) + +var ( + + // Escape an identifier in InfluxQL. + escapeIdentifier = strings.NewReplacer( + "\n", `\n`, + `\`, `\\`, + `"`, `\"`, + ) +) + +// APIError is an error reported by the InfluxDB server +type APIError struct { + StatusCode int + Title string + Description string + Type APIErrorType +} + +func (e APIError) Error() string { + if e.Description != "" { + return fmt.Sprintf("%s: %s", e.Title, e.Description) + } + return e.Title +} + +// QueryResponse is the response body from the /query endpoint +type QueryResponse struct { + Results []QueryResult `json:"results"` +} + +type QueryResult struct { + Err string `json:"error,omitempty"` +} + +func (r QueryResponse) Error() string { + if len(r.Results) > 0 { + return r.Results[0].Err + } + return "" +} + +// WriteResponse is the response body from the /write endpoint +type WriteResponse struct { + Err string `json:"error,omitempty"` +} + +func (r WriteResponse) Error() string { + return r.Err +} + +type HTTPConfig struct { + URL *url.URL + UserAgent string + Timeout time.Duration + Username string + Password string + TLSConfig *tls.Config + Proxy *url.URL + Headers map[string]string + ContentEncoding string + Database string + RetentionPolicy string + Consistency string + + Serializer *influx.Serializer +} + +type httpClient struct { + WriteURL string + QueryURL string + ContentEncoding string + Timeout time.Duration + Username string + Password string + Headers map[string]string + + client *http.Client + serializer *influx.Serializer + url *url.URL + database string +} + +func NewHTTPClient(config *HTTPConfig) (*httpClient, error) { + if config.URL == nil { + return nil, ErrMissingURL + } + + database := config.Database + if database == "" { + database = defaultDatabase + } + + timeout := config.Timeout + if timeout == 0 { + timeout = defaultRequestTimeout + } + + userAgent := config.UserAgent + if userAgent == "" { + userAgent = defaultUserAgent + } + + var headers = make(map[string]string, len(config.Headers)+1) + headers["User-Agent"] = userAgent + for k, v := range config.Headers { + headers[k] = v + } + + var proxy func(*http.Request) (*url.URL, error) + if config.Proxy != nil { + proxy = http.ProxyURL(config.Proxy) + } else { + proxy = http.ProxyFromEnvironment + } + + serializer := config.Serializer + if serializer == nil { + serializer = influx.NewSerializer() + } + + writeURL := makeWriteURL( + config.URL, + database, + config.RetentionPolicy, + config.Consistency) + queryURL := makeQueryURL(config.URL) + + client := &httpClient{ + serializer: serializer, + client: &http.Client{ + Timeout: timeout, + Transport: &http.Transport{ + Proxy: proxy, + TLSClientConfig: config.TLSConfig, + }, + }, + database: database, + url: config.URL, + WriteURL: writeURL, + QueryURL: queryURL, + ContentEncoding: config.ContentEncoding, + Timeout: timeout, + Username: config.Username, + Password: config.Password, + Headers: headers, + } + return client, nil +} + +// URL returns the origin URL that this client connects too. +func (c *httpClient) URL() string { + return c.url.String() +} + +// URL returns the database that this client connects too. +func (c *httpClient) Database() string { + return c.database +} + +// CreateDatabase attemps to create a new database in the InfluxDB server. +// Note that some names are not allowed by the server, notably those with +// non-printable characters or slashes. +func (c *httpClient) CreateDatabase(ctx context.Context) error { + query := fmt.Sprintf(`CREATE DATABASE "%s"`, + escapeIdentifier.Replace(c.database)) + + req, err := c.makeQueryRequest(query) + + resp, err := c.client.Do(req.WithContext(ctx)) + if err != nil { + return err + } + defer resp.Body.Close() + + queryResp := &QueryResponse{} + dec := json.NewDecoder(resp.Body) + err = dec.Decode(queryResp) + + if err != nil { + if resp.StatusCode == 200 { + return nil + } + + return &APIError{ + StatusCode: resp.StatusCode, + Title: resp.Status, + } + } + + // Even with a 200 response there can be an error + if resp.StatusCode == http.StatusOK && queryResp.Error() == "" { + return nil + } + + return &APIError{ + StatusCode: resp.StatusCode, + Title: resp.Status, + Description: queryResp.Error(), + } +} + +// Write sends the metrics to InfluxDB +func (c *httpClient) Write(ctx context.Context, metrics []telegraf.Metric) error { + var err error + + reader := influx.NewReader(metrics, c.serializer) + req, err := c.makeWriteRequest(reader) + if err != nil { + return err + } + + resp, err := c.client.Do(req.WithContext(ctx)) + if err != nil { + return err + } + defer resp.Body.Close() + + if resp.StatusCode == http.StatusNoContent { + return nil + } + + writeResp := &WriteResponse{} + dec := json.NewDecoder(resp.Body) + + var desc string + err = dec.Decode(writeResp) + if err == nil { + desc = writeResp.Err + } + + if strings.Contains(desc, errStringDatabaseNotFound) { + return &APIError{ + StatusCode: resp.StatusCode, + Title: resp.Status, + Description: desc, + Type: DatabaseNotFound, + } + } + + // This "error" is an informational message about the state of the + // InfluxDB cluster. + if strings.Contains(desc, errStringHintedHandoffNotEmpty) { + return nil + } + + // Points beyond retention policy is returned when points are immediately + // discarded for being older than the retention policy. Usually this not + // a cause for concern and we don't want to retry. + if strings.Contains(desc, errStringPointsBeyondRP) { + log.Printf("W! [outputs.influxdb]: when writing to [%s]: received error %v", + c.URL(), desc) + return nil + } + + // Other partial write errors, such as "field type conflict", are not + // correctable at this point and so the point is dropped instead of + // retrying. + if strings.Contains(desc, errStringPartialWrite) { + log.Printf("E! [outputs.influxdb]: when writing to [%s]: received error %v; discarding points", + c.URL(), desc) + return nil + } + + // This error indicates a bug in either Telegraf line protocol + // serialization, retries would not be successful. + if strings.Contains(desc, errStringUnableToParse) { + log.Printf("E! [outputs.influxdb]: when writing to [%s]: received error %v; discarding points", + c.URL(), desc) + return nil + } + + return &APIError{ + StatusCode: resp.StatusCode, + Title: resp.Status, + Description: desc, + } +} + +func (c *httpClient) makeQueryRequest(query string) (*http.Request, error) { + params := url.Values{} + params.Set("q", query) + form := strings.NewReader(params.Encode()) + + req, err := http.NewRequest("POST", c.QueryURL, form) + if err != nil { + return nil, err + } + + req.Header.Set("Content-Type", "application/x-www-form-urlencoded") + c.addHeaders(req) + + return req, nil +} + +func (c *httpClient) makeWriteRequest(body io.Reader) (*http.Request, error) { + var err error + if c.ContentEncoding == "gzip" { + body, err = compressWithGzip(body) + if err != nil { + return nil, err + } + } + + req, err := http.NewRequest("POST", c.WriteURL, body) + if err != nil { + return nil, err + } + + req.Header.Set("Content-Type", "text/plain; charset=utf-8") + c.addHeaders(req) + + if c.ContentEncoding == "gzip" { + req.Header.Set("Content-Encoding", "gzip") + } + + return req, nil +} + +func compressWithGzip(data io.Reader) (io.Reader, error) { + pr, pw := io.Pipe() + gw := gzip.NewWriter(pw) + var err error + + go func() { + _, err = io.Copy(gw, data) + gw.Close() + pw.Close() + }() + + return pr, err +} + +func (c *httpClient) addHeaders(req *http.Request) { + if c.Username != "" || c.Password != "" { + req.SetBasicAuth(c.Username, c.Password) + } + + for header, value := range c.Headers { + req.Header.Set(header, value) + } +} + +func makeWriteURL(loc *url.URL, db, rp, consistency string) string { + params := url.Values{} + params.Set("db", db) + + if rp != "" { + params.Set("rp", rp) + } + + if consistency != "one" && consistency != "" { + params.Set("consistency", consistency) + } + + u := *loc + u.Path = path.Join(u.Path, "write") + u.RawQuery = params.Encode() + return u.String() +} + +func makeQueryURL(loc *url.URL) string { + u := *loc + u.Path = path.Join(u.Path, "query") + return u.String() +} diff --git a/plugins/outputs/influxdb/http_test.go b/plugins/outputs/influxdb/http_test.go new file mode 100644 index 000000000..d6463c050 --- /dev/null +++ b/plugins/outputs/influxdb/http_test.go @@ -0,0 +1,558 @@ +package influxdb_test + +import ( + "bytes" + "compress/gzip" + "context" + "fmt" + "io/ioutil" + "log" + "net/http" + "net/http/httptest" + "net/url" + "strings" + "testing" + "time" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/metric" + "github.com/influxdata/telegraf/plugins/outputs/influxdb" + "github.com/stretchr/testify/require" +) + +func getHTTPURL() *url.URL { + u, err := url.Parse("http://localhost") + if err != nil { + panic(err) + } + return u +} + +func TestHTTP_EmptyConfig(t *testing.T) { + config := &influxdb.HTTPConfig{} + _, err := influxdb.NewHTTPClient(config) + require.Error(t, err) + require.Contains(t, err.Error(), influxdb.ErrMissingURL.Error()) +} + +func TestHTTP_MinimalConfig(t *testing.T) { + config := &influxdb.HTTPConfig{ + URL: getHTTPURL(), + } + _, err := influxdb.NewHTTPClient(config) + require.NoError(t, err) +} + +func TestHTTP_CreateDatabase(t *testing.T) { + ts := httptest.NewServer(http.NotFoundHandler()) + defer ts.Close() + + u, err := url.Parse(fmt.Sprintf("http://%s", ts.Listener.Addr().String())) + require.NoError(t, err) + + successResponse := []byte(`{"results": [{"statement_id": 0}]}`) + + tests := []struct { + name string + config *influxdb.HTTPConfig + database string + queryHandlerFunc func(t *testing.T, w http.ResponseWriter, r *http.Request) + errFunc func(t *testing.T, err error) + }{ + { + name: "success", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "xyzzy", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, `CREATE DATABASE "xyzzy"`, r.FormValue("q")) + w.WriteHeader(http.StatusOK) + w.Write(successResponse) + }, + }, + { + name: "send basic auth", + config: &influxdb.HTTPConfig{ + URL: u, + Username: "guy", + Password: "smiley", + Database: "telegraf", + }, + database: "telegraf", + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + username, password, ok := r.BasicAuth() + require.True(t, ok) + require.Equal(t, "guy", username) + require.Equal(t, "smiley", password) + w.WriteHeader(http.StatusOK) + w.Write(successResponse) + }, + }, + { + name: "send user agent", + config: &influxdb.HTTPConfig{ + URL: u, + Headers: map[string]string{ + "A": "B", + "C": "D", + }, + Database: "telegraf", + }, + database: `a " b`, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, r.Header.Get("A"), "B") + require.Equal(t, r.Header.Get("C"), "D") + w.WriteHeader(http.StatusOK) + w.Write(successResponse) + }, + }, + { + name: "send headers", + config: &influxdb.HTTPConfig{ + URL: u, + Headers: map[string]string{ + "A": "B", + "C": "D", + }, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, r.Header.Get("A"), "B") + require.Equal(t, r.Header.Get("C"), "D") + w.WriteHeader(http.StatusOK) + w.Write(successResponse) + }, + }, + { + name: "database default", + config: &influxdb.HTTPConfig{ + URL: u, + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, `CREATE DATABASE "telegraf"`, r.FormValue("q")) + w.WriteHeader(http.StatusOK) + w.Write(successResponse) + }, + }, + { + name: "database name is escaped", + config: &influxdb.HTTPConfig{ + URL: u, + Database: `a " b`, + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, `CREATE DATABASE "a \" b"`, r.FormValue("q")) + w.WriteHeader(http.StatusOK) + w.Write(successResponse) + }, + }, + { + name: "invalid database name creates api error", + config: &influxdb.HTTPConfig{ + URL: u, + Database: `a \\ b`, + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + // Yes, 200 OK is the correct response... + w.WriteHeader(http.StatusOK) + w.Write([]byte(`{"results": [{"error": "invalid name", "statement_id": 0}]}`)) + }, + errFunc: func(t *testing.T, err error) { + expected := &influxdb.APIError{ + StatusCode: 200, + Title: "200 OK", + Description: "invalid name", + } + + require.Equal(t, expected, err) + }, + }, + { + name: "error with no response body", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusNotFound) + }, + errFunc: func(t *testing.T, err error) { + expected := &influxdb.APIError{ + StatusCode: 404, + Title: "404 Not Found", + } + + require.Equal(t, expected, err) + }, + }, + { + name: "ok with no response body", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ts.Config.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/query": + tt.queryHandlerFunc(t, w, r) + return + default: + w.WriteHeader(http.StatusNotFound) + return + } + }) + + ctx := context.Background() + + client, err := influxdb.NewHTTPClient(tt.config) + require.NoError(t, err) + err = client.CreateDatabase(ctx) + if tt.errFunc != nil { + tt.errFunc(t, err) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestHTTP_Write(t *testing.T) { + ts := httptest.NewServer(http.NotFoundHandler()) + defer ts.Close() + + u, err := url.Parse(fmt.Sprintf("http://%s", ts.Listener.Addr().String())) + require.NoError(t, err) + + tests := []struct { + name string + config *influxdb.HTTPConfig + queryHandlerFunc func(t *testing.T, w http.ResponseWriter, r *http.Request) + errFunc func(t *testing.T, err error) + logFunc func(t *testing.T, str string) + }{ + { + name: "success", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, r.FormValue("db"), "telegraf") + body, err := ioutil.ReadAll(r.Body) + require.NoError(t, err) + require.Contains(t, string(body), "cpu value=42") + w.WriteHeader(http.StatusNoContent) + }, + }, + { + name: "send basic auth", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + Username: "guy", + Password: "smiley", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + username, password, ok := r.BasicAuth() + require.True(t, ok) + require.Equal(t, "guy", username) + require.Equal(t, "smiley", password) + w.WriteHeader(http.StatusNoContent) + }, + }, + { + name: "send user agent", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + UserAgent: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, r.Header.Get("User-Agent"), "telegraf") + w.WriteHeader(http.StatusNoContent) + }, + }, + { + name: "default database", + config: &influxdb.HTTPConfig{ + URL: u, + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, "telegraf", r.FormValue("db")) + w.WriteHeader(http.StatusNoContent) + }, + }, + { + name: "send headers", + config: &influxdb.HTTPConfig{ + URL: u, + Headers: map[string]string{ + "A": "B", + "C": "D", + }, + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, r.Header.Get("A"), "B") + require.Equal(t, r.Header.Get("C"), "D") + w.WriteHeader(http.StatusNoContent) + }, + }, + { + name: "send retention policy", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + RetentionPolicy: "foo", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, "foo", r.FormValue("rp")) + w.WriteHeader(http.StatusNoContent) + }, + }, + { + name: "send consistency", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + Consistency: "all", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + require.Equal(t, "all", r.FormValue("consistency")) + w.WriteHeader(http.StatusNoContent) + }, + }, + { + name: "hinted handoff not empty no log no error", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusBadRequest) + w.Write([]byte(`{"error": "write failed: hinted handoff queue not empty"}`)) + }, + logFunc: func(t *testing.T, str string) { + require.False(t, strings.Contains(str, "hinted handoff queue not empty")) + }, + }, + { + name: "partial write errors are logged no error", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusBadRequest) + w.Write([]byte(`{"error": "partial write: field type conflict:"}`)) + }, + logFunc: func(t *testing.T, str string) { + require.Contains(t, str, "partial write") + }, + }, + { + name: "parse errors are logged no error", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusBadRequest) + w.Write([]byte(`{"error": "unable to parse 'cpu value': invalid field format"}`)) + }, + logFunc: func(t *testing.T, str string) { + require.Contains(t, str, "unable to parse") + }, + }, + { + name: "http error", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusBadGateway) + }, + errFunc: func(t *testing.T, err error) { + expected := &influxdb.APIError{ + StatusCode: 502, + Title: "502 Bad Gateway", + } + require.Equal(t, expected, err) + }, + }, + { + name: "http error with desc", + config: &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + }, + queryHandlerFunc: func(t *testing.T, w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusServiceUnavailable) + w.Write([]byte(`{"error": "unknown error"}`)) + }, + errFunc: func(t *testing.T, err error) { + expected := &influxdb.APIError{ + StatusCode: 503, + Title: "503 Service Unavailable", + Description: "unknown error", + } + require.Equal(t, expected, err) + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + ts.Config.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/write": + tt.queryHandlerFunc(t, w, r) + return + default: + w.WriteHeader(http.StatusNotFound) + return + } + }) + + var b bytes.Buffer + if tt.logFunc != nil { + log.SetOutput(&b) + } + + ctx := context.Background() + + m, err := metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ) + require.NoError(t, err) + metrics := []telegraf.Metric{m} + + client, err := influxdb.NewHTTPClient(tt.config) + require.NoError(t, err) + err = client.Write(ctx, metrics) + if tt.errFunc != nil { + tt.errFunc(t, err) + } else { + require.NoError(t, err) + } + + if tt.logFunc != nil { + tt.logFunc(t, b.String()) + } + }) + } +} + +func TestHTTP_WritePathPrefix(t *testing.T) { + ts := httptest.NewServer( + http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/x/y/z/query": + w.WriteHeader(http.StatusOK) + return + case "/x/y/z/write": + w.WriteHeader(http.StatusNoContent) + return + default: + w.WriteHeader(http.StatusNotFound) + return + } + }, + ), + ) + defer ts.Close() + + u, err := url.Parse(fmt.Sprintf("http://%s/x/y/z", ts.Listener.Addr().String())) + require.NoError(t, err) + + ctx := context.Background() + + m, err := metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ) + require.NoError(t, err) + metrics := []telegraf.Metric{m} + + config := &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + } + + client, err := influxdb.NewHTTPClient(config) + require.NoError(t, err) + err = client.CreateDatabase(ctx) + require.NoError(t, err) + err = client.Write(ctx, metrics) + require.NoError(t, err) +} + +func TestHTTP_WriteContentEncodingGzip(t *testing.T) { + ts := httptest.NewServer( + http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/write": + require.Equal(t, r.Header.Get("Content-Encoding"), "gzip") + + gr, err := gzip.NewReader(r.Body) + require.NoError(t, err) + body, err := ioutil.ReadAll(gr) + require.NoError(t, err) + + require.Contains(t, string(body), "cpu value=42") + w.WriteHeader(http.StatusNoContent) + return + default: + w.WriteHeader(http.StatusNotFound) + return + } + }, + ), + ) + defer ts.Close() + + u, err := url.Parse(fmt.Sprintf("http://%s/", ts.Listener.Addr().String())) + require.NoError(t, err) + + ctx := context.Background() + + m, err := metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ) + require.NoError(t, err) + metrics := []telegraf.Metric{m} + + config := &influxdb.HTTPConfig{ + URL: u, + Database: "telegraf", + ContentEncoding: "gzip", + } + + client, err := influxdb.NewHTTPClient(config) + require.NoError(t, err) + err = client.Write(ctx, metrics) + require.NoError(t, err) +} diff --git a/plugins/outputs/influxdb/influxdb.go b/plugins/outputs/influxdb/influxdb.go index e2b20caa4..04a4c6987 100644 --- a/plugins/outputs/influxdb/influxdb.go +++ b/plugins/outputs/influxdb/influxdb.go @@ -1,29 +1,37 @@ package influxdb import ( + "context" + "errors" "fmt" "log" "math/rand" - "strings" + "net/url" "time" "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal" - "github.com/influxdata/telegraf/metric" "github.com/influxdata/telegraf/plugins/outputs" - - "github.com/influxdata/telegraf/plugins/outputs/influxdb/client" + "github.com/influxdata/telegraf/plugins/serializers/influx" ) var ( - // Quote Ident replacer. - qiReplacer = strings.NewReplacer("\n", `\n`, `\`, `\\`, `"`, `\"`) + defaultURL = "http://localhost:8086" + + ErrMissingURL = errors.New("missing URL") ) +type Client interface { + Write(context.Context, []telegraf.Metric) error + CreateDatabase(ctx context.Context) error + + URL() string + Database() string +} + // InfluxDB struct is the primary data structure for the plugin type InfluxDB struct { - // URL is only for backwards compatibility - URL string + URL string // url deprecated in 0.1.9; use urls URLs []string `toml:"urls"` Username string Password string @@ -46,36 +54,45 @@ type InfluxDB struct { // Use SSL but skip chain & host verification InsecureSkipVerify bool - // Precision is only here for legacy support. It will be ignored. - Precision string + Precision string // precision deprecated in 1.0; value is ignored - clients []client.Client + clients []Client + + CreateHTTPClientF func(config *HTTPConfig) (Client, error) + CreateUDPClientF func(config *UDPConfig) (Client, error) + + serializer *influx.Serializer } var sampleConfig = ` ## The full HTTP or UDP URL for your InfluxDB instance. ## - ## Multiple urls can be specified as part of the same cluster, - ## this means that only ONE of the urls will be written to each interval. - # urls = ["udp://127.0.0.1:8089"] # UDP endpoint example - urls = ["http://127.0.0.1:8086"] # required - ## The target database for metrics (telegraf will create it if not exists). - database = "telegraf" # required + ## Multiple URLs can be specified for a single cluster, only ONE of the + ## urls will be written to each interval. + # urls = ["udp://127.0.0.1:8089"] + # urls = ["http://127.0.0.1:8086"] + + ## The target database for metrics; will be created as needed. + # database = "telegraf" ## Name of existing retention policy to write to. Empty string writes to ## the default retention policy. - retention_policy = "" - ## Write consistency (clusters only), can be: "any", "one", "quorum", "all" - write_consistency = "any" + # retention_policy = "" - ## Write timeout (for the InfluxDB client), formatted as a string. - ## If not provided, will default to 5s. 0s means no timeout (not recommended). - timeout = "5s" + ## Write consistency (clusters only), can be: "any", "one", "quorum", "all" + # write_consistency = "any" + + ## Timeout for HTTP messages. + # timeout = "5s" + + ## HTTP Basic Auth # username = "telegraf" # password = "metricsmetricsmetricsmetrics" - ## Set the user agent for HTTP POSTs (can be useful for log differentiation) + + ## HTTP User-Agent # user_agent = "telegraf" - ## Set UDP payload size, defaults to InfluxDB UDP Client default (512 bytes) + + ## UDP payload size is the maximum packet size to send. # udp_payload = 512 ## Optional SSL Config @@ -85,170 +102,181 @@ var sampleConfig = ` ## Use SSL but skip chain & host verification # insecure_skip_verify = false - ## HTTP Proxy Config + ## HTTP Proxy override, if unset values the standard proxy environment + ## variables are consulted to determine which proxy, if any, should be used. # http_proxy = "http://corporate.proxy:3128" - ## Optional HTTP headers + ## Additional HTTP headers # http_headers = {"X-Special-Header" = "Special-Value"} - ## Compress each HTTP request payload using GZIP. - # content_encoding = "gzip" + ## HTTP Content-Encoding for write request body, can be set to "gzip" to + ## compress body or "identity" to apply no encoding. + # content_encoding = "identity" ` -// Connect initiates the primary connection to the range of provided URLs func (i *InfluxDB) Connect() error { - var urls []string - urls = append(urls, i.URLs...) + ctx := context.Background() - // Backward-compatibility with single Influx URL config files - // This could eventually be removed in favor of specifying the urls as a list + urls := make([]string, 0, len(i.URLs)) + urls = append(urls, i.URLs...) if i.URL != "" { urls = append(urls, i.URL) } - tlsConfig, err := internal.GetTLSConfig( - i.SSLCert, i.SSLKey, i.SSLCA, i.InsecureSkipVerify) - if err != nil { - return err + if len(urls) == 0 { + urls = append(urls, defaultURL) } + i.serializer = influx.NewSerializer() + for _, u := range urls { - switch { - case strings.HasPrefix(u, "udp"): - config := client.UDPConfig{ - URL: u, - PayloadSize: i.UDPPayload, - } - c, err := client.NewUDP(config) + u, err := url.Parse(u) + if err != nil { + return fmt.Errorf("error parsing url [%s]: %v", u, err) + } + + var proxy *url.URL + if len(i.HTTPProxy) > 0 { + proxy, err = url.Parse(i.HTTPProxy) if err != nil { - return fmt.Errorf("Error creating UDP Client [%s]: %s", u, err) + return fmt.Errorf("error parsing proxy_url [%s]: %v", proxy, err) } + } + + switch u.Scheme { + case "udp", "udp4", "udp6": + c, err := i.udpClient(u) + if err != nil { + return err + } + + i.clients = append(i.clients, c) + case "http", "https": + c, err := i.httpClient(ctx, u, proxy) + if err != nil { + return err + } + i.clients = append(i.clients, c) default: - // If URL doesn't start with "udp", assume HTTP client - config := client.HTTPConfig{ - URL: u, - Timeout: i.Timeout.Duration, - TLSConfig: tlsConfig, - UserAgent: i.UserAgent, - Username: i.Username, - Password: i.Password, - HTTPProxy: i.HTTPProxy, - HTTPHeaders: client.HTTPHeaders{}, - ContentEncoding: i.ContentEncoding, - } - for header, value := range i.HTTPHeaders { - config.HTTPHeaders[header] = value - } - wp := client.WriteParams{ - Database: i.Database, - RetentionPolicy: i.RetentionPolicy, - Consistency: i.WriteConsistency, - } - c, err := client.NewHTTP(config, wp) - if err != nil { - return fmt.Errorf("Error creating HTTP Client [%s]: %s", u, err) - } - i.clients = append(i.clients, c) - - err = c.Query(fmt.Sprintf(`CREATE DATABASE "%s"`, qiReplacer.Replace(i.Database))) - if err != nil { - if !strings.Contains(err.Error(), "Status Code [403]") { - log.Println("I! Database creation failed: " + err.Error()) - } - continue - } + return fmt.Errorf("unsupported scheme [%s]: %q", u, u.Scheme) } } - rand.Seed(time.Now().UnixNano()) return nil } -// Close will terminate the session to the backend, returning error if an issue arises func (i *InfluxDB) Close() error { return nil } -// SampleConfig returns the formatted sample configuration for the plugin +func (i *InfluxDB) Description() string { + return "Configuration for sending metrics to InfluxDB" +} + func (i *InfluxDB) SampleConfig() string { return sampleConfig } -// Description returns the human-readable function definition of the plugin -func (i *InfluxDB) Description() string { - return "Configuration for influxdb server to send metrics to" -} - -// Write will choose a random server in the cluster to write to until a successful write -// occurs, logging each unsuccessful. If all servers fail, return error. +// Write sends metrics to one of the configured servers, logging each +// unsuccessful. If all servers fail, return an error. func (i *InfluxDB) Write(metrics []telegraf.Metric) error { - r := metric.NewReader(metrics) - - // This will get set to nil if a successful write occurs - err := fmt.Errorf("Could not write to any InfluxDB server in cluster") + ctx := context.Background() + var err error p := rand.Perm(len(i.clients)) for _, n := range p { - if e := i.clients[n].WriteStream(r); e != nil { - // If the database was not found, try to recreate it: - if strings.Contains(e.Error(), "database not found") { - errc := i.clients[n].Query(fmt.Sprintf(`CREATE DATABASE "%s"`, qiReplacer.Replace(i.Database))) - if errc != nil { - log.Printf("E! Error: Database %s not found and failed to recreate\n", - i.Database) + client := i.clients[n] + err = client.Write(ctx, metrics) + if err == nil { + return nil + } + + switch apiError := err.(type) { + case APIError: + if apiError.Type == DatabaseNotFound { + err := client.CreateDatabase(ctx) + if err != nil { + log.Printf("E! [outputs.influxdb] when writing to [%s]: database %q not found and failed to recreate", + client.URL(), client.Database()) } } - - if strings.Contains(e.Error(), "field type conflict") { - log.Printf("E! Field type conflict, dropping conflicted points: %s", e) - // setting err to nil, otherwise we will keep retrying and points - // w/ conflicting types will get stuck in the buffer forever. - err = nil - break - } - - if strings.Contains(e.Error(), "points beyond retention policy") { - log.Printf("W! Points beyond retention policy: %s", e) - // This error is indicates the point is older than the - // retention policy permits, and is probably not a cause for - // concern. Retrying will not help unless the retention - // policy is modified. - err = nil - break - } - - if strings.Contains(e.Error(), "unable to parse") { - log.Printf("E! Parse error; dropping points: %s", e) - // This error indicates a bug in Telegraf or InfluxDB parsing - // of line protocol. Retries will not be successful. - err = nil - break - } - - if strings.Contains(e.Error(), "hinted handoff queue not empty") { - // This is an informational message - err = nil - break - } - - // Log write failure - log.Printf("E! InfluxDB Output Error: %s", e) - } else { - err = nil - break } + + log.Printf("E! [outputs.influxdb]: when writing to [%s]: %v", client.URL(), err) } - return err + return errors.New("could not write any address") } -func newInflux() *InfluxDB { - return &InfluxDB{ - Timeout: internal.Duration{Duration: time.Second * 5}, +func (i *InfluxDB) udpClient(url *url.URL) (Client, error) { + config := &UDPConfig{ + URL: url, + MaxPayloadSize: i.UDPPayload, + Serializer: i.serializer, } + + c, err := i.CreateUDPClientF(config) + if err != nil { + return nil, fmt.Errorf("error creating UDP client [%s]: %v", url, err) + } + + return c, nil +} + +func (i *InfluxDB) httpClient(ctx context.Context, url *url.URL, proxy *url.URL) (Client, error) { + tlsConfig, err := internal.GetTLSConfig( + i.SSLCert, i.SSLKey, i.SSLCA, i.InsecureSkipVerify) + if err != nil { + return nil, err + } + + config := &HTTPConfig{ + URL: url, + Timeout: i.Timeout.Duration, + TLSConfig: tlsConfig, + UserAgent: i.UserAgent, + Username: i.Username, + Password: i.Password, + Proxy: proxy, + ContentEncoding: i.ContentEncoding, + Headers: i.HTTPHeaders, + Database: i.Database, + RetentionPolicy: i.RetentionPolicy, + Consistency: i.WriteConsistency, + Serializer: i.serializer, + } + + c, err := i.CreateHTTPClientF(config) + if err != nil { + return nil, fmt.Errorf("error creating HTTP client [%s]: %v", url, err) + } + + err = c.CreateDatabase(ctx) + if err != nil { + if err, ok := err.(APIError); ok { + if err.StatusCode == 503 { + return c, nil + } + } + + log.Printf("W! [outputs.influxdb] when writing to [%s]: database %q creation failed: %v", + c.URL(), c.Database(), err) + } + + return c, nil } func init() { - outputs.Add("influxdb", func() telegraf.Output { return newInflux() }) + outputs.Add("influxdb", func() telegraf.Output { + return &InfluxDB{ + Timeout: internal.Duration{Duration: time.Second * 5}, + CreateHTTPClientF: func(config *HTTPConfig) (Client, error) { + return NewHTTPClient(config) + }, + CreateUDPClientF: func(config *UDPConfig) (Client, error) { + return NewUDPClient(config) + }, + } + }) } diff --git a/plugins/outputs/influxdb/influxdb_test.go b/plugins/outputs/influxdb/influxdb_test.go index 50c86125d..3e9824ad0 100644 --- a/plugins/outputs/influxdb/influxdb_test.go +++ b/plugins/outputs/influxdb/influxdb_test.go @@ -1,313 +1,135 @@ -package influxdb +package influxdb_test import ( - "fmt" - "io" - "net/http" - "net/http/httptest" + "context" "testing" + "time" - "github.com/influxdata/telegraf/plugins/outputs/influxdb/client" - "github.com/influxdata/telegraf/testutil" - - "github.com/stretchr/testify/assert" + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/internal" + "github.com/influxdata/telegraf/plugins/outputs/influxdb" "github.com/stretchr/testify/require" ) -func TestIdentQuoting(t *testing.T) { - var testCases = []struct { - database string - expected string - }{ - {"x-y", `CREATE DATABASE "x-y"`}, - {`x"y`, `CREATE DATABASE "x\"y"`}, - {"x\ny", `CREATE DATABASE "x\ny"`}, - {`x\y`, `CREATE DATABASE "x\\y"`}, - } - - for _, tc := range testCases { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - r.ParseForm() - q := r.Form.Get("q") - assert.Equal(t, tc.expected, q) - - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}]}`) - })) - defer ts.Close() - - i := InfluxDB{ - URLs: []string{ts.URL}, - Database: tc.database, - } - - err := i.Connect() - require.NoError(t, err) - require.NoError(t, i.Close()) - } -} - -func TestUDPInflux(t *testing.T) { - i := InfluxDB{ - URLs: []string{"udp://localhost:8089"}, - } - - err := i.Connect() - require.NoError(t, err) - err = i.Write(testutil.MockMetrics()) - require.NoError(t, err) - require.NoError(t, i.Close()) -} - -func TestHTTPInflux(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/write": - // test that database is set properly - if r.FormValue("db") != "test" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - } - // test that user agent is set properly - if r.UserAgent() != "telegraf" { - w.WriteHeader(http.StatusTeapot) - w.Header().Set("Content-Type", "application/json") - } - w.WriteHeader(http.StatusNoContent) - w.Header().Set("Content-Type", "application/json") - case "/query": - w.WriteHeader(http.StatusOK) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}]}`) - } - })) - defer ts.Close() - - i := newInflux() - i.URLs = []string{ts.URL} - i.Database = "test" - i.UserAgent = "telegraf" - - err := i.Connect() - require.NoError(t, err) - err = i.Write(testutil.MockMetrics()) - require.NoError(t, err) - require.NoError(t, i.Close()) -} - -func TestUDPConnectError(t *testing.T) { - i := InfluxDB{ - URLs: []string{"udp://foobar:8089"}, - } - - err := i.Connect() - require.Error(t, err) - - i = InfluxDB{ - URLs: []string{"udp://localhost:9999999"}, - } - - err = i.Connect() - require.Error(t, err) -} - -func TestHTTPConnectError_InvalidURL(t *testing.T) { - i := InfluxDB{ - URLs: []string{"http://foobar:8089"}, - } - - err := i.Connect() - require.Error(t, err) - - i = InfluxDB{ - URLs: []string{"http://localhost:9999999"}, - } - - err = i.Connect() - require.Error(t, err) -} - -func TestHTTPConnectError_DatabaseCreateFail(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/query": - w.WriteHeader(http.StatusNotFound) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"test error"}`) - } - })) - defer ts.Close() - - i := InfluxDB{ - URLs: []string{ts.URL}, - Database: "test", - } - - // database creation errors do not return an error from Connect - // they are only logged. - err := i.Connect() - require.NoError(t, err) - require.NoError(t, i.Close()) -} - -func TestHTTPError_DatabaseNotFound(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - switch r.URL.Path { - case "/write": - w.WriteHeader(http.StatusNotFound) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"database not found"}`) - case "/query": - w.WriteHeader(http.StatusNotFound) - w.Header().Set("Content-Type", "application/json") - fmt.Fprintln(w, `{"results":[{}],"error":"database not found"}`) - } - })) - defer ts.Close() - - i := InfluxDB{ - URLs: []string{ts.URL}, - Database: "test", - } - - err := i.Connect() - require.NoError(t, err) - err = i.Write(testutil.MockMetrics()) - require.Error(t, err) - require.NoError(t, i.Close()) -} - -func TestHTTPError_WriteErrors(t *testing.T) { - var testCases = []struct { - name string - status int - contentType string - body string - err error - }{ - { - // HTTP/1.1 400 Bad Request - // Content-Type: application/json - // X-Influxdb-Version: 1.3.3 - // - // { - // "error": "partial write: points beyond retention policy dropped=1" - // } - name: "beyond retention policy is not an error", - status: http.StatusBadRequest, - contentType: "application/json", - body: `{"error":"partial write: points beyond retention policy dropped=1"}`, - err: nil, - }, - { - // HTTP/1.1 400 Bad Request - // Content-Type: application/json - // X-Influxdb-Version: 1.3.3 - // - // { - // "error": "unable to parse 'foo bar=': missing field value" - // } - name: "unable to parse is not an error", - status: http.StatusBadRequest, - contentType: "application/json", - body: `{"error":"unable to parse 'foo bar=': missing field value"}`, - err: nil, - }, - { - // HTTP/1.1 400 Bad Request - // Content-Type: application/json - // X-Influxdb-Version: 1.3.3 - // - // { - // "error": "partial write: field type conflict: input field \"bar\" on measurement \"foo\" is type float, already exists as type integer dropped=1" - // } - name: "field type conflict is not an error", - status: http.StatusBadRequest, - contentType: "application/json", - body: `{"error": "partial write: field type conflict: input field \"bar\" on measurement \"foo\" is type float, already exists as type integer dropped=1"}`, - err: nil, - }, - { - // HTTP/1.1 500 Internal Server Error - // Content-Type: application/json - // X-Influxdb-Version: 1.3.3-c1.3.3 - // - // { - // "error": "write failed: hinted handoff queue not empty" - // } - name: "hinted handoff queue not empty is not an error", - status: http.StatusInternalServerError, - contentType: "application/json", - body: `{"error":"write failed: hinted handoff queue not empty"}`, - err: nil, - }, - { - // HTTP/1.1 500 Internal Server Error - // Content-Type: application/json - // X-Influxdb-Version: 1.3.3-c1.3.3 - // - // { - // "error": "partial write" - // } - name: "plain partial write is an error", - status: http.StatusInternalServerError, - contentType: "application/json", - body: `{"error":"partial write"}`, - err: fmt.Errorf("Could not write to any InfluxDB server in cluster"), - }, - } - - for _, tt := range testCases { - t.Run(tt.name, func(t *testing.T) { - ts := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) { - rw.WriteHeader(tt.status) - rw.Header().Set("Content-Type", tt.contentType) - fmt.Fprintln(rw, tt.body) - })) - defer ts.Close() - - influx := InfluxDB{ - URLs: []string{ts.URL}, - Database: "test", - } - - err := influx.Connect() - require.NoError(t, err) - err = influx.Write(testutil.MockMetrics()) - require.Equal(t, tt.err, err) - require.NoError(t, influx.Close()) - }) - } -} - type MockClient struct { - writeStreamCalled int - contentLength int + URLF func() string + DatabaseF func() string + WriteF func(context.Context, []telegraf.Metric) error + CreateDatabaseF func(ctx context.Context) error } -func (m *MockClient) Query(command string) error { - panic("not implemented") +func (c *MockClient) URL() string { + return c.URLF() } -func (m *MockClient) Write(b []byte) (int, error) { - panic("not implemented") +func (c *MockClient) Database() string { + return c.DatabaseF() } -func (m *MockClient) WriteWithParams(b []byte, params client.WriteParams) (int, error) { - panic("not implemented") +func (c *MockClient) Write(ctx context.Context, metrics []telegraf.Metric) error { + return c.WriteF(ctx, metrics) } -func (m *MockClient) WriteStream(b io.Reader, contentLength int) (int, error) { - m.writeStreamCalled++ - m.contentLength = contentLength - return 0, nil +func (c *MockClient) CreateDatabase(ctx context.Context) error { + return c.CreateDatabaseF(ctx) } -func (m *MockClient) WriteStreamWithParams(b io.Reader, contentLength int, params client.WriteParams) (int, error) { - panic("not implemented") +func TestDeprecatedURLSupport(t *testing.T) { + var actual *influxdb.UDPConfig + output := influxdb.InfluxDB{ + URL: "udp://localhost:8086", + + CreateUDPClientF: func(config *influxdb.UDPConfig) (influxdb.Client, error) { + actual = config + return &MockClient{}, nil + }, + } + err := output.Connect() + require.NoError(t, err) + require.Equal(t, "udp://localhost:8086", actual.URL.String()) } -func (m *MockClient) Close() error { - panic("not implemented") +func TestDefaultURL(t *testing.T) { + var actual *influxdb.HTTPConfig + output := influxdb.InfluxDB{ + CreateHTTPClientF: func(config *influxdb.HTTPConfig) (influxdb.Client, error) { + actual = config + return &MockClient{ + CreateDatabaseF: func(ctx context.Context) error { + return nil + }, + }, nil + }, + } + err := output.Connect() + require.NoError(t, err) + require.Equal(t, "http://localhost:8086", actual.URL.String()) +} + +func TestConnectUDPConfig(t *testing.T) { + var actual *influxdb.UDPConfig + + output := influxdb.InfluxDB{ + URLs: []string{"udp://localhost:8086"}, + UDPPayload: 42, + + CreateUDPClientF: func(config *influxdb.UDPConfig) (influxdb.Client, error) { + actual = config + return &MockClient{}, nil + }, + } + err := output.Connect() + require.NoError(t, err) + + require.Equal(t, "udp://localhost:8086", actual.URL.String()) + require.Equal(t, 42, actual.MaxPayloadSize) + require.NotNil(t, actual.Serializer) +} + +func TestConnectHTTPConfig(t *testing.T) { + var actual *influxdb.HTTPConfig + + output := influxdb.InfluxDB{ + URLs: []string{"http://localhost:8089"}, + Database: "telegraf", + RetentionPolicy: "default", + WriteConsistency: "any", + Timeout: internal.Duration{Duration: 5 * time.Second}, + Username: "guy", + Password: "smiley", + UserAgent: "telegraf", + HTTPProxy: "http://localhost:8089", + HTTPHeaders: map[string]string{ + "x": "y", + }, + ContentEncoding: "gzip", + InsecureSkipVerify: true, + + CreateHTTPClientF: func(config *influxdb.HTTPConfig) (influxdb.Client, error) { + actual = config + return &MockClient{ + CreateDatabaseF: func(ctx context.Context) error { + return nil + }, + }, nil + }, + } + err := output.Connect() + require.NoError(t, err) + + require.Equal(t, output.URLs[0], actual.URL.String()) + require.Equal(t, output.UserAgent, actual.UserAgent) + require.Equal(t, output.Timeout.Duration, actual.Timeout) + require.Equal(t, output.Username, actual.Username) + require.Equal(t, output.Password, actual.Password) + require.Equal(t, output.HTTPProxy, actual.Proxy.String()) + require.Equal(t, output.HTTPHeaders, actual.Headers) + require.Equal(t, output.ContentEncoding, actual.ContentEncoding) + require.Equal(t, output.Database, actual.Database) + require.Equal(t, output.RetentionPolicy, actual.RetentionPolicy) + require.Equal(t, output.WriteConsistency, actual.Consistency) + require.NotNil(t, actual.TLSConfig) + require.NotNil(t, actual.Serializer) + + require.Equal(t, output.Database, actual.Database) } diff --git a/plugins/outputs/influxdb/udp.go b/plugins/outputs/influxdb/udp.go new file mode 100644 index 000000000..5b3f5ce51 --- /dev/null +++ b/plugins/outputs/influxdb/udp.go @@ -0,0 +1,116 @@ +package influxdb + +import ( + "context" + "fmt" + "net" + "net/url" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/plugins/serializers" + "github.com/influxdata/telegraf/plugins/serializers/influx" +) + +const ( + // DefaultMaxPayloadSize is the maximum length of the UDP data payload + DefaultMaxPayloadSize = 512 +) + +type Dialer interface { + DialContext(ctx context.Context, network, address string) (Conn, error) +} + +type Conn interface { + Write(b []byte) (int, error) + Close() error +} + +type UDPConfig struct { + MaxPayloadSize int + URL *url.URL + Serializer serializers.Serializer + Dialer Dialer +} + +func NewUDPClient(config *UDPConfig) (*udpClient, error) { + if config.URL == nil { + return nil, ErrMissingURL + } + + size := config.MaxPayloadSize + if size == 0 { + size = DefaultMaxPayloadSize + } + + serializer := config.Serializer + if serializer == nil { + s := influx.NewSerializer() + s.SetMaxLineBytes(config.MaxPayloadSize) + serializer = s + } + + dialer := config.Dialer + if dialer == nil { + dialer = &netDialer{net.Dialer{}} + } + + client := &udpClient{ + url: config.URL, + serializer: serializer, + dialer: dialer, + } + return client, nil +} + +type udpClient struct { + conn Conn + dialer Dialer + serializer serializers.Serializer + url *url.URL +} + +func (c *udpClient) URL() string { + return c.url.String() +} + +func (c *udpClient) Database() string { + return "" +} + +func (c *udpClient) Write(ctx context.Context, metrics []telegraf.Metric) error { + if c.conn == nil { + conn, err := c.dialer.DialContext(ctx, c.url.Scheme, c.url.Host) + if err != nil { + return fmt.Errorf("error dialing address [%s]: %s", c.url, err) + } + c.conn = conn + } + + for _, metric := range metrics { + octets, err := c.serializer.Serialize(metric) + if err != nil { + return fmt.Errorf("could not serialize metric: %v", err) + } + + _, err = c.conn.Write(octets) + if err != nil { + c.conn.Close() + c.conn = nil + return err + } + } + + return nil +} + +func (c *udpClient) CreateDatabase(ctx context.Context) error { + return nil +} + +type netDialer struct { + net.Dialer +} + +func (d *netDialer) DialContext(ctx context.Context, network, address string) (Conn, error) { + return d.Dialer.DialContext(ctx, network, address) +} diff --git a/plugins/outputs/influxdb/udp_test.go b/plugins/outputs/influxdb/udp_test.go new file mode 100644 index 000000000..552e1c0d6 --- /dev/null +++ b/plugins/outputs/influxdb/udp_test.go @@ -0,0 +1,241 @@ +package influxdb_test + +import ( + "bytes" + "context" + "fmt" + "net" + "net/url" + "sync" + "testing" + "time" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/metric" + "github.com/influxdata/telegraf/plugins/outputs/influxdb" + "github.com/influxdata/telegraf/plugins/serializers/influx" + "github.com/stretchr/testify/require" +) + +var ( + metricString = "cpu value=42 0\n" +) + +func getMetric() telegraf.Metric { + metric, err := metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ) + if err != nil { + panic(err) + } + return metric +} + +func getURL() *url.URL { + u, err := url.Parse("udp://localhost:0") + if err != nil { + panic(err) + } + return u +} + +type MockConn struct { + WriteF func(b []byte) (n int, err error) + CloseF func() error +} + +func (c *MockConn) Write(b []byte) (n int, err error) { + return c.WriteF(b) +} + +func (c *MockConn) Close() error { + return c.CloseF() +} + +type MockDialer struct { + DialContextF func(network, address string) (influxdb.Conn, error) +} + +func (d *MockDialer) DialContext(ctx context.Context, network string, address string) (influxdb.Conn, error) { + return d.DialContextF(network, address) +} + +type MockSerializer struct { + SerializeF func(metric telegraf.Metric) ([]byte, error) +} + +func (s *MockSerializer) Serialize(metric telegraf.Metric) ([]byte, error) { + return s.SerializeF(metric) +} + +func TestUDP_NewUDPClientNoURL(t *testing.T) { + config := &influxdb.UDPConfig{} + _, err := influxdb.NewUDPClient(config) + require.Equal(t, err, influxdb.ErrMissingURL) +} + +func TestUDP_URL(t *testing.T) { + u := getURL() + config := &influxdb.UDPConfig{ + URL: u, + } + + client, err := influxdb.NewUDPClient(config) + require.NoError(t, err) + + require.Equal(t, u.String(), client.URL()) +} + +func TestUDP_Simple(t *testing.T) { + var buffer bytes.Buffer + + config := &influxdb.UDPConfig{ + URL: getURL(), + Dialer: &MockDialer{ + DialContextF: func(network, address string) (influxdb.Conn, error) { + conn := &MockConn{ + WriteF: func(b []byte) (n int, err error) { + buffer.Write(b) + return 0, nil + }, + } + return conn, nil + }, + }, + } + client, err := influxdb.NewUDPClient(config) + require.NoError(t, err) + + ctx := context.Background() + err = client.Write(ctx, []telegraf.Metric{ + getMetric(), + getMetric(), + }) + require.NoError(t, err) + + require.Equal(t, metricString+metricString, buffer.String()) +} + +func TestUDP_DialError(t *testing.T) { + u, err := url.Parse("invalid://127.0.0.1:9999") + require.NoError(t, err) + + config := &influxdb.UDPConfig{ + URL: u, + Dialer: &MockDialer{ + DialContextF: func(network, address string) (influxdb.Conn, error) { + return nil, fmt.Errorf( + `unsupported scheme [invalid://localhost:9999]: "invalid"`) + }, + }, + } + client, err := influxdb.NewUDPClient(config) + require.NoError(t, err) + + ctx := context.Background() + err = client.Write(ctx, []telegraf.Metric{getMetric()}) + require.Error(t, err) +} + +func TestUDP_WriteError(t *testing.T) { + closed := false + + config := &influxdb.UDPConfig{ + URL: getURL(), + Dialer: &MockDialer{ + DialContextF: func(network, address string) (influxdb.Conn, error) { + conn := &MockConn{ + WriteF: func(b []byte) (n int, err error) { + return 0, fmt.Errorf( + "write udp 127.0.0.1:52190->127.0.0.1:9999: write: connection refused") + }, + CloseF: func() error { + closed = true + return nil + }, + } + return conn, nil + }, + }, + } + client, err := influxdb.NewUDPClient(config) + require.NoError(t, err) + + ctx := context.Background() + err = client.Write(ctx, []telegraf.Metric{getMetric()}) + require.Error(t, err) + require.True(t, closed) +} + +func TestUDP_SerializeError(t *testing.T) { + config := &influxdb.UDPConfig{ + URL: getURL(), + Dialer: &MockDialer{ + DialContextF: func(network, address string) (influxdb.Conn, error) { + conn := &MockConn{} + return conn, nil + }, + }, + Serializer: &MockSerializer{ + SerializeF: func(metric telegraf.Metric) ([]byte, error) { + return nil, influx.ErrNeedMoreSpace + }, + }, + } + client, err := influxdb.NewUDPClient(config) + require.NoError(t, err) + + ctx := context.Background() + err = client.Write(ctx, []telegraf.Metric{getMetric()}) + require.Error(t, err) + require.Contains(t, err.Error(), influx.ErrNeedMoreSpace.Error()) +} + +func TestUDP_WriteWithRealConn(t *testing.T) { + conn, err := net.ListenPacket("udp", ":0") + require.NoError(t, err) + + metrics := []telegraf.Metric{ + getMetric(), + getMetric(), + } + + buf := make([]byte, 200) + var wg sync.WaitGroup + wg.Add(1) + go func() { + defer wg.Done() + var total int + for _, _ = range metrics { + n, _, err := conn.ReadFrom(buf[total:]) + if err != nil { + break + } + total += n + } + buf = buf[:total] + }() + + addr := conn.LocalAddr() + u, err := url.Parse(fmt.Sprintf("%s://%s", addr.Network(), addr)) + require.NoError(t, err) + + config := &influxdb.UDPConfig{ + URL: u, + } + client, err := influxdb.NewUDPClient(config) + require.NoError(t, err) + + ctx := context.Background() + err = client.Write(ctx, metrics) + require.NoError(t, err) + + wg.Wait() + + require.Equal(t, metricString+metricString, string(buf)) +} diff --git a/plugins/outputs/instrumental/instrumental.go b/plugins/outputs/instrumental/instrumental.go index e10fcbb06..7c52d312b 100644 --- a/plugins/outputs/instrumental/instrumental.go +++ b/plugins/outputs/instrumental/instrumental.go @@ -11,7 +11,6 @@ import ( "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal" - "github.com/influxdata/telegraf/metric" "github.com/influxdata/telegraf/plugins/outputs" "github.com/influxdata/telegraf/plugins/serializers" "github.com/influxdata/telegraf/plugins/serializers/graphite" @@ -93,8 +92,6 @@ func (i *Instrumental) Write(metrics []telegraf.Metric) error { var points []string var metricType string - var toSerialize telegraf.Metric - var newTags map[string]string for _, m := range metrics { // Pull the metric_type out of the metric's tags. We don't want the type @@ -108,18 +105,10 @@ func (i *Instrumental) Write(metrics []telegraf.Metric) error { // // increment some_prefix.host.tag1.tag2.tag3.counter.field value timestamp // - newTags = m.Tags() - metricType = newTags["metric_type"] - delete(newTags, "metric_type") + metricType = m.Tags()["metric_type"] + m.RemoveTag("metric_type") - toSerialize, _ = metric.New( - m.Name(), - newTags, - m.Fields(), - m.Time(), - ) - - buf, err := s.Serialize(toSerialize) + buf, err := s.Serialize(m) if err != nil { log.Printf("E! Error serializing a metric to Instrumental: %s", err) } diff --git a/plugins/outputs/librato/librato.go b/plugins/outputs/librato/librato.go index abd3b055f..244e8bd59 100644 --- a/plugins/outputs/librato/librato.go +++ b/plugins/outputs/librato/librato.go @@ -187,9 +187,7 @@ func (l *Librato) buildGauges(m telegraf.Metric) ([]*Gauge, error) { gauges := []*Gauge{} if m.Time().Unix() == 0 { - return gauges, fmt.Errorf( - "Measure time must not be zero\n <%s> \n", - m.String()) + return gauges, fmt.Errorf("time was zero %s", m.Name()) } metricSource := graphite.InsertField( graphite.SerializeBucketName("", m.Tags(), l.Template, ""), diff --git a/plugins/outputs/mqtt/mqtt.go b/plugins/outputs/mqtt/mqtt.go index 3e2a36e9e..eea7b6088 100644 --- a/plugins/outputs/mqtt/mqtt.go +++ b/plugins/outputs/mqtt/mqtt.go @@ -138,8 +138,7 @@ func (m *MQTT) Write(metrics []telegraf.Metric) error { buf, err := m.serializer.Serialize(metric) if err != nil { - return fmt.Errorf("MQTT Could not serialize metric: %s", - metric.String()) + return err } err = m.publish(topic, buf) diff --git a/plugins/outputs/opentsdb/opentsdb.go b/plugins/outputs/opentsdb/opentsdb.go index 51d20117b..c38ad353b 100644 --- a/plugins/outputs/opentsdb/opentsdb.go +++ b/plugins/outputs/opentsdb/opentsdb.go @@ -125,7 +125,7 @@ func (o *OpenTSDB) WriteHttp(metrics []telegraf.Metric, u *url.URL) error { } for _, m := range metrics { - now := m.UnixNano() / 1000000000 + now := m.Time().UnixNano() / 1000000000 tags := cleanTags(m.Tags()) for fieldName, value := range m.Fields() { @@ -170,7 +170,7 @@ func (o *OpenTSDB) WriteTelnet(metrics []telegraf.Metric, u *url.URL) error { defer connection.Close() for _, m := range metrics { - now := m.UnixNano() / 1000000000 + now := m.Time().UnixNano() / 1000000000 tags := ToLineFormat(cleanTags(m.Tags())) for fieldName, value := range m.Fields() { diff --git a/plugins/outputs/wavefront/wavefront.go b/plugins/outputs/wavefront/wavefront.go index 563e58bbd..1e015c9f0 100644 --- a/plugins/outputs/wavefront/wavefront.go +++ b/plugins/outputs/wavefront/wavefront.go @@ -9,9 +9,10 @@ import ( "strconv" "strings" + "time" + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/outputs" - "time" ) type Wavefront struct { @@ -159,7 +160,7 @@ func buildMetrics(m telegraf.Metric, w *Wavefront) []*MetricPoint { metric := &MetricPoint{ Metric: name, - Timestamp: m.UnixNano() / 1000000000, + Timestamp: m.Time().Unix(), } metricValue, buildError := buildValue(value, metric.Metric, w) diff --git a/plugins/parsers/dropwizard/parser.go b/plugins/parsers/dropwizard/parser.go index 4c07ca286..a6130acfd 100644 --- a/plugins/parsers/dropwizard/parser.go +++ b/plugins/parsers/dropwizard/parser.go @@ -10,7 +10,7 @@ import ( "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/internal/templating" - "github.com/influxdata/telegraf/metric" + "github.com/influxdata/telegraf/plugins/parsers/influx" "github.com/tidwall/gjson" ) @@ -195,7 +195,7 @@ func (p *Parser) unmarshalMetrics(buf []byte) (map[string]interface{}, error) { return jsonOut, nil } -func (p *Parser) readDWMetrics(metricType string, dwms interface{}, metrics []telegraf.Metric, time time.Time) []telegraf.Metric { +func (p *Parser) readDWMetrics(metricType string, dwms interface{}, metrics []telegraf.Metric, tm time.Time) []telegraf.Metric { switch dwmsTyped := dwms.(type) { case map[string]interface{}: @@ -240,10 +240,15 @@ func (p *Parser) readDWMetrics(metricType string, dwms interface{}, metrics []te metricsBuffer.WriteString(strings.Join(fields, ",")) metricsBuffer.WriteString("\n") } - newMetrics, err := metric.ParseWithDefaultTime(metricsBuffer.Bytes(), time) + + handler := influx.NewMetricHandler() + handler.SetTimeFunc(func() time.Time { return tm }) + parser := influx.NewParser(handler) + newMetrics, err := parser.Parse(metricsBuffer.Bytes()) if err != nil { log.Printf("W! failed to create metric of type '%s': %s\n", metricType, err) } + return append(metrics, newMetrics...) default: return metrics diff --git a/plugins/parsers/graphite/parser.go b/plugins/parsers/graphite/parser.go index 42d617c7d..fc32bd83d 100644 --- a/plugins/parsers/graphite/parser.go +++ b/plugins/parsers/graphite/parser.go @@ -89,7 +89,6 @@ func (p *GraphiteParser) Parse(buf []byte) ([]telegraf.Metric, error) { if line == "" { continue } - metric, err := p.ParseLine(line) if err == nil { metrics = append(metrics, metric) diff --git a/plugins/parsers/graphite/parser_test.go b/plugins/parsers/graphite/parser_test.go index c1c25f986..9a6b462f7 100644 --- a/plugins/parsers/graphite/parser_test.go +++ b/plugins/parsers/graphite/parser_test.go @@ -10,6 +10,7 @@ import ( "github.com/influxdata/telegraf/metric" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func BenchmarkParse(b *testing.B) { @@ -379,7 +380,7 @@ func TestFilterMatchDefault(t *testing.T) { m, err := p.ParseLine("miss.servers.localhost.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Equal(t, exp.String(), m.String()) + assert.Equal(t, exp, m) } func TestFilterMatchMultipleMeasurement(t *testing.T) { @@ -397,7 +398,7 @@ func TestFilterMatchMultipleMeasurement(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu.cpu_load.10 11 1435077219") assert.NoError(t, err) - assert.Equal(t, exp.String(), m.String()) + assert.Equal(t, exp, m) } func TestFilterMatchMultipleMeasurementSeparator(t *testing.T) { @@ -416,7 +417,7 @@ func TestFilterMatchMultipleMeasurementSeparator(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu.cpu_load.10 11 1435077219") assert.NoError(t, err) - assert.Equal(t, exp.String(), m.String()) + assert.Equal(t, exp, m) } func TestFilterMatchSingle(t *testing.T) { @@ -433,7 +434,7 @@ func TestFilterMatchSingle(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Equal(t, exp.String(), m.String()) + assert.Equal(t, exp, m) } func TestParseNoMatch(t *testing.T) { @@ -451,7 +452,7 @@ func TestParseNoMatch(t *testing.T) { m, err := p.ParseLine("servers.localhost.memory.VmallocChunk 11 1435077219") assert.NoError(t, err) - assert.Equal(t, exp.String(), m.String()) + assert.Equal(t, exp, m) } func TestFilterMatchWildcard(t *testing.T) { @@ -469,7 +470,7 @@ func TestFilterMatchWildcard(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Equal(t, exp.String(), m.String()) + assert.Equal(t, exp, m) } func TestFilterMatchExactBeforeWildcard(t *testing.T) { @@ -489,7 +490,7 @@ func TestFilterMatchExactBeforeWildcard(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Equal(t, exp.String(), m.String()) + assert.Equal(t, exp, m) } func TestFilterMatchMostLongestFilter(t *testing.T) { @@ -508,8 +509,13 @@ func TestFilterMatchMostLongestFilter(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Contains(t, m.String(), ",host=localhost") - assert.Contains(t, m.String(), ",resource=cpu") + value, ok := m.GetTag("host") + require.True(t, ok) + require.Equal(t, "localhost", value) + + value, ok = m.GetTag("resource") + require.True(t, ok) + require.Equal(t, "cpu", value) } func TestFilterMatchMultipleWildcards(t *testing.T) { @@ -533,7 +539,7 @@ func TestFilterMatchMultipleWildcards(t *testing.T) { m, err := p.ParseLine("servers.server01.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Equal(t, exp.String(), m.String()) + assert.Equal(t, exp, m) } func TestParseDefaultTags(t *testing.T) { @@ -549,9 +555,17 @@ func TestParseDefaultTags(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Contains(t, m.String(), ",host=localhost") - assert.Contains(t, m.String(), ",region=us-east") - assert.Contains(t, m.String(), ",zone=1c") + value, ok := m.GetTag("host") + require.True(t, ok) + require.Equal(t, "localhost", value) + + value, ok = m.GetTag("region") + require.True(t, ok) + require.Equal(t, "us-east", value) + + value, ok = m.GetTag("zone") + require.True(t, ok) + require.Equal(t, "1c", value) } func TestParseDefaultTemplateTags(t *testing.T) { @@ -566,9 +580,17 @@ func TestParseDefaultTemplateTags(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Contains(t, m.String(), ",host=localhost") - assert.Contains(t, m.String(), ",region=us-east") - assert.Contains(t, m.String(), ",zone=1c") + value, ok := m.GetTag("host") + require.True(t, ok) + require.Equal(t, "localhost", value) + + value, ok = m.GetTag("region") + require.True(t, ok) + require.Equal(t, "us-east", value) + + value, ok = m.GetTag("zone") + require.True(t, ok) + require.Equal(t, "1c", value) } func TestParseDefaultTemplateTagsOverridGlobal(t *testing.T) { @@ -581,11 +603,20 @@ func TestParseDefaultTemplateTagsOverridGlobal(t *testing.T) { } m, err := p.ParseLine("servers.localhost.cpu_load 11 1435077219") + _ = m assert.NoError(t, err) - assert.Contains(t, m.String(), ",host=localhost") - assert.Contains(t, m.String(), ",region=us-east") - assert.Contains(t, m.String(), ",zone=1c") + value, ok := m.GetTag("host") + require.True(t, ok) + require.Equal(t, "localhost", value) + + value, ok = m.GetTag("region") + require.True(t, ok) + require.Equal(t, "us-east", value) + + value, ok = m.GetTag("zone") + require.True(t, ok) + require.Equal(t, "1c", value) } func TestParseTemplateWhitespace(t *testing.T) { @@ -602,9 +633,17 @@ func TestParseTemplateWhitespace(t *testing.T) { m, err := p.ParseLine("servers.localhost.cpu_load 11 1435077219") assert.NoError(t, err) - assert.Contains(t, m.String(), ",host=localhost") - assert.Contains(t, m.String(), ",region=us-east") - assert.Contains(t, m.String(), ",zone=1c") + value, ok := m.GetTag("host") + require.True(t, ok) + require.Equal(t, "localhost", value) + + value, ok = m.GetTag("region") + require.True(t, ok) + require.Equal(t, "us-east", value) + + value, ok = m.GetTag("zone") + require.True(t, ok) + require.Equal(t, "1c", value) } // Test basic functionality of ApplyTemplate diff --git a/plugins/parsers/influx/500.metrics b/plugins/parsers/influx/500.metrics deleted file mode 100644 index 1a77886fa..000000000 --- a/plugins/parsers/influx/500.metrics +++ /dev/null @@ -1,500 +0,0 @@ -ctr,host=tars,some=tag-0 n=3i 1476437629342569532 -ctr,host=tars,some=tag-1 n=3i 1476437629342569532 -ctr,host=tars,some=tag-2 n=3i 1476437629342569532 -ctr,host=tars,some=tag-3 n=3i 1476437629342569532 -ctr,host=tars,some=tag-4 n=3i 1476437629342569532 -ctr,host=tars,some=tag-5 n=3i 1476437629342569532 -ctr,host=tars,some=tag-6 n=3i 1476437629342569532 -ctr,host=tars,some=tag-7 n=3i 1476437629342569532 -ctr,host=tars,some=tag-8 n=3i 1476437629342569532 -ctr,host=tars,some=tag-9 n=3i 1476437629342569532 -ctr,host=tars,some=tag-10 n=3i 1476437629342569532 -ctr,host=tars,some=tag-11 n=3i 1476437629342569532 -ctr,host=tars,some=tag-12 n=3i 1476437629342569532 -ctr,host=tars,some=tag-13 n=3i 1476437629342569532 -ctr,host=tars,some=tag-14 n=3i 1476437629342569532 -ctr,host=tars,some=tag-15 n=3i 1476437629342569532 -ctr,host=tars,some=tag-16 n=3i 1476437629342569532 -ctr,host=tars,some=tag-17 n=3i 1476437629342569532 -ctr,host=tars,some=tag-18 n=3i 1476437629342569532 -ctr,host=tars,some=tag-19 n=3i 1476437629342569532 -ctr,host=tars,some=tag-20 n=3i 1476437629342569532 -ctr,host=tars,some=tag-21 n=3i 1476437629342569532 -ctr,host=tars,some=tag-22 n=3i 1476437629342569532 -ctr,host=tars,some=tag-23 n=3i 1476437629342569532 -ctr,host=tars,some=tag-24 n=3i 1476437629342569532 -ctr,host=tars,some=tag-25 n=3i 1476437629342569532 -ctr,host=tars,some=tag-26 n=3i 1476437629342569532 -ctr,host=tars,some=tag-27 n=3i 1476437629342569532 -ctr,host=tars,some=tag-28 n=3i 1476437629342569532 -ctr,host=tars,some=tag-29 n=3i 1476437629342569532 -ctr,host=tars,some=tag-30 n=3i 1476437629342569532 -ctr,host=tars,some=tag-31 n=2i 1476437629342569532 -ctr,host=tars,some=tag-32 n=2i 1476437629342569532 -ctr,host=tars,some=tag-33 n=2i 1476437629342569532 -ctr,host=tars,some=tag-34 n=2i 1476437629342569532 -ctr,host=tars,some=tag-35 n=2i 1476437629342569532 -ctr,host=tars,some=tag-36 n=2i 1476437629342569532 -ctr,host=tars,some=tag-37 n=2i 1476437629342569532 -ctr,host=tars,some=tag-38 n=2i 1476437629342569532 -ctr,host=tars,some=tag-39 n=2i 1476437629342569532 -ctr,host=tars,some=tag-40 n=2i 1476437629342569532 -ctr,host=tars,some=tag-41 n=2i 1476437629342569532 -ctr,host=tars,some=tag-42 n=2i 1476437629342569532 -ctr,host=tars,some=tag-43 n=2i 1476437629342569532 -ctr,host=tars,some=tag-44 n=2i 1476437629342569532 -ctr,host=tars,some=tag-45 n=2i 1476437629342569532 -ctr,host=tars,some=tag-46 n=2i 1476437629342569532 -ctr,host=tars,some=tag-47 n=2i 1476437629342569532 -ctr,host=tars,some=tag-48 n=2i 1476437629342569532 -ctr,host=tars,some=tag-49 n=2i 1476437629342569532 -ctr,host=tars,some=tag-50 n=2i 1476437629342569532 -ctr,host=tars,some=tag-51 n=2i 1476437629342569532 -ctr,host=tars,some=tag-52 n=2i 1476437629342569532 -ctr,host=tars,some=tag-53 n=2i 1476437629342569532 -ctr,host=tars,some=tag-54 n=2i 1476437629342569532 -ctr,host=tars,some=tag-55 n=2i 1476437629342569532 -ctr,host=tars,some=tag-56 n=2i 1476437629342569532 -ctr,host=tars,some=tag-57 n=2i 1476437629342569532 -ctr,host=tars,some=tag-58 n=2i 1476437629342569532 -ctr,host=tars,some=tag-59 n=2i 1476437629342569532 -ctr,host=tars,some=tag-60 n=2i 1476437629342569532 -ctr,host=tars,some=tag-61 n=2i 1476437629342569532 -ctr,host=tars,some=tag-62 n=2i 1476437629342569532 -ctr,host=tars,some=tag-63 n=2i 1476437629342569532 -ctr,host=tars,some=tag-64 n=2i 1476437629342569532 -ctr,host=tars,some=tag-65 n=2i 1476437629342569532 -ctr,host=tars,some=tag-66 n=2i 1476437629342569532 -ctr,host=tars,some=tag-67 n=2i 1476437629342569532 -ctr,host=tars,some=tag-68 n=2i 1476437629342569532 -ctr,host=tars,some=tag-69 n=2i 1476437629342569532 -ctr,host=tars,some=tag-70 n=2i 1476437629342569532 -ctr,host=tars,some=tag-71 n=2i 1476437629342569532 -ctr,host=tars,some=tag-72 n=2i 1476437629342569532 -ctr,host=tars,some=tag-73 n=2i 1476437629342569532 -ctr,host=tars,some=tag-74 n=2i 1476437629342569532 -ctr,host=tars,some=tag-75 n=2i 1476437629342569532 -ctr,host=tars,some=tag-76 n=2i 1476437629342569532 -ctr,host=tars,some=tag-77 n=2i 1476437629342569532 -ctr,host=tars,some=tag-78 n=2i 1476437629342569532 -ctr,host=tars,some=tag-79 n=2i 1476437629342569532 -ctr,host=tars,some=tag-80 n=2i 1476437629342569532 -ctr,host=tars,some=tag-81 n=2i 1476437629342569532 -ctr,host=tars,some=tag-82 n=2i 1476437629342569532 -ctr,host=tars,some=tag-83 n=2i 1476437629342569532 -ctr,host=tars,some=tag-84 n=2i 1476437629342569532 -ctr,host=tars,some=tag-85 n=2i 1476437629342569532 -ctr,host=tars,some=tag-86 n=2i 1476437629342569532 -ctr,host=tars,some=tag-87 n=2i 1476437629342569532 -ctr,host=tars,some=tag-88 n=2i 1476437629342569532 -ctr,host=tars,some=tag-89 n=2i 1476437629342569532 -ctr,host=tars,some=tag-90 n=2i 1476437629342569532 -ctr,host=tars,some=tag-91 n=2i 1476437629342569532 -ctr,host=tars,some=tag-92 n=2i 1476437629342569532 -ctr,host=tars,some=tag-93 n=2i 1476437629342569532 -ctr,host=tars,some=tag-94 n=2i 1476437629342569532 -ctr,host=tars,some=tag-95 n=2i 1476437629342569532 -ctr,host=tars,some=tag-96 n=2i 1476437629342569532 -ctr,host=tars,some=tag-97 n=2i 1476437629342569532 -ctr,host=tars,some=tag-98 n=2i 1476437629342569532 -ctr,host=tars,some=tag-99 n=2i 1476437629342569532 -ctr,host=tars,some=tag-100 n=2i 1476437629342569532 -ctr,host=tars,some=tag-101 n=2i 1476437629342569532 -ctr,host=tars,some=tag-102 n=2i 1476437629342569532 -ctr,host=tars,some=tag-103 n=2i 1476437629342569532 -ctr,host=tars,some=tag-104 n=2i 1476437629342569532 -ctr,host=tars,some=tag-105 n=2i 1476437629342569532 -ctr,host=tars,some=tag-106 n=2i 1476437629342569532 -ctr,host=tars,some=tag-107 n=2i 1476437629342569532 -ctr,host=tars,some=tag-108 n=2i 1476437629342569532 -ctr,host=tars,some=tag-109 n=2i 1476437629342569532 -ctr,host=tars,some=tag-110 n=2i 1476437629342569532 -ctr,host=tars,some=tag-111 n=2i 1476437629342569532 -ctr,host=tars,some=tag-112 n=2i 1476437629342569532 -ctr,host=tars,some=tag-113 n=2i 1476437629342569532 -ctr,host=tars,some=tag-114 n=2i 1476437629342569532 -ctr,host=tars,some=tag-115 n=2i 1476437629342569532 -ctr,host=tars,some=tag-116 n=2i 1476437629342569532 -ctr,host=tars,some=tag-117 n=2i 1476437629342569532 -ctr,host=tars,some=tag-118 n=2i 1476437629342569532 -ctr,host=tars,some=tag-119 n=2i 1476437629342569532 -ctr,host=tars,some=tag-120 n=2i 1476437629342569532 -ctr,host=tars,some=tag-121 n=2i 1476437629342569532 -ctr,host=tars,some=tag-122 n=2i 1476437629342569532 -ctr,host=tars,some=tag-123 n=2i 1476437629342569532 -ctr,host=tars,some=tag-124 n=2i 1476437629342569532 -ctr,host=tars,some=tag-125 n=2i 1476437629342569532 -ctr,host=tars,some=tag-126 n=2i 1476437629342569532 -ctr,host=tars,some=tag-127 n=2i 1476437629342569532 -ctr,host=tars,some=tag-128 n=2i 1476437629342569532 -ctr,host=tars,some=tag-129 n=2i 1476437629342569532 -ctr,host=tars,some=tag-130 n=2i 1476437629342569532 -ctr,host=tars,some=tag-131 n=2i 1476437629342569532 -ctr,host=tars,some=tag-132 n=2i 1476437629342569532 -ctr,host=tars,some=tag-133 n=2i 1476437629342569532 -ctr,host=tars,some=tag-134 n=2i 1476437629342569532 -ctr,host=tars,some=tag-135 n=2i 1476437629342569532 -ctr,host=tars,some=tag-136 n=2i 1476437629342569532 -ctr,host=tars,some=tag-137 n=2i 1476437629342569532 -ctr,host=tars,some=tag-138 n=2i 1476437629342569532 -ctr,host=tars,some=tag-139 n=2i 1476437629342569532 -ctr,host=tars,some=tag-140 n=2i 1476437629342569532 -ctr,host=tars,some=tag-141 n=2i 1476437629342569532 -ctr,host=tars,some=tag-142 n=2i 1476437629342569532 -ctr,host=tars,some=tag-143 n=2i 1476437629342569532 -ctr,host=tars,some=tag-144 n=2i 1476437629342569532 -ctr,host=tars,some=tag-145 n=2i 1476437629342569532 -ctr,host=tars,some=tag-146 n=2i 1476437629342569532 -ctr,host=tars,some=tag-147 n=2i 1476437629342569532 -ctr,host=tars,some=tag-148 n=2i 1476437629342569532 -ctr,host=tars,some=tag-149 n=2i 1476437629342569532 -ctr,host=tars,some=tag-150 n=2i 1476437629342569532 -ctr,host=tars,some=tag-151 n=2i 1476437629342569532 -ctr,host=tars,some=tag-152 n=2i 1476437629342569532 -ctr,host=tars,some=tag-153 n=2i 1476437629342569532 -ctr,host=tars,some=tag-154 n=2i 1476437629342569532 -ctr,host=tars,some=tag-155 n=2i 1476437629342569532 -ctr,host=tars,some=tag-156 n=2i 1476437629342569532 -ctr,host=tars,some=tag-157 n=2i 1476437629342569532 -ctr,host=tars,some=tag-158 n=2i 1476437629342569532 -ctr,host=tars,some=tag-159 n=2i 1476437629342569532 -ctr,host=tars,some=tag-160 n=2i 1476437629342569532 -ctr,host=tars,some=tag-161 n=2i 1476437629342569532 -ctr,host=tars,some=tag-162 n=2i 1476437629342569532 -ctr,host=tars,some=tag-163 n=2i 1476437629342569532 -ctr,host=tars,some=tag-164 n=2i 1476437629342569532 -ctr,host=tars,some=tag-165 n=2i 1476437629342569532 -ctr,host=tars,some=tag-166 n=2i 1476437629342569532 -ctr,host=tars,some=tag-167 n=2i 1476437629342569532 -ctr,host=tars,some=tag-168 n=2i 1476437629342569532 -ctr,host=tars,some=tag-169 n=2i 1476437629342569532 -ctr,host=tars,some=tag-170 n=2i 1476437629342569532 -ctr,host=tars,some=tag-171 n=2i 1476437629342569532 -ctr,host=tars,some=tag-172 n=2i 1476437629342569532 -ctr,host=tars,some=tag-173 n=2i 1476437629342569532 -ctr,host=tars,some=tag-174 n=2i 1476437629342569532 -ctr,host=tars,some=tag-175 n=2i 1476437629342569532 -ctr,host=tars,some=tag-176 n=2i 1476437629342569532 -ctr,host=tars,some=tag-177 n=2i 1476437629342569532 -ctr,host=tars,some=tag-178 n=2i 1476437629342569532 -ctr,host=tars,some=tag-179 n=2i 1476437629342569532 -ctr,host=tars,some=tag-180 n=2i 1476437629342569532 -ctr,host=tars,some=tag-181 n=2i 1476437629342569532 -ctr,host=tars,some=tag-182 n=2i 1476437629342569532 -ctr,host=tars,some=tag-183 n=2i 1476437629342569532 -ctr,host=tars,some=tag-184 n=2i 1476437629342569532 -ctr,host=tars,some=tag-185 n=2i 1476437629342569532 -ctr,host=tars,some=tag-186 n=2i 1476437629342569532 -ctr,host=tars,some=tag-187 n=2i 1476437629342569532 -ctr,host=tars,some=tag-188 n=2i 1476437629342569532 -ctr,host=tars,some=tag-189 n=2i 1476437629342569532 -ctr,host=tars,some=tag-190 n=2i 1476437629342569532 -ctr,host=tars,some=tag-191 n=2i 1476437629342569532 -ctr,host=tars,some=tag-192 n=2i 1476437629342569532 -ctr,host=tars,some=tag-193 n=2i 1476437629342569532 -ctr,host=tars,some=tag-194 n=2i 1476437629342569532 -ctr,host=tars,some=tag-195 n=2i 1476437629342569532 -ctr,host=tars,some=tag-196 n=2i 1476437629342569532 -ctr,host=tars,some=tag-197 n=2i 1476437629342569532 -ctr,host=tars,some=tag-198 n=2i 1476437629342569532 -ctr,host=tars,some=tag-199 n=2i 1476437629342569532 -ctr,host=tars,some=tag-200 n=2i 1476437629342569532 -ctr,host=tars,some=tag-201 n=2i 1476437629342569532 -ctr,host=tars,some=tag-202 n=2i 1476437629342569532 -ctr,host=tars,some=tag-203 n=2i 1476437629342569532 -ctr,host=tars,some=tag-204 n=2i 1476437629342569532 -ctr,host=tars,some=tag-205 n=2i 1476437629342569532 -ctr,host=tars,some=tag-206 n=2i 1476437629342569532 -ctr,host=tars,some=tag-207 n=2i 1476437629342569532 -ctr,host=tars,some=tag-208 n=2i 1476437629342569532 -ctr,host=tars,some=tag-209 n=2i 1476437629342569532 -ctr,host=tars,some=tag-210 n=2i 1476437629342569532 -ctr,host=tars,some=tag-211 n=2i 1476437629342569532 -ctr,host=tars,some=tag-212 n=2i 1476437629342569532 -ctr,host=tars,some=tag-213 n=2i 1476437629342569532 -ctr,host=tars,some=tag-214 n=2i 1476437629342569532 -ctr,host=tars,some=tag-215 n=2i 1476437629342569532 -ctr,host=tars,some=tag-216 n=2i 1476437629342569532 -ctr,host=tars,some=tag-217 n=2i 1476437629342569532 -ctr,host=tars,some=tag-218 n=2i 1476437629342569532 -ctr,host=tars,some=tag-219 n=2i 1476437629342569532 -ctr,host=tars,some=tag-220 n=2i 1476437629342569532 -ctr,host=tars,some=tag-221 n=2i 1476437629342569532 -ctr,host=tars,some=tag-222 n=2i 1476437629342569532 -ctr,host=tars,some=tag-223 n=2i 1476437629342569532 -ctr,host=tars,some=tag-224 n=2i 1476437629342569532 -ctr,host=tars,some=tag-225 n=2i 1476437629342569532 -ctr,host=tars,some=tag-226 n=2i 1476437629342569532 -ctr,host=tars,some=tag-227 n=2i 1476437629342569532 -ctr,host=tars,some=tag-228 n=2i 1476437629342569532 -ctr,host=tars,some=tag-229 n=2i 1476437629342569532 -ctr,host=tars,some=tag-230 n=2i 1476437629342569532 -ctr,host=tars,some=tag-231 n=2i 1476437629342569532 -ctr,host=tars,some=tag-232 n=2i 1476437629342569532 -ctr,host=tars,some=tag-233 n=2i 1476437629342569532 -ctr,host=tars,some=tag-234 n=2i 1476437629342569532 -ctr,host=tars,some=tag-235 n=2i 1476437629342569532 -ctr,host=tars,some=tag-236 n=2i 1476437629342569532 -ctr,host=tars,some=tag-237 n=2i 1476437629342569532 -ctr,host=tars,some=tag-238 n=2i 1476437629342569532 -ctr,host=tars,some=tag-239 n=2i 1476437629342569532 -ctr,host=tars,some=tag-240 n=2i 1476437629342569532 -ctr,host=tars,some=tag-241 n=2i 1476437629342569532 -ctr,host=tars,some=tag-242 n=2i 1476437629342569532 -ctr,host=tars,some=tag-243 n=2i 1476437629342569532 -ctr,host=tars,some=tag-244 n=2i 1476437629342569532 -ctr,host=tars,some=tag-245 n=2i 1476437629342569532 -ctr,host=tars,some=tag-246 n=2i 1476437629342569532 -ctr,host=tars,some=tag-247 n=2i 1476437629342569532 -ctr,host=tars,some=tag-248 n=2i 1476437629342569532 -ctr,host=tars,some=tag-249 n=2i 1476437629342569532 -ctr,host=tars,some=tag-250 n=2i 1476437629342569532 -ctr,host=tars,some=tag-251 n=1i 1476437629342569532 -ctr,host=tars,some=tag-252 n=1i 1476437629342569532 -ctr,host=tars,some=tag-253 n=1i 1476437629342569532 -ctr,host=tars,some=tag-254 n=1i 1476437629342569532 -ctr,host=tars,some=tag-255 n=1i 1476437629342569532 -ctr,host=tars,some=tag-256 n=1i 1476437629342569532 -ctr,host=tars,some=tag-257 n=1i 1476437629342569532 -ctr,host=tars,some=tag-258 n=1i 1476437629342569532 -ctr,host=tars,some=tag-259 n=1i 1476437629342569532 -ctr,host=tars,some=tag-260 n=1i 1476437629342569532 -ctr,host=tars,some=tag-261 n=1i 1476437629342569532 -ctr,host=tars,some=tag-262 n=1i 1476437629342569532 -ctr,host=tars,some=tag-263 n=1i 1476437629342569532 -ctr,host=tars,some=tag-264 n=1i 1476437629342569532 -ctr,host=tars,some=tag-265 n=1i 1476437629342569532 -ctr,host=tars,some=tag-266 n=1i 1476437629342569532 -ctr,host=tars,some=tag-267 n=1i 1476437629342569532 -ctr,host=tars,some=tag-268 n=1i 1476437629342569532 -ctr,host=tars,some=tag-269 n=1i 1476437629342569532 -ctr,host=tars,some=tag-270 n=1i 1476437629342569532 -ctr,host=tars,some=tag-271 n=1i 1476437629342569532 -ctr,host=tars,some=tag-272 n=1i 1476437629342569532 -ctr,host=tars,some=tag-273 n=1i 1476437629342569532 -ctr,host=tars,some=tag-274 n=1i 1476437629342569532 -ctr,host=tars,some=tag-275 n=1i 1476437629342569532 -ctr,host=tars,some=tag-276 n=1i 1476437629342569532 -ctr,host=tars,some=tag-277 n=1i 1476437629342569532 -ctr,host=tars,some=tag-278 n=1i 1476437629342569532 -ctr,host=tars,some=tag-279 n=1i 1476437629342569532 -ctr,host=tars,some=tag-280 n=1i 1476437629342569532 -ctr,host=tars,some=tag-281 n=1i 1476437629342569532 -ctr,host=tars,some=tag-282 n=1i 1476437629342569532 -ctr,host=tars,some=tag-283 n=1i 1476437629342569532 -ctr,host=tars,some=tag-284 n=1i 1476437629342569532 -ctr,host=tars,some=tag-285 n=1i 1476437629342569532 -ctr,host=tars,some=tag-286 n=1i 1476437629342569532 -ctr,host=tars,some=tag-287 n=1i 1476437629342569532 -ctr,host=tars,some=tag-288 n=1i 1476437629342569532 -ctr,host=tars,some=tag-289 n=1i 1476437629342569532 -ctr,host=tars,some=tag-290 n=1i 1476437629342569532 -ctr,host=tars,some=tag-291 n=1i 1476437629342569532 -ctr,host=tars,some=tag-292 n=1i 1476437629342569532 -ctr,host=tars,some=tag-293 n=1i 1476437629342569532 -ctr,host=tars,some=tag-294 n=1i 1476437629342569532 -ctr,host=tars,some=tag-295 n=1i 1476437629342569532 -ctr,host=tars,some=tag-296 n=1i 1476437629342569532 -ctr,host=tars,some=tag-297 n=1i 1476437629342569532 -ctr,host=tars,some=tag-298 n=1i 1476437629342569532 -ctr,host=tars,some=tag-299 n=1i 1476437629342569532 -ctr,host=tars,some=tag-300 n=1i 1476437629342569532 -ctr,host=tars,some=tag-301 n=1i 1476437629342569532 -ctr,host=tars,some=tag-302 n=1i 1476437629342569532 -ctr,host=tars,some=tag-303 n=1i 1476437629342569532 -ctr,host=tars,some=tag-304 n=1i 1476437629342569532 -ctr,host=tars,some=tag-305 n=1i 1476437629342569532 -ctr,host=tars,some=tag-306 n=1i 1476437629342569532 -ctr,host=tars,some=tag-307 n=1i 1476437629342569532 -ctr,host=tars,some=tag-308 n=1i 1476437629342569532 -ctr,host=tars,some=tag-309 n=1i 1476437629342569532 -ctr,host=tars,some=tag-310 n=1i 1476437629342569532 -ctr,host=tars,some=tag-311 n=1i 1476437629342569532 -ctr,host=tars,some=tag-312 n=0i 1476437629342569532 -ctr,host=tars,some=tag-313 n=0i 1476437629342569532 -ctr,host=tars,some=tag-314 n=0i 1476437629342569532 -ctr,host=tars,some=tag-315 n=0i 1476437629342569532 -ctr,host=tars,some=tag-316 n=0i 1476437629342569532 -ctr,host=tars,some=tag-317 n=0i 1476437629342569532 -ctr,host=tars,some=tag-318 n=0i 1476437629342569532 -ctr,host=tars,some=tag-319 n=0i 1476437629342569532 -ctr,host=tars,some=tag-320 n=0i 1476437629342523514 -ctr,host=tars,some=tag-321 n=0i 1476437629342523514 -ctr,host=tars,some=tag-322 n=0i 1476437629342523514 -ctr,host=tars,some=tag-323 n=0i 1476437629342523514 -ctr,host=tars,some=tag-324 n=0i 1476437629342523514 -ctr,host=tars,some=tag-325 n=0i 1476437629342569532 -ctr,host=tars,some=tag-326 n=0i 1476437629342523514 -ctr,host=tars,some=tag-327 n=0i 1476437629342523514 -ctr,host=tars,some=tag-328 n=0i 1476437629342523514 -ctr,host=tars,some=tag-329 n=0i 1476437629342523514 -ctr,host=tars,some=tag-330 n=0i 1476437629342569532 -ctr,host=tars,some=tag-331 n=0i 1476437629342569532 -ctr,host=tars,some=tag-332 n=0i 1476437629342569532 -ctr,host=tars,some=tag-333 n=0i 1476437629342569532 -ctr,host=tars,some=tag-334 n=0i 1476437629342569532 -ctr,host=tars,some=tag-335 n=0i 1476437629342569532 -ctr,host=tars,some=tag-336 n=0i 1476437629342569532 -ctr,host=tars,some=tag-337 n=0i 1476437629342569532 -ctr,host=tars,some=tag-338 n=0i 1476437629342523514 -ctr,host=tars,some=tag-339 n=0i 1476437629342523514 -ctr,host=tars,some=tag-340 n=0i 1476437629342523514 -ctr,host=tars,some=tag-341 n=0i 1476437629342569532 -ctr,host=tars,some=tag-342 n=1i 1476437629342569532 -ctr,host=tars,some=tag-343 n=1i 1476437629342569532 -ctr,host=tars,some=tag-344 n=1i 1476437629342569532 -ctr,host=tars,some=tag-345 n=1i 1476437629342569532 -ctr,host=tars,some=tag-346 n=1i 1476437629342569532 -ctr,host=tars,some=tag-347 n=1i 1476437629342569532 -ctr,host=tars,some=tag-348 n=1i 1476437629342569532 -ctr,host=tars,some=tag-349 n=1i 1476437629342569532 -ctr,host=tars,some=tag-350 n=1i 1476437629342569532 -ctr,host=tars,some=tag-351 n=1i 1476437629342569532 -ctr,host=tars,some=tag-352 n=0i 1476437629342569532 -ctr,host=tars,some=tag-353 n=0i 1476437629342569532 -ctr,host=tars,some=tag-354 n=0i 1476437629342569532 -ctr,host=tars,some=tag-355 n=0i 1476437629342569532 -ctr,host=tars,some=tag-356 n=0i 1476437629342569532 -ctr,host=tars,some=tag-357 n=0i 1476437629342523514 -ctr,host=tars,some=tag-358 n=0i 1476437629342569532 -ctr,host=tars,some=tag-359 n=0i 1476437629342569532 -ctr,host=tars,some=tag-360 n=0i 1476437629342569532 -ctr,host=tars,some=tag-361 n=0i 1476437629342569532 -ctr,host=tars,some=tag-362 n=0i 1476437629342569532 -ctr,host=tars,some=tag-363 n=0i 1476437629342569532 -ctr,host=tars,some=tag-364 n=0i 1476437629342569532 -ctr,host=tars,some=tag-365 n=0i 1476437629342569532 -ctr,host=tars,some=tag-366 n=0i 1476437629342569532 -ctr,host=tars,some=tag-367 n=0i 1476437629342569532 -ctr,host=tars,some=tag-368 n=0i 1476437629342523514 -ctr,host=tars,some=tag-369 n=0i 1476437629342569532 -ctr,host=tars,some=tag-370 n=0i 1476437629342569532 -ctr,host=tars,some=tag-371 n=0i 1476437629342569532 -ctr,host=tars,some=tag-372 n=0i 1476437629342523514 -ctr,host=tars,some=tag-373 n=0i 1476437629342523514 -ctr,host=tars,some=tag-374 n=0i 1476437629342569532 -ctr,host=tars,some=tag-375 n=0i 1476437629342569532 -ctr,host=tars,some=tag-376 n=0i 1476437629342523514 -ctr,host=tars,some=tag-377 n=0i 1476437629342523514 -ctr,host=tars,some=tag-378 n=0i 1476437629342523514 -ctr,host=tars,some=tag-379 n=0i 1476437629342523514 -ctr,host=tars,some=tag-380 n=0i 1476437629342523514 -ctr,host=tars,some=tag-381 n=0i 1476437629342523514 -ctr,host=tars,some=tag-382 n=0i 1476437629342523514 -ctr,host=tars,some=tag-383 n=0i 1476437629342523514 -ctr,host=tars,some=tag-384 n=0i 1476437629342569532 -ctr,host=tars,some=tag-385 n=0i 1476437629342569532 -ctr,host=tars,some=tag-386 n=0i 1476437629342569532 -ctr,host=tars,some=tag-387 n=0i 1476437629342569532 -ctr,host=tars,some=tag-388 n=0i 1476437629342569532 -ctr,host=tars,some=tag-389 n=0i 1476437629342569532 -ctr,host=tars,some=tag-390 n=0i 1476437629342569532 -ctr,host=tars,some=tag-391 n=0i 1476437629342569532 -ctr,host=tars,some=tag-392 n=0i 1476437629342569532 -ctr,host=tars,some=tag-393 n=0i 1476437629342569532 -ctr,host=tars,some=tag-394 n=0i 1476437629342569532 -ctr,host=tars,some=tag-395 n=0i 1476437629342523514 -ctr,host=tars,some=tag-396 n=0i 1476437629342523514 -ctr,host=tars,some=tag-397 n=0i 1476437629342523514 -ctr,host=tars,some=tag-398 n=0i 1476437629342523514 -ctr,host=tars,some=tag-399 n=0i 1476437629342523514 -ctr,host=tars,some=tag-400 n=0i 1476437629342523514 -ctr,host=tars,some=tag-401 n=0i 1476437629342523514 -ctr,host=tars,some=tag-402 n=0i 1476437629342569532 -ctr,host=tars,some=tag-403 n=0i 1476437629342569532 -ctr,host=tars,some=tag-404 n=0i 1476437629342523514 -ctr,host=tars,some=tag-405 n=0i 1476437629342569532 -ctr,host=tars,some=tag-406 n=0i 1476437629342523514 -ctr,host=tars,some=tag-407 n=0i 1476437629342523514 -ctr,host=tars,some=tag-408 n=0i 1476437629342569532 -ctr,host=tars,some=tag-409 n=0i 1476437629342569532 -ctr,host=tars,some=tag-410 n=0i 1476437629342523514 -ctr,host=tars,some=tag-411 n=0i 1476437629342523514 -ctr,host=tars,some=tag-412 n=0i 1476437629342569532 -ctr,host=tars,some=tag-413 n=0i 1476437629342523514 -ctr,host=tars,some=tag-414 n=0i 1476437629342523514 -ctr,host=tars,some=tag-415 n=0i 1476437629342523514 -ctr,host=tars,some=tag-416 n=0i 1476437629342569532 -ctr,host=tars,some=tag-417 n=0i 1476437629342569532 -ctr,host=tars,some=tag-418 n=0i 1476437629342569532 -ctr,host=tars,some=tag-419 n=0i 1476437629342523514 -ctr,host=tars,some=tag-420 n=0i 1476437629342523514 -ctr,host=tars,some=tag-421 n=0i 1476437629342569532 -ctr,host=tars,some=tag-422 n=0i 1476437629342569532 -ctr,host=tars,some=tag-423 n=0i 1476437629342523514 -ctr,host=tars,some=tag-424 n=0i 1476437629342523514 -ctr,host=tars,some=tag-425 n=0i 1476437629342523514 -ctr,host=tars,some=tag-426 n=1i 1476437629342569532 -ctr,host=tars,some=tag-427 n=1i 1476437629342569532 -ctr,host=tars,some=tag-428 n=1i 1476437629342569532 -ctr,host=tars,some=tag-429 n=1i 1476437629342569532 -ctr,host=tars,some=tag-430 n=1i 1476437629342569532 -ctr,host=tars,some=tag-431 n=1i 1476437629342569532 -ctr,host=tars,some=tag-432 n=1i 1476437629342569532 -ctr,host=tars,some=tag-433 n=1i 1476437629342569532 -ctr,host=tars,some=tag-434 n=1i 1476437629342569532 -ctr,host=tars,some=tag-435 n=1i 1476437629342569532 -ctr,host=tars,some=tag-436 n=0i 1476437629342569532 -ctr,host=tars,some=tag-437 n=0i 1476437629342569532 -ctr,host=tars,some=tag-438 n=0i 1476437629342523514 -ctr,host=tars,some=tag-439 n=0i 1476437629342569532 -ctr,host=tars,some=tag-440 n=0i 1476437629342569532 -ctr,host=tars,some=tag-441 n=0i 1476437629342523514 -ctr,host=tars,some=tag-442 n=0i 1476437629342569532 -ctr,host=tars,some=tag-443 n=0i 1476437629342569532 -ctr,host=tars,some=tag-444 n=0i 1476437629342523514 -ctr,host=tars,some=tag-445 n=0i 1476437629342569532 -ctr,host=tars,some=tag-446 n=0i 1476437629342523514 -ctr,host=tars,some=tag-447 n=0i 1476437629342569532 -ctr,host=tars,some=tag-448 n=0i 1476437629342523514 -ctr,host=tars,some=tag-449 n=0i 1476437629342523514 -ctr,host=tars,some=tag-450 n=0i 1476437629342523514 -ctr,host=tars,some=tag-451 n=0i 1476437629342523514 -ctr,host=tars,some=tag-452 n=0i 1476437629342523514 -ctr,host=tars,some=tag-453 n=0i 1476437629342569532 -ctr,host=tars,some=tag-454 n=0i 1476437629342569532 -ctr,host=tars,some=tag-455 n=0i 1476437629342569532 -ctr,host=tars,some=tag-456 n=0i 1476437629342569532 -ctr,host=tars,some=tag-457 n=0i 1476437629342569532 -ctr,host=tars,some=tag-458 n=0i 1476437629342569532 -ctr,host=tars,some=tag-459 n=0i 1476437629342569532 -ctr,host=tars,some=tag-460 n=0i 1476437629342569532 -ctr,host=tars,some=tag-461 n=0i 1476437629342523514 -ctr,host=tars,some=tag-462 n=0i 1476437629342569532 -ctr,host=tars,some=tag-463 n=0i 1476437629342569532 -ctr,host=tars,some=tag-464 n=0i 1476437629342523514 -ctr,host=tars,some=tag-465 n=0i 1476437629342523514 -ctr,host=tars,some=tag-466 n=0i 1476437629342569532 -ctr,host=tars,some=tag-467 n=0i 1476437629342569532 -ctr,host=tars,some=tag-468 n=0i 1476437629342569532 -ctr,host=tars,some=tag-469 n=2i 1476437629342569532 -ctr,host=tars,some=tag-470 n=2i 1476437629342569532 -ctr,host=tars,some=tag-471 n=2i 1476437629342569532 -ctr,host=tars,some=tag-472 n=2i 1476437629342569532 -ctr,host=tars,some=tag-473 n=2i 1476437629342569532 -ctr,host=tars,some=tag-474 n=2i 1476437629342569532 -ctr,host=tars,some=tag-475 n=2i 1476437629342569532 -ctr,host=tars,some=tag-476 n=2i 1476437629342569532 -ctr,host=tars,some=tag-477 n=2i 1476437629342569532 -ctr,host=tars,some=tag-478 n=2i 1476437629342569532 -ctr,host=tars,some=tag-479 n=2i 1476437629342569532 -ctr,host=tars,some=tag-480 n=2i 1476437629342569532 -ctr,host=tars,some=tag-481 n=2i 1476437629342569532 -ctr,host=tars,some=tag-482 n=2i 1476437629342569532 -ctr,host=tars,some=tag-483 n=2i 1476437629342569532 -ctr,host=tars,some=tag-484 n=2i 1476437629342569532 -ctr,host=tars,some=tag-485 n=2i 1476437629342569532 -ctr,host=tars,some=tag-486 n=2i 1476437629342569532 -ctr,host=tars,some=tag-487 n=2i 1476437629342569532 -ctr,host=tars,some=tag-488 n=1i 1476437629342569532 -ctr,host=tars,some=tag-489 n=1i 1476437629342569532 -ctr,host=tars,some=tag-490 n=2i 1476437629342569532 -ctr,host=tars,some=tag-491 n=2i 1476437629342569532 -ctr,host=tars,some=tag-492 n=2i 1476437629342569532 -ctr,host=tars,some=tag-493 n=2i 1476437629342569532 -ctr,host=tars,some=tag-494 n=2i 1476437629342569532 -ctr,host=tars,some=tag-495 n=2i 1476437629342569532 -ctr,host=tars,some=tag-496 n=2i 1476437629342569532 -ctr,host=tars,some=tag-497 n=2i 1476437629342569532 -ctr,host=tars,some=tag-498 n=1i 1476437629342569532 -ctr,host=tars,some=tag-499 n=1i 1476437629342569532 diff --git a/metric/inline_strconv_parse.go b/plugins/parsers/influx/escape.go similarity index 53% rename from metric/inline_strconv_parse.go rename to plugins/parsers/influx/escape.go index 7b77140fb..bf47fa8c5 100644 --- a/metric/inline_strconv_parse.go +++ b/plugins/parsers/influx/escape.go @@ -1,11 +1,62 @@ -package metric +package influx import ( + "bytes" "reflect" "strconv" + "strings" "unsafe" ) +const ( + escapes = " ,=" + nameEscapes = " ," + stringFieldEscapes = `\"` +) + +var ( + unescaper = strings.NewReplacer( + `\,`, `,`, + `\"`, `"`, // ??? + `\ `, ` `, + `\=`, `=`, + ) + + nameUnescaper = strings.NewReplacer( + `\,`, `,`, + `\ `, ` `, + ) + + stringFieldUnescaper = strings.NewReplacer( + `\"`, `"`, + `\\`, `\`, + ) +) + +func unescape(b []byte) string { + if bytes.ContainsAny(b, escapes) { + return unescaper.Replace(unsafeBytesToString(b)) + } else { + return string(b) + } +} + +func nameUnescape(b []byte) string { + if bytes.ContainsAny(b, nameEscapes) { + return nameUnescaper.Replace(unsafeBytesToString(b)) + } else { + return string(b) + } +} + +func stringFieldUnescape(b []byte) string { + if bytes.ContainsAny(b, stringFieldEscapes) { + return stringFieldUnescaper.Replace(unsafeBytesToString(b)) + } else { + return string(b) + } +} + // parseIntBytes is a zero-alloc wrapper around strconv.ParseInt. func parseIntBytes(b []byte, base int, bitSize int) (i int64, err error) { s := unsafeBytesToString(b) diff --git a/plugins/parsers/influx/handler.go b/plugins/parsers/influx/handler.go new file mode 100644 index 000000000..27d6f942d --- /dev/null +++ b/plugins/parsers/influx/handler.go @@ -0,0 +1,95 @@ +package influx + +import ( + "bytes" + "time" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/metric" + "github.com/prometheus/common/log" +) + +type MetricHandler struct { + builder *metric.Builder + metrics []telegraf.Metric + precision time.Duration +} + +func NewMetricHandler() *MetricHandler { + return &MetricHandler{ + builder: metric.NewBuilder(), + precision: time.Nanosecond, + } +} + +func (h *MetricHandler) SetTimeFunc(f metric.TimeFunc) { + h.builder.TimeFunc = f +} + +func (h *MetricHandler) SetPrecision(factor time.Duration) { + h.precision = factor +} + +func (h *MetricHandler) Metric() (telegraf.Metric, error) { + return h.builder.Metric() +} + +func (h *MetricHandler) SetMeasurement(name []byte) { + h.builder.SetName(nameUnescape(name)) +} + +func (h *MetricHandler) AddTag(key []byte, value []byte) { + tk := unescape(key) + tv := unescape(value) + h.builder.AddTag(tk, tv) +} + +func (h *MetricHandler) AddInt(key []byte, value []byte) { + fk := unescape(key) + fv, err := parseIntBytes(bytes.TrimSuffix(value, []byte("i")), 10, 64) + if err != nil { + log.Errorf("E! Received unparseable int value: %q", value) + return + } + h.builder.AddField(fk, fv) +} + +func (h *MetricHandler) AddFloat(key []byte, value []byte) { + fk := unescape(key) + fv, err := parseFloatBytes(value, 64) + if err != nil { + log.Errorf("E! Received unparseable float value: %q", value) + return + } + h.builder.AddField(fk, fv) +} + +func (h *MetricHandler) AddString(key []byte, value []byte) { + fk := unescape(key) + fv := stringFieldUnescape(value) + h.builder.AddField(fk, fv) +} + +func (h *MetricHandler) AddBool(key []byte, value []byte) { + fk := unescape(key) + fv, err := parseBoolBytes(value) + if err != nil { + log.Errorf("E! Received unparseable boolean value: %q", value) + return + } + h.builder.AddField(fk, fv) +} + +func (h *MetricHandler) SetTimestamp(tm []byte) { + v, err := parseIntBytes(tm, 10, 64) + if err != nil { + log.Errorf("E! Received unparseable timestamp: %q", tm) + return + } + ns := v * int64(h.precision) + h.builder.SetTime(time.Unix(0, ns)) +} + +func (h *MetricHandler) Reset() { + h.builder.Reset() +} diff --git a/plugins/parsers/influx/machine.go b/plugins/parsers/influx/machine.go new file mode 100644 index 000000000..958587135 --- /dev/null +++ b/plugins/parsers/influx/machine.go @@ -0,0 +1,21171 @@ + +//line plugins/parsers/influx/machine.go.rl:1 +package influx + +import ( + "errors" +) + +var ( + ErrNameParse = errors.New("expected measurement name") + ErrFieldParse = errors.New("expected field") + ErrTagParse = errors.New("expected tag") + ErrTimestampParse = errors.New("expected timestamp") + ErrParse = errors.New("parse error") +) + + +//line plugins/parsers/influx/machine.go.rl:214 + + + +//line plugins/parsers/influx/machine.go:23 +const LineProtocol_start int = 1 +const LineProtocol_first_final int = 191 +const LineProtocol_error int = 0 + +const LineProtocol_en_main int = 1 +const LineProtocol_en_discard_line int = 187 +const LineProtocol_en_align int = 188 + + +//line plugins/parsers/influx/machine.go.rl:217 + +type machine struct { + data []byte + cs int + p, pe, eof int + pb int + handler Handler + err error +} + +func NewMachine(handler Handler) *machine { + m := &machine{ + handler: handler, + } + + +//line plugins/parsers/influx/machine.go.rl:233 + +//line plugins/parsers/influx/machine.go.rl:234 + +//line plugins/parsers/influx/machine.go.rl:235 + +//line plugins/parsers/influx/machine.go.rl:236 + +//line plugins/parsers/influx/machine.go.rl:237 + +//line plugins/parsers/influx/machine.go:60 + { + m.cs = LineProtocol_start + } + +//line plugins/parsers/influx/machine.go.rl:238 + + return m +} + +func (m *machine) SetData(data []byte) { + m.data = data + m.p = 0 + m.pb = 0 + m.pe = len(data) + m.eof = len(data) + m.err = nil + + +//line plugins/parsers/influx/machine.go:79 + { + m.cs = LineProtocol_start + } + +//line plugins/parsers/influx/machine.go.rl:251 + m.cs = LineProtocol_en_align +} + +// ParseLine parses a line of input and returns true if more data can be +// parsed. +func (m *machine) ParseLine() bool { + if m.data == nil || m.p >= m.pe { + m.err = nil + return false + } + + m.err = nil + var key []byte + var yield bool + + +//line plugins/parsers/influx/machine.go:101 + { + if ( m.p) == ( m.pe) { + goto _test_eof + } + goto _resume + +_again: + switch m.cs { + case 1: + goto st1 + case 2: + goto st2 + case 3: + goto st3 + case 4: + goto st4 + case 0: + goto st0 + case 5: + goto st5 + case 6: + goto st6 + case 7: + goto st7 + case 191: + goto st191 + case 192: + goto st192 + case 193: + goto st193 + case 8: + goto st8 + case 194: + goto st194 + case 195: + goto st195 + case 196: + goto st196 + case 197: + goto st197 + case 198: + goto st198 + case 199: + goto st199 + case 200: + goto st200 + case 201: + goto st201 + case 202: + goto st202 + case 203: + goto st203 + case 204: + goto st204 + case 205: + goto st205 + case 206: + goto st206 + case 207: + goto st207 + case 208: + goto st208 + case 209: + goto st209 + case 210: + goto st210 + case 211: + goto st211 + case 212: + goto st212 + case 213: + goto st213 + case 9: + goto st9 + case 10: + goto st10 + case 11: + goto st11 + case 12: + goto st12 + case 214: + goto st214 + case 215: + goto st215 + case 13: + goto st13 + case 14: + goto st14 + case 216: + goto st216 + case 217: + goto st217 + case 218: + goto st218 + case 219: + goto st219 + case 15: + goto st15 + case 16: + goto st16 + case 17: + goto st17 + case 220: + goto st220 + case 18: + goto st18 + case 19: + goto st19 + case 20: + goto st20 + case 221: + goto st221 + case 21: + goto st21 + case 22: + goto st22 + case 222: + goto st222 + case 223: + goto st223 + case 23: + goto st23 + case 24: + goto st24 + case 25: + goto st25 + case 26: + goto st26 + case 27: + goto st27 + case 28: + goto st28 + case 29: + goto st29 + case 30: + goto st30 + case 31: + goto st31 + case 32: + goto st32 + case 33: + goto st33 + case 34: + goto st34 + case 35: + goto st35 + case 36: + goto st36 + case 37: + goto st37 + case 38: + goto st38 + case 39: + goto st39 + case 40: + goto st40 + case 41: + goto st41 + case 224: + goto st224 + case 225: + goto st225 + case 42: + goto st42 + case 226: + goto st226 + case 227: + goto st227 + case 228: + goto st228 + case 229: + goto st229 + case 230: + goto st230 + case 231: + goto st231 + case 232: + goto st232 + case 233: + goto st233 + case 234: + goto st234 + case 235: + goto st235 + case 236: + goto st236 + case 237: + goto st237 + case 238: + goto st238 + case 239: + goto st239 + case 240: + goto st240 + case 241: + goto st241 + case 242: + goto st242 + case 243: + goto st243 + case 244: + goto st244 + case 245: + goto st245 + case 43: + goto st43 + case 246: + goto st246 + case 247: + goto st247 + case 248: + goto st248 + case 44: + goto st44 + case 249: + goto st249 + case 250: + goto st250 + case 251: + goto st251 + case 252: + goto st252 + case 253: + goto st253 + case 254: + goto st254 + case 255: + goto st255 + case 256: + goto st256 + case 257: + goto st257 + case 258: + goto st258 + case 259: + goto st259 + case 260: + goto st260 + case 261: + goto st261 + case 262: + goto st262 + case 263: + goto st263 + case 264: + goto st264 + case 265: + goto st265 + case 266: + goto st266 + case 267: + goto st267 + case 268: + goto st268 + case 45: + goto st45 + case 46: + goto st46 + case 47: + goto st47 + case 269: + goto st269 + case 48: + goto st48 + case 49: + goto st49 + case 50: + goto st50 + case 51: + goto st51 + case 270: + goto st270 + case 271: + goto st271 + case 52: + goto st52 + case 272: + goto st272 + case 53: + goto st53 + case 273: + goto st273 + case 274: + goto st274 + case 275: + goto st275 + case 276: + goto st276 + case 54: + goto st54 + case 55: + goto st55 + case 56: + goto st56 + case 277: + goto st277 + case 57: + goto st57 + case 58: + goto st58 + case 59: + goto st59 + case 278: + goto st278 + case 60: + goto st60 + case 61: + goto st61 + case 279: + goto st279 + case 280: + goto st280 + case 62: + goto st62 + case 63: + goto st63 + case 281: + goto st281 + case 282: + goto st282 + case 64: + goto st64 + case 65: + goto st65 + case 283: + goto st283 + case 284: + goto st284 + case 285: + goto st285 + case 286: + goto st286 + case 66: + goto st66 + case 67: + goto st67 + case 68: + goto st68 + case 287: + goto st287 + case 69: + goto st69 + case 70: + goto st70 + case 71: + goto st71 + case 288: + goto st288 + case 72: + goto st72 + case 73: + goto st73 + case 289: + goto st289 + case 290: + goto st290 + case 74: + goto st74 + case 75: + goto st75 + case 76: + goto st76 + case 77: + goto st77 + case 78: + goto st78 + case 79: + goto st79 + case 291: + goto st291 + case 292: + goto st292 + case 293: + goto st293 + case 294: + goto st294 + case 80: + goto st80 + case 295: + goto st295 + case 296: + goto st296 + case 297: + goto st297 + case 298: + goto st298 + case 81: + goto st81 + case 299: + goto st299 + case 300: + goto st300 + case 301: + goto st301 + case 302: + goto st302 + case 303: + goto st303 + case 304: + goto st304 + case 305: + goto st305 + case 306: + goto st306 + case 307: + goto st307 + case 308: + goto st308 + case 309: + goto st309 + case 310: + goto st310 + case 311: + goto st311 + case 312: + goto st312 + case 313: + goto st313 + case 314: + goto st314 + case 315: + goto st315 + case 316: + goto st316 + case 82: + goto st82 + case 83: + goto st83 + case 84: + goto st84 + case 85: + goto st85 + case 86: + goto st86 + case 87: + goto st87 + case 88: + goto st88 + case 89: + goto st89 + case 90: + goto st90 + case 91: + goto st91 + case 92: + goto st92 + case 93: + goto st93 + case 94: + goto st94 + case 317: + goto st317 + case 318: + goto st318 + case 95: + goto st95 + case 319: + goto st319 + case 320: + goto st320 + case 321: + goto st321 + case 322: + goto st322 + case 323: + goto st323 + case 324: + goto st324 + case 325: + goto st325 + case 326: + goto st326 + case 327: + goto st327 + case 328: + goto st328 + case 329: + goto st329 + case 330: + goto st330 + case 331: + goto st331 + case 332: + goto st332 + case 333: + goto st333 + case 334: + goto st334 + case 335: + goto st335 + case 336: + goto st336 + case 337: + goto st337 + case 338: + goto st338 + case 96: + goto st96 + case 97: + goto st97 + case 339: + goto st339 + case 340: + goto st340 + case 98: + goto st98 + case 341: + goto st341 + case 342: + goto st342 + case 343: + goto st343 + case 344: + goto st344 + case 345: + goto st345 + case 346: + goto st346 + case 347: + goto st347 + case 348: + goto st348 + case 349: + goto st349 + case 350: + goto st350 + case 351: + goto st351 + case 352: + goto st352 + case 353: + goto st353 + case 354: + goto st354 + case 355: + goto st355 + case 356: + goto st356 + case 357: + goto st357 + case 358: + goto st358 + case 359: + goto st359 + case 360: + goto st360 + case 99: + goto st99 + case 361: + goto st361 + case 362: + goto st362 + case 100: + goto st100 + case 101: + goto st101 + case 102: + goto st102 + case 103: + goto st103 + case 363: + goto st363 + case 364: + goto st364 + case 104: + goto st104 + case 105: + goto st105 + case 365: + goto st365 + case 366: + goto st366 + case 367: + goto st367 + case 368: + goto st368 + case 106: + goto st106 + case 107: + goto st107 + case 108: + goto st108 + case 369: + goto st369 + case 109: + goto st109 + case 110: + goto st110 + case 111: + goto st111 + case 370: + goto st370 + case 112: + goto st112 + case 113: + goto st113 + case 371: + goto st371 + case 372: + goto st372 + case 114: + goto st114 + case 115: + goto st115 + case 116: + goto st116 + case 117: + goto st117 + case 118: + goto st118 + case 119: + goto st119 + case 120: + goto st120 + case 121: + goto st121 + case 122: + goto st122 + case 123: + goto st123 + case 124: + goto st124 + case 125: + goto st125 + case 373: + goto st373 + case 374: + goto st374 + case 375: + goto st375 + case 126: + goto st126 + case 376: + goto st376 + case 377: + goto st377 + case 378: + goto st378 + case 379: + goto st379 + case 380: + goto st380 + case 381: + goto st381 + case 382: + goto st382 + case 383: + goto st383 + case 384: + goto st384 + case 385: + goto st385 + case 386: + goto st386 + case 387: + goto st387 + case 388: + goto st388 + case 389: + goto st389 + case 390: + goto st390 + case 391: + goto st391 + case 392: + goto st392 + case 393: + goto st393 + case 394: + goto st394 + case 395: + goto st395 + case 396: + goto st396 + case 397: + goto st397 + case 127: + goto st127 + case 398: + goto st398 + case 399: + goto st399 + case 400: + goto st400 + case 401: + goto st401 + case 128: + goto st128 + case 402: + goto st402 + case 403: + goto st403 + case 404: + goto st404 + case 405: + goto st405 + case 406: + goto st406 + case 407: + goto st407 + case 408: + goto st408 + case 409: + goto st409 + case 410: + goto st410 + case 411: + goto st411 + case 412: + goto st412 + case 413: + goto st413 + case 414: + goto st414 + case 415: + goto st415 + case 416: + goto st416 + case 417: + goto st417 + case 418: + goto st418 + case 419: + goto st419 + case 420: + goto st420 + case 421: + goto st421 + case 129: + goto st129 + case 130: + goto st130 + case 131: + goto st131 + case 422: + goto st422 + case 423: + goto st423 + case 132: + goto st132 + case 424: + goto st424 + case 425: + goto st425 + case 426: + goto st426 + case 427: + goto st427 + case 428: + goto st428 + case 429: + goto st429 + case 430: + goto st430 + case 431: + goto st431 + case 432: + goto st432 + case 433: + goto st433 + case 434: + goto st434 + case 435: + goto st435 + case 436: + goto st436 + case 437: + goto st437 + case 438: + goto st438 + case 439: + goto st439 + case 440: + goto st440 + case 441: + goto st441 + case 442: + goto st442 + case 443: + goto st443 + case 133: + goto st133 + case 444: + goto st444 + case 445: + goto st445 + case 446: + goto st446 + case 134: + goto st134 + case 447: + goto st447 + case 448: + goto st448 + case 449: + goto st449 + case 450: + goto st450 + case 451: + goto st451 + case 452: + goto st452 + case 453: + goto st453 + case 454: + goto st454 + case 455: + goto st455 + case 456: + goto st456 + case 457: + goto st457 + case 458: + goto st458 + case 459: + goto st459 + case 460: + goto st460 + case 461: + goto st461 + case 462: + goto st462 + case 463: + goto st463 + case 464: + goto st464 + case 465: + goto st465 + case 466: + goto st466 + case 467: + goto st467 + case 468: + goto st468 + case 135: + goto st135 + case 469: + goto st469 + case 470: + goto st470 + case 471: + goto st471 + case 472: + goto st472 + case 473: + goto st473 + case 474: + goto st474 + case 475: + goto st475 + case 476: + goto st476 + case 477: + goto st477 + case 478: + goto st478 + case 479: + goto st479 + case 480: + goto st480 + case 481: + goto st481 + case 482: + goto st482 + case 483: + goto st483 + case 484: + goto st484 + case 485: + goto st485 + case 486: + goto st486 + case 487: + goto st487 + case 488: + goto st488 + case 489: + goto st489 + case 490: + goto st490 + case 136: + goto st136 + case 137: + goto st137 + case 138: + goto st138 + case 139: + goto st139 + case 491: + goto st491 + case 492: + goto st492 + case 140: + goto st140 + case 493: + goto st493 + case 141: + goto st141 + case 494: + goto st494 + case 495: + goto st495 + case 496: + goto st496 + case 497: + goto st497 + case 142: + goto st142 + case 143: + goto st143 + case 144: + goto st144 + case 498: + goto st498 + case 145: + goto st145 + case 146: + goto st146 + case 147: + goto st147 + case 499: + goto st499 + case 148: + goto st148 + case 149: + goto st149 + case 500: + goto st500 + case 501: + goto st501 + case 150: + goto st150 + case 151: + goto st151 + case 502: + goto st502 + case 503: + goto st503 + case 504: + goto st504 + case 152: + goto st152 + case 505: + goto st505 + case 506: + goto st506 + case 507: + goto st507 + case 508: + goto st508 + case 509: + goto st509 + case 510: + goto st510 + case 511: + goto st511 + case 512: + goto st512 + case 513: + goto st513 + case 514: + goto st514 + case 515: + goto st515 + case 516: + goto st516 + case 517: + goto st517 + case 518: + goto st518 + case 519: + goto st519 + case 520: + goto st520 + case 521: + goto st521 + case 522: + goto st522 + case 523: + goto st523 + case 524: + goto st524 + case 525: + goto st525 + case 153: + goto st153 + case 154: + goto st154 + case 526: + goto st526 + case 527: + goto st527 + case 528: + goto st528 + case 529: + goto st529 + case 155: + goto st155 + case 156: + goto st156 + case 157: + goto st157 + case 530: + goto st530 + case 158: + goto st158 + case 159: + goto st159 + case 160: + goto st160 + case 531: + goto st531 + case 161: + goto st161 + case 162: + goto st162 + case 532: + goto st532 + case 533: + goto st533 + case 163: + goto st163 + case 164: + goto st164 + case 165: + goto st165 + case 534: + goto st534 + case 535: + goto st535 + case 166: + goto st166 + case 536: + goto st536 + case 537: + goto st537 + case 167: + goto st167 + case 538: + goto st538 + case 539: + goto st539 + case 540: + goto st540 + case 541: + goto st541 + case 168: + goto st168 + case 169: + goto st169 + case 170: + goto st170 + case 542: + goto st542 + case 171: + goto st171 + case 172: + goto st172 + case 173: + goto st173 + case 543: + goto st543 + case 174: + goto st174 + case 175: + goto st175 + case 544: + goto st544 + case 545: + goto st545 + case 176: + goto st176 + case 546: + goto st546 + case 547: + goto st547 + case 177: + goto st177 + case 178: + goto st178 + case 548: + goto st548 + case 549: + goto st549 + case 550: + goto st550 + case 179: + goto st179 + case 180: + goto st180 + case 181: + goto st181 + case 551: + goto st551 + case 182: + goto st182 + case 183: + goto st183 + case 184: + goto st184 + case 552: + goto st552 + case 185: + goto st185 + case 186: + goto st186 + case 553: + goto st553 + case 554: + goto st554 + case 187: + goto st187 + case 555: + goto st555 + case 188: + goto st188 + case 556: + goto st556 + case 557: + goto st557 + case 189: + goto st189 + case 190: + goto st190 + } + + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof + } +_resume: + switch m.cs { + case 1: + goto st_case_1 + case 2: + goto st_case_2 + case 3: + goto st_case_3 + case 4: + goto st_case_4 + case 0: + goto st_case_0 + case 5: + goto st_case_5 + case 6: + goto st_case_6 + case 7: + goto st_case_7 + case 191: + goto st_case_191 + case 192: + goto st_case_192 + case 193: + goto st_case_193 + case 8: + goto st_case_8 + case 194: + goto st_case_194 + case 195: + goto st_case_195 + case 196: + goto st_case_196 + case 197: + goto st_case_197 + case 198: + goto st_case_198 + case 199: + goto st_case_199 + case 200: + goto st_case_200 + case 201: + goto st_case_201 + case 202: + goto st_case_202 + case 203: + goto st_case_203 + case 204: + goto st_case_204 + case 205: + goto st_case_205 + case 206: + goto st_case_206 + case 207: + goto st_case_207 + case 208: + goto st_case_208 + case 209: + goto st_case_209 + case 210: + goto st_case_210 + case 211: + goto st_case_211 + case 212: + goto st_case_212 + case 213: + goto st_case_213 + case 9: + goto st_case_9 + case 10: + goto st_case_10 + case 11: + goto st_case_11 + case 12: + goto st_case_12 + case 214: + goto st_case_214 + case 215: + goto st_case_215 + case 13: + goto st_case_13 + case 14: + goto st_case_14 + case 216: + goto st_case_216 + case 217: + goto st_case_217 + case 218: + goto st_case_218 + case 219: + goto st_case_219 + case 15: + goto st_case_15 + case 16: + goto st_case_16 + case 17: + goto st_case_17 + case 220: + goto st_case_220 + case 18: + goto st_case_18 + case 19: + goto st_case_19 + case 20: + goto st_case_20 + case 221: + goto st_case_221 + case 21: + goto st_case_21 + case 22: + goto st_case_22 + case 222: + goto st_case_222 + case 223: + goto st_case_223 + case 23: + goto st_case_23 + case 24: + goto st_case_24 + case 25: + goto st_case_25 + case 26: + goto st_case_26 + case 27: + goto st_case_27 + case 28: + goto st_case_28 + case 29: + goto st_case_29 + case 30: + goto st_case_30 + case 31: + goto st_case_31 + case 32: + goto st_case_32 + case 33: + goto st_case_33 + case 34: + goto st_case_34 + case 35: + goto st_case_35 + case 36: + goto st_case_36 + case 37: + goto st_case_37 + case 38: + goto st_case_38 + case 39: + goto st_case_39 + case 40: + goto st_case_40 + case 41: + goto st_case_41 + case 224: + goto st_case_224 + case 225: + goto st_case_225 + case 42: + goto st_case_42 + case 226: + goto st_case_226 + case 227: + goto st_case_227 + case 228: + goto st_case_228 + case 229: + goto st_case_229 + case 230: + goto st_case_230 + case 231: + goto st_case_231 + case 232: + goto st_case_232 + case 233: + goto st_case_233 + case 234: + goto st_case_234 + case 235: + goto st_case_235 + case 236: + goto st_case_236 + case 237: + goto st_case_237 + case 238: + goto st_case_238 + case 239: + goto st_case_239 + case 240: + goto st_case_240 + case 241: + goto st_case_241 + case 242: + goto st_case_242 + case 243: + goto st_case_243 + case 244: + goto st_case_244 + case 245: + goto st_case_245 + case 43: + goto st_case_43 + case 246: + goto st_case_246 + case 247: + goto st_case_247 + case 248: + goto st_case_248 + case 44: + goto st_case_44 + case 249: + goto st_case_249 + case 250: + goto st_case_250 + case 251: + goto st_case_251 + case 252: + goto st_case_252 + case 253: + goto st_case_253 + case 254: + goto st_case_254 + case 255: + goto st_case_255 + case 256: + goto st_case_256 + case 257: + goto st_case_257 + case 258: + goto st_case_258 + case 259: + goto st_case_259 + case 260: + goto st_case_260 + case 261: + goto st_case_261 + case 262: + goto st_case_262 + case 263: + goto st_case_263 + case 264: + goto st_case_264 + case 265: + goto st_case_265 + case 266: + goto st_case_266 + case 267: + goto st_case_267 + case 268: + goto st_case_268 + case 45: + goto st_case_45 + case 46: + goto st_case_46 + case 47: + goto st_case_47 + case 269: + goto st_case_269 + case 48: + goto st_case_48 + case 49: + goto st_case_49 + case 50: + goto st_case_50 + case 51: + goto st_case_51 + case 270: + goto st_case_270 + case 271: + goto st_case_271 + case 52: + goto st_case_52 + case 272: + goto st_case_272 + case 53: + goto st_case_53 + case 273: + goto st_case_273 + case 274: + goto st_case_274 + case 275: + goto st_case_275 + case 276: + goto st_case_276 + case 54: + goto st_case_54 + case 55: + goto st_case_55 + case 56: + goto st_case_56 + case 277: + goto st_case_277 + case 57: + goto st_case_57 + case 58: + goto st_case_58 + case 59: + goto st_case_59 + case 278: + goto st_case_278 + case 60: + goto st_case_60 + case 61: + goto st_case_61 + case 279: + goto st_case_279 + case 280: + goto st_case_280 + case 62: + goto st_case_62 + case 63: + goto st_case_63 + case 281: + goto st_case_281 + case 282: + goto st_case_282 + case 64: + goto st_case_64 + case 65: + goto st_case_65 + case 283: + goto st_case_283 + case 284: + goto st_case_284 + case 285: + goto st_case_285 + case 286: + goto st_case_286 + case 66: + goto st_case_66 + case 67: + goto st_case_67 + case 68: + goto st_case_68 + case 287: + goto st_case_287 + case 69: + goto st_case_69 + case 70: + goto st_case_70 + case 71: + goto st_case_71 + case 288: + goto st_case_288 + case 72: + goto st_case_72 + case 73: + goto st_case_73 + case 289: + goto st_case_289 + case 290: + goto st_case_290 + case 74: + goto st_case_74 + case 75: + goto st_case_75 + case 76: + goto st_case_76 + case 77: + goto st_case_77 + case 78: + goto st_case_78 + case 79: + goto st_case_79 + case 291: + goto st_case_291 + case 292: + goto st_case_292 + case 293: + goto st_case_293 + case 294: + goto st_case_294 + case 80: + goto st_case_80 + case 295: + goto st_case_295 + case 296: + goto st_case_296 + case 297: + goto st_case_297 + case 298: + goto st_case_298 + case 81: + goto st_case_81 + case 299: + goto st_case_299 + case 300: + goto st_case_300 + case 301: + goto st_case_301 + case 302: + goto st_case_302 + case 303: + goto st_case_303 + case 304: + goto st_case_304 + case 305: + goto st_case_305 + case 306: + goto st_case_306 + case 307: + goto st_case_307 + case 308: + goto st_case_308 + case 309: + goto st_case_309 + case 310: + goto st_case_310 + case 311: + goto st_case_311 + case 312: + goto st_case_312 + case 313: + goto st_case_313 + case 314: + goto st_case_314 + case 315: + goto st_case_315 + case 316: + goto st_case_316 + case 82: + goto st_case_82 + case 83: + goto st_case_83 + case 84: + goto st_case_84 + case 85: + goto st_case_85 + case 86: + goto st_case_86 + case 87: + goto st_case_87 + case 88: + goto st_case_88 + case 89: + goto st_case_89 + case 90: + goto st_case_90 + case 91: + goto st_case_91 + case 92: + goto st_case_92 + case 93: + goto st_case_93 + case 94: + goto st_case_94 + case 317: + goto st_case_317 + case 318: + goto st_case_318 + case 95: + goto st_case_95 + case 319: + goto st_case_319 + case 320: + goto st_case_320 + case 321: + goto st_case_321 + case 322: + goto st_case_322 + case 323: + goto st_case_323 + case 324: + goto st_case_324 + case 325: + goto st_case_325 + case 326: + goto st_case_326 + case 327: + goto st_case_327 + case 328: + goto st_case_328 + case 329: + goto st_case_329 + case 330: + goto st_case_330 + case 331: + goto st_case_331 + case 332: + goto st_case_332 + case 333: + goto st_case_333 + case 334: + goto st_case_334 + case 335: + goto st_case_335 + case 336: + goto st_case_336 + case 337: + goto st_case_337 + case 338: + goto st_case_338 + case 96: + goto st_case_96 + case 97: + goto st_case_97 + case 339: + goto st_case_339 + case 340: + goto st_case_340 + case 98: + goto st_case_98 + case 341: + goto st_case_341 + case 342: + goto st_case_342 + case 343: + goto st_case_343 + case 344: + goto st_case_344 + case 345: + goto st_case_345 + case 346: + goto st_case_346 + case 347: + goto st_case_347 + case 348: + goto st_case_348 + case 349: + goto st_case_349 + case 350: + goto st_case_350 + case 351: + goto st_case_351 + case 352: + goto st_case_352 + case 353: + goto st_case_353 + case 354: + goto st_case_354 + case 355: + goto st_case_355 + case 356: + goto st_case_356 + case 357: + goto st_case_357 + case 358: + goto st_case_358 + case 359: + goto st_case_359 + case 360: + goto st_case_360 + case 99: + goto st_case_99 + case 361: + goto st_case_361 + case 362: + goto st_case_362 + case 100: + goto st_case_100 + case 101: + goto st_case_101 + case 102: + goto st_case_102 + case 103: + goto st_case_103 + case 363: + goto st_case_363 + case 364: + goto st_case_364 + case 104: + goto st_case_104 + case 105: + goto st_case_105 + case 365: + goto st_case_365 + case 366: + goto st_case_366 + case 367: + goto st_case_367 + case 368: + goto st_case_368 + case 106: + goto st_case_106 + case 107: + goto st_case_107 + case 108: + goto st_case_108 + case 369: + goto st_case_369 + case 109: + goto st_case_109 + case 110: + goto st_case_110 + case 111: + goto st_case_111 + case 370: + goto st_case_370 + case 112: + goto st_case_112 + case 113: + goto st_case_113 + case 371: + goto st_case_371 + case 372: + goto st_case_372 + case 114: + goto st_case_114 + case 115: + goto st_case_115 + case 116: + goto st_case_116 + case 117: + goto st_case_117 + case 118: + goto st_case_118 + case 119: + goto st_case_119 + case 120: + goto st_case_120 + case 121: + goto st_case_121 + case 122: + goto st_case_122 + case 123: + goto st_case_123 + case 124: + goto st_case_124 + case 125: + goto st_case_125 + case 373: + goto st_case_373 + case 374: + goto st_case_374 + case 375: + goto st_case_375 + case 126: + goto st_case_126 + case 376: + goto st_case_376 + case 377: + goto st_case_377 + case 378: + goto st_case_378 + case 379: + goto st_case_379 + case 380: + goto st_case_380 + case 381: + goto st_case_381 + case 382: + goto st_case_382 + case 383: + goto st_case_383 + case 384: + goto st_case_384 + case 385: + goto st_case_385 + case 386: + goto st_case_386 + case 387: + goto st_case_387 + case 388: + goto st_case_388 + case 389: + goto st_case_389 + case 390: + goto st_case_390 + case 391: + goto st_case_391 + case 392: + goto st_case_392 + case 393: + goto st_case_393 + case 394: + goto st_case_394 + case 395: + goto st_case_395 + case 396: + goto st_case_396 + case 397: + goto st_case_397 + case 127: + goto st_case_127 + case 398: + goto st_case_398 + case 399: + goto st_case_399 + case 400: + goto st_case_400 + case 401: + goto st_case_401 + case 128: + goto st_case_128 + case 402: + goto st_case_402 + case 403: + goto st_case_403 + case 404: + goto st_case_404 + case 405: + goto st_case_405 + case 406: + goto st_case_406 + case 407: + goto st_case_407 + case 408: + goto st_case_408 + case 409: + goto st_case_409 + case 410: + goto st_case_410 + case 411: + goto st_case_411 + case 412: + goto st_case_412 + case 413: + goto st_case_413 + case 414: + goto st_case_414 + case 415: + goto st_case_415 + case 416: + goto st_case_416 + case 417: + goto st_case_417 + case 418: + goto st_case_418 + case 419: + goto st_case_419 + case 420: + goto st_case_420 + case 421: + goto st_case_421 + case 129: + goto st_case_129 + case 130: + goto st_case_130 + case 131: + goto st_case_131 + case 422: + goto st_case_422 + case 423: + goto st_case_423 + case 132: + goto st_case_132 + case 424: + goto st_case_424 + case 425: + goto st_case_425 + case 426: + goto st_case_426 + case 427: + goto st_case_427 + case 428: + goto st_case_428 + case 429: + goto st_case_429 + case 430: + goto st_case_430 + case 431: + goto st_case_431 + case 432: + goto st_case_432 + case 433: + goto st_case_433 + case 434: + goto st_case_434 + case 435: + goto st_case_435 + case 436: + goto st_case_436 + case 437: + goto st_case_437 + case 438: + goto st_case_438 + case 439: + goto st_case_439 + case 440: + goto st_case_440 + case 441: + goto st_case_441 + case 442: + goto st_case_442 + case 443: + goto st_case_443 + case 133: + goto st_case_133 + case 444: + goto st_case_444 + case 445: + goto st_case_445 + case 446: + goto st_case_446 + case 134: + goto st_case_134 + case 447: + goto st_case_447 + case 448: + goto st_case_448 + case 449: + goto st_case_449 + case 450: + goto st_case_450 + case 451: + goto st_case_451 + case 452: + goto st_case_452 + case 453: + goto st_case_453 + case 454: + goto st_case_454 + case 455: + goto st_case_455 + case 456: + goto st_case_456 + case 457: + goto st_case_457 + case 458: + goto st_case_458 + case 459: + goto st_case_459 + case 460: + goto st_case_460 + case 461: + goto st_case_461 + case 462: + goto st_case_462 + case 463: + goto st_case_463 + case 464: + goto st_case_464 + case 465: + goto st_case_465 + case 466: + goto st_case_466 + case 467: + goto st_case_467 + case 468: + goto st_case_468 + case 135: + goto st_case_135 + case 469: + goto st_case_469 + case 470: + goto st_case_470 + case 471: + goto st_case_471 + case 472: + goto st_case_472 + case 473: + goto st_case_473 + case 474: + goto st_case_474 + case 475: + goto st_case_475 + case 476: + goto st_case_476 + case 477: + goto st_case_477 + case 478: + goto st_case_478 + case 479: + goto st_case_479 + case 480: + goto st_case_480 + case 481: + goto st_case_481 + case 482: + goto st_case_482 + case 483: + goto st_case_483 + case 484: + goto st_case_484 + case 485: + goto st_case_485 + case 486: + goto st_case_486 + case 487: + goto st_case_487 + case 488: + goto st_case_488 + case 489: + goto st_case_489 + case 490: + goto st_case_490 + case 136: + goto st_case_136 + case 137: + goto st_case_137 + case 138: + goto st_case_138 + case 139: + goto st_case_139 + case 491: + goto st_case_491 + case 492: + goto st_case_492 + case 140: + goto st_case_140 + case 493: + goto st_case_493 + case 141: + goto st_case_141 + case 494: + goto st_case_494 + case 495: + goto st_case_495 + case 496: + goto st_case_496 + case 497: + goto st_case_497 + case 142: + goto st_case_142 + case 143: + goto st_case_143 + case 144: + goto st_case_144 + case 498: + goto st_case_498 + case 145: + goto st_case_145 + case 146: + goto st_case_146 + case 147: + goto st_case_147 + case 499: + goto st_case_499 + case 148: + goto st_case_148 + case 149: + goto st_case_149 + case 500: + goto st_case_500 + case 501: + goto st_case_501 + case 150: + goto st_case_150 + case 151: + goto st_case_151 + case 502: + goto st_case_502 + case 503: + goto st_case_503 + case 504: + goto st_case_504 + case 152: + goto st_case_152 + case 505: + goto st_case_505 + case 506: + goto st_case_506 + case 507: + goto st_case_507 + case 508: + goto st_case_508 + case 509: + goto st_case_509 + case 510: + goto st_case_510 + case 511: + goto st_case_511 + case 512: + goto st_case_512 + case 513: + goto st_case_513 + case 514: + goto st_case_514 + case 515: + goto st_case_515 + case 516: + goto st_case_516 + case 517: + goto st_case_517 + case 518: + goto st_case_518 + case 519: + goto st_case_519 + case 520: + goto st_case_520 + case 521: + goto st_case_521 + case 522: + goto st_case_522 + case 523: + goto st_case_523 + case 524: + goto st_case_524 + case 525: + goto st_case_525 + case 153: + goto st_case_153 + case 154: + goto st_case_154 + case 526: + goto st_case_526 + case 527: + goto st_case_527 + case 528: + goto st_case_528 + case 529: + goto st_case_529 + case 155: + goto st_case_155 + case 156: + goto st_case_156 + case 157: + goto st_case_157 + case 530: + goto st_case_530 + case 158: + goto st_case_158 + case 159: + goto st_case_159 + case 160: + goto st_case_160 + case 531: + goto st_case_531 + case 161: + goto st_case_161 + case 162: + goto st_case_162 + case 532: + goto st_case_532 + case 533: + goto st_case_533 + case 163: + goto st_case_163 + case 164: + goto st_case_164 + case 165: + goto st_case_165 + case 534: + goto st_case_534 + case 535: + goto st_case_535 + case 166: + goto st_case_166 + case 536: + goto st_case_536 + case 537: + goto st_case_537 + case 167: + goto st_case_167 + case 538: + goto st_case_538 + case 539: + goto st_case_539 + case 540: + goto st_case_540 + case 541: + goto st_case_541 + case 168: + goto st_case_168 + case 169: + goto st_case_169 + case 170: + goto st_case_170 + case 542: + goto st_case_542 + case 171: + goto st_case_171 + case 172: + goto st_case_172 + case 173: + goto st_case_173 + case 543: + goto st_case_543 + case 174: + goto st_case_174 + case 175: + goto st_case_175 + case 544: + goto st_case_544 + case 545: + goto st_case_545 + case 176: + goto st_case_176 + case 546: + goto st_case_546 + case 547: + goto st_case_547 + case 177: + goto st_case_177 + case 178: + goto st_case_178 + case 548: + goto st_case_548 + case 549: + goto st_case_549 + case 550: + goto st_case_550 + case 179: + goto st_case_179 + case 180: + goto st_case_180 + case 181: + goto st_case_181 + case 551: + goto st_case_551 + case 182: + goto st_case_182 + case 183: + goto st_case_183 + case 184: + goto st_case_184 + case 552: + goto st_case_552 + case 185: + goto st_case_185 + case 186: + goto st_case_186 + case 553: + goto st_case_553 + case 554: + goto st_case_554 + case 187: + goto st_case_187 + case 555: + goto st_case_555 + case 188: + goto st_case_188 + case 556: + goto st_case_556 + case 557: + goto st_case_557 + case 189: + goto st_case_189 + case 190: + goto st_case_190 + } + goto st_out + st1: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof1 + } + st_case_1: + switch ( m.data)[( m.p)] { + case 32: + goto tr1 + case 35: + goto tr1 + case 44: + goto tr1 + case 92: + goto tr2 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr1 + } + case ( m.data)[( m.p)] >= 9: + goto tr1 + } + goto tr0 +tr0: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st2 + st2: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof2 + } + st_case_2: +//line plugins/parsers/influx/machine.go:2386 + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 92: + goto st129 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 +tr4: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st3 +tr58: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st3 + st3: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof3 + } + st_case_3: +//line plugins/parsers/influx/machine.go:2422 + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr11 + case 13: + goto tr5 + case 32: + goto st3 + case 44: + goto tr5 + case 61: + goto tr5 + case 92: + goto tr12 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st3 + } + goto tr9 +tr9: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st4 + st4: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof4 + } + st_case_4: +//line plugins/parsers/influx/machine.go:2454 + switch ( m.data)[( m.p)] { + case 32: + goto tr5 + case 44: + goto tr5 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st4 +tr1: + m.cs = 0 +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + + goto _again +tr5: + m.cs = 0 +//line plugins/parsers/influx/machine.go.rl:35 + + m.err = ErrFieldParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + + goto _again +tr31: + m.cs = 0 +//line plugins/parsers/influx/machine.go.rl:49 + + m.err = ErrTimestampParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + + goto _again +tr50: + m.cs = 0 +//line plugins/parsers/influx/machine.go.rl:42 + + m.err = ErrTagParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + + goto _again +tr59: + m.cs = 0 +//line plugins/parsers/influx/machine.go.rl:42 + + m.err = ErrTagParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:35 + + m.err = ErrFieldParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + + goto _again +tr99: + m.cs = 0 +//line plugins/parsers/influx/machine.go.rl:35 + + m.err = ErrFieldParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:49 + + m.err = ErrTimestampParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + + goto _again +tr201: + m.cs = 0 +//line plugins/parsers/influx/machine.go.rl:42 + + m.err = ErrTagParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:35 + + m.err = ErrFieldParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:49 + + m.err = ErrTimestampParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + + goto _again +tr210: + m.cs = 0 +//line plugins/parsers/influx/machine.go.rl:42 + + m.err = ErrTagParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:49 + + m.err = ErrTimestampParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; goto _out } + + goto _again +//line plugins/parsers/influx/machine.go:2658 +st_case_0: + st0: + m.cs = 0 + goto _out +tr14: +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st5 + st5: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof5 + } + st_case_5: +//line plugins/parsers/influx/machine.go:2674 + switch ( m.data)[( m.p)] { + case 34: + goto st6 + case 45: + goto tr17 + case 46: + goto tr18 + case 48: + goto tr19 + case 70: + goto tr21 + case 84: + goto tr22 + case 102: + goto tr23 + case 116: + goto tr24 + } + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr20 + } + goto tr5 + st6: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof6 + } + st_case_6: + switch ( m.data)[( m.p)] { + case 34: + goto tr26 + case 92: + goto tr27 + } + goto tr25 +tr25: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st7 + st7: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof7 + } + st_case_7: +//line plugins/parsers/influx/machine.go:2720 + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + } + goto st7 +tr26: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st191 +tr29: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st191 + st191: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof191 + } + st_case_191: +//line plugins/parsers/influx/machine.go:2749 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 13: + goto tr330 + case 32: + goto st192 + case 44: + goto st9 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st192 + } + goto tr99 +tr355: +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st192 +tr361: +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st192 +tr364: +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st192 + st192: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof192 + } + st_case_192: +//line plugins/parsers/influx/machine.go:2787 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 13: + goto tr330 + case 32: + goto st192 + case 45: + goto tr332 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr333 + } + case ( m.data)[( m.p)] >= 9: + goto st192 + } + goto tr31 +tr330: + m.cs = 193 +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr335: + m.cs = 193 +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr356: + m.cs = 193 +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr362: + m.cs = 193 +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr365: + m.cs = 193 +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again + st193: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof193 + } + st_case_193: +//line plugins/parsers/influx/machine.go:2873 + goto tr1 +tr332: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st8 + st8: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof8 + } + st_case_8: +//line plugins/parsers/influx/machine.go:2886 + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st194 + } + goto tr31 +tr333: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st194 + st194: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof194 + } + st_case_194: +//line plugins/parsers/influx/machine.go:2902 + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st196 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 +tr334: +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st195 + st195: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof195 + } + st_case_195: +//line plugins/parsers/influx/machine.go:2931 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 13: + goto tr330 + case 32: + goto st195 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st195 + } + goto tr1 + st196: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof196 + } + st_case_196: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st197 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st197: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof197 + } + st_case_197: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st198 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st198: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof198 + } + st_case_198: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st199 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st199: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof199 + } + st_case_199: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st200 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st200: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof200 + } + st_case_200: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st201 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st201: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof201 + } + st_case_201: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st202 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st202: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof202 + } + st_case_202: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st203 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st203: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof203 + } + st_case_203: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st204 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st204: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof204 + } + st_case_204: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st205 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st205: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof205 + } + st_case_205: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st206 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st206: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof206 + } + st_case_206: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st207 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st207: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof207 + } + st_case_207: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st208 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st208: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof208 + } + st_case_208: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st209 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st209: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof209 + } + st_case_209: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st210 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st210: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof210 + } + st_case_210: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st211 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st211: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof211 + } + st_case_211: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st212 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st212: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof212 + } + st_case_212: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st213 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto tr31 + st213: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof213 + } + st_case_213: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 13: + goto tr335 + case 32: + goto tr334 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr334 + } + goto tr31 +tr357: +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st9 +tr363: +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st9 +tr366: +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st9 + st9: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof9 + } + st_case_9: +//line plugins/parsers/influx/machine.go:3358 + switch ( m.data)[( m.p)] { + case 32: + goto tr5 + case 44: + goto tr5 + case 61: + goto tr5 + case 92: + goto tr12 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto tr9 +tr12: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st10 + st10: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof10 + } + st_case_10: +//line plugins/parsers/influx/machine.go:3389 + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st4 +tr27: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st11 + st11: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof11 + } + st_case_11: +//line plugins/parsers/influx/machine.go:3410 + switch ( m.data)[( m.p)] { + case 34: + goto st7 + case 92: + goto st7 + } + goto tr5 +tr17: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st12 + st12: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof12 + } + st_case_12: +//line plugins/parsers/influx/machine.go:3429 + if ( m.data)[( m.p)] == 48 { + goto st214 + } + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st218 + } + goto tr5 +tr19: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st214 + st214: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof214 + } + st_case_214: +//line plugins/parsers/influx/machine.go:3448 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 13: + goto tr356 + case 32: + goto tr355 + case 44: + goto tr357 + case 46: + goto st215 + case 69: + goto st13 + case 101: + goto st13 + case 105: + goto st217 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr355 + } + goto tr99 +tr18: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st215 + st215: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof215 + } + st_case_215: +//line plugins/parsers/influx/machine.go:3482 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 13: + goto tr356 + case 32: + goto tr355 + case 44: + goto tr357 + case 69: + goto st13 + case 101: + goto st13 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st215 + } + case ( m.data)[( m.p)] >= 9: + goto tr355 + } + goto tr99 + st13: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof13 + } + st_case_13: + switch ( m.data)[( m.p)] { + case 34: + goto st14 + case 43: + goto st14 + case 45: + goto st14 + } + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st216 + } + goto tr5 + st14: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof14 + } + st_case_14: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st216 + } + goto tr5 + st216: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof216 + } + st_case_216: + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 13: + goto tr356 + case 32: + goto tr355 + case 44: + goto tr357 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st216 + } + case ( m.data)[( m.p)] >= 9: + goto tr355 + } + goto tr99 + st217: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof217 + } + st_case_217: + switch ( m.data)[( m.p)] { + case 10: + goto tr362 + case 13: + goto tr362 + case 32: + goto tr361 + case 44: + goto tr363 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr361 + } + goto tr99 +tr20: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st218 + st218: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof218 + } + st_case_218: +//line plugins/parsers/influx/machine.go:3586 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 13: + goto tr356 + case 32: + goto tr355 + case 44: + goto tr357 + case 46: + goto st215 + case 69: + goto st13 + case 101: + goto st13 + case 105: + goto st217 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st218 + } + case ( m.data)[( m.p)] >= 9: + goto tr355 + } + goto tr99 +tr21: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st219 + st219: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof219 + } + st_case_219: +//line plugins/parsers/influx/machine.go:3625 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 13: + goto tr365 + case 32: + goto tr364 + case 44: + goto tr366 + case 65: + goto st15 + case 97: + goto st18 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr364 + } + goto tr99 + st15: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof15 + } + st_case_15: + if ( m.data)[( m.p)] == 76 { + goto st16 + } + goto tr5 + st16: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof16 + } + st_case_16: + if ( m.data)[( m.p)] == 83 { + goto st17 + } + goto tr5 + st17: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof17 + } + st_case_17: + if ( m.data)[( m.p)] == 69 { + goto st220 + } + goto tr5 + st220: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof220 + } + st_case_220: + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 13: + goto tr365 + case 32: + goto tr364 + case 44: + goto tr366 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr364 + } + goto tr99 + st18: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof18 + } + st_case_18: + if ( m.data)[( m.p)] == 108 { + goto st19 + } + goto tr5 + st19: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof19 + } + st_case_19: + if ( m.data)[( m.p)] == 115 { + goto st20 + } + goto tr5 + st20: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof20 + } + st_case_20: + if ( m.data)[( m.p)] == 101 { + goto st220 + } + goto tr5 +tr22: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st221 + st221: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof221 + } + st_case_221: +//line plugins/parsers/influx/machine.go:3728 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 13: + goto tr365 + case 32: + goto tr364 + case 44: + goto tr366 + case 82: + goto st21 + case 114: + goto st22 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr364 + } + goto tr99 + st21: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof21 + } + st_case_21: + if ( m.data)[( m.p)] == 85 { + goto st17 + } + goto tr5 + st22: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof22 + } + st_case_22: + if ( m.data)[( m.p)] == 117 { + goto st20 + } + goto tr5 +tr23: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st222 + st222: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof222 + } + st_case_222: +//line plugins/parsers/influx/machine.go:3776 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 13: + goto tr365 + case 32: + goto tr364 + case 44: + goto tr366 + case 97: + goto st18 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr364 + } + goto tr99 +tr24: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st223 + st223: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof223 + } + st_case_223: +//line plugins/parsers/influx/machine.go:3804 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 13: + goto tr365 + case 32: + goto tr364 + case 44: + goto tr366 + case 114: + goto st22 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr364 + } + goto tr99 +tr11: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st23 + st23: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof23 + } + st_case_23: +//line plugins/parsers/influx/machine.go:3832 + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr11 + case 13: + goto tr5 + case 32: + goto st3 + case 44: + goto tr5 + case 61: + goto tr14 + case 92: + goto tr12 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st3 + } + goto tr9 +tr6: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st24 + st24: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof24 + } + st_case_24: +//line plugins/parsers/influx/machine.go:3864 + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr43 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 61: + goto st2 + case 92: + goto tr44 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto tr42 +tr42: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st25 + st25: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof25 + } + st_case_25: +//line plugins/parsers/influx/machine.go:3896 + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr46 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st25 +tr46: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st26 +tr43: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st26 + st26: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof26 + } + st_case_26: +//line plugins/parsers/influx/machine.go:3938 + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr43 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto tr44 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto tr42 +tr7: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st27 +tr61: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st27 + st27: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof27 + } + st_case_27: +//line plugins/parsers/influx/machine.go:3976 + switch ( m.data)[( m.p)] { + case 32: + goto tr50 + case 44: + goto tr50 + case 61: + goto tr50 + case 92: + goto tr51 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr50 + } + case ( m.data)[( m.p)] >= 9: + goto tr50 + } + goto tr49 +tr49: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st28 + st28: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof28 + } + st_case_28: +//line plugins/parsers/influx/machine.go:4007 + switch ( m.data)[( m.p)] { + case 32: + goto tr50 + case 44: + goto tr50 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr50 + } + case ( m.data)[( m.p)] >= 9: + goto tr50 + } + goto st28 +tr53: +//line plugins/parsers/influx/machine.go.rl:76 + + key = m.text() + + goto st29 + st29: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof29 + } + st_case_29: +//line plugins/parsers/influx/machine.go:4038 + switch ( m.data)[( m.p)] { + case 32: + goto tr50 + case 44: + goto tr50 + case 61: + goto tr50 + case 92: + goto tr56 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr50 + } + case ( m.data)[( m.p)] >= 9: + goto tr50 + } + goto tr55 +tr55: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st30 + st30: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof30 + } + st_case_30: +//line plugins/parsers/influx/machine.go:4069 + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 92: + goto st35 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 +tr60: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st31 + st31: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof31 + } + st_case_31: +//line plugins/parsers/influx/machine.go:4101 + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr64 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 92: + goto tr65 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto tr63 +tr63: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st32 + st32: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof32 + } + st_case_32: +//line plugins/parsers/influx/machine.go:4133 + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr67 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st32 +tr67: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st33 +tr64: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st33 + st33: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof33 + } + st_case_33: +//line plugins/parsers/influx/machine.go:4175 + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr64 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto tr65 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto tr63 +tr65: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st34 + st34: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof34 + } + st_case_34: +//line plugins/parsers/influx/machine.go:4207 + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st32 +tr56: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st35 + st35: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof35 + } + st_case_35: +//line plugins/parsers/influx/machine.go:4228 + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr50 + } + case ( m.data)[( m.p)] >= 9: + goto tr50 + } + goto st30 +tr51: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st36 + st36: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof36 + } + st_case_36: +//line plugins/parsers/influx/machine.go:4249 + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr50 + } + case ( m.data)[( m.p)] >= 9: + goto tr50 + } + goto st28 +tr47: +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st37 + st37: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof37 + } + st_case_37: +//line plugins/parsers/influx/machine.go:4270 + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 34: + goto st38 + case 44: + goto tr7 + case 45: + goto tr70 + case 46: + goto tr71 + case 48: + goto tr72 + case 70: + goto tr74 + case 84: + goto tr75 + case 92: + goto st129 + case 102: + goto tr76 + case 116: + goto tr77 + } + switch { + case ( m.data)[( m.p)] > 12: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr73 + } + case ( m.data)[( m.p)] >= 9: + goto tr4 + } + goto st2 + st38: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof38 + } + st_case_38: + switch ( m.data)[( m.p)] { + case 10: + goto tr25 + case 11: + goto tr80 + case 13: + goto tr25 + case 32: + goto tr79 + case 34: + goto tr81 + case 44: + goto tr82 + case 92: + goto tr83 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr79 + } + goto tr78 +tr78: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st39 + st39: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof39 + } + st_case_39: +//line plugins/parsers/influx/machine.go:4346 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 92: + goto st164 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 +tr85: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st40 +tr79: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st40 +tr229: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st40 + st40: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof40 + } + st_case_40: +//line plugins/parsers/influx/machine.go:4394 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr92 + case 13: + goto st7 + case 32: + goto st40 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr94 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st40 + } + goto tr90 +tr90: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st41 + st41: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof41 + } + st_case_41: +//line plugins/parsers/influx/machine.go:4428 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto st41 +tr93: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st224 +tr96: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st224 +tr112: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st224 + st224: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof224 + } + st_case_224: +//line plugins/parsers/influx/machine.go:4481 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st225 + case 13: + goto tr330 + case 32: + goto st192 + case 44: + goto st9 + case 61: + goto tr14 + case 92: + goto st10 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st192 + } + goto st4 + st225: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof225 + } + st_case_225: + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st225 + case 13: + goto tr330 + case 32: + goto st192 + case 44: + goto tr99 + case 45: + goto tr372 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr373 + } + case ( m.data)[( m.p)] >= 9: + goto st192 + } + goto st4 +tr372: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st42 + st42: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof42 + } + st_case_42: +//line plugins/parsers/influx/machine.go:4545 + switch ( m.data)[( m.p)] { + case 32: + goto tr99 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] < 12: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 10 { + goto tr99 + } + case ( m.data)[( m.p)] > 13: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st226 + } + default: + goto tr99 + } + goto st4 +tr373: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st226 + st226: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof226 + } + st_case_226: +//line plugins/parsers/influx/machine.go:4580 + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st228 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 +tr374: +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st227 + st227: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof227 + } + st_case_227: +//line plugins/parsers/influx/machine.go:4617 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st227 + case 13: + goto tr330 + case 32: + goto st195 + case 44: + goto tr5 + case 61: + goto tr14 + case 92: + goto st10 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st195 + } + goto st4 + st228: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof228 + } + st_case_228: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st229 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st229: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof229 + } + st_case_229: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st230 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st230: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof230 + } + st_case_230: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st231 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st231: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof231 + } + st_case_231: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st232 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st232: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof232 + } + st_case_232: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st233 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st233: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof233 + } + st_case_233: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st234 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st234: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof234 + } + st_case_234: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st235 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st235: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof235 + } + st_case_235: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st236 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st236: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof236 + } + st_case_236: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st237 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st237: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof237 + } + st_case_237: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st238 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st238: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof238 + } + st_case_238: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st239 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st239: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof239 + } + st_case_239: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st240 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st240: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof240 + } + st_case_240: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st241 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st241: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof241 + } + st_case_241: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st242 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st242: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof242 + } + st_case_242: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st243 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st243: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof243 + } + st_case_243: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st244 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st244: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof244 + } + st_case_244: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st245 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st4 + st245: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof245 + } + st_case_245: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr374 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr99 + case 61: + goto tr14 + case 92: + goto st10 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr334 + } + goto st4 +tr97: +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st43 + st43: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof43 + } + st_case_43: +//line plugins/parsers/influx/machine.go:5184 + switch ( m.data)[( m.p)] { + case 34: + goto tr101 + case 45: + goto tr102 + case 46: + goto tr103 + case 48: + goto tr104 + case 70: + goto tr106 + case 84: + goto tr107 + case 92: + goto st11 + case 102: + goto tr108 + case 116: + goto tr109 + } + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr105 + } + goto st7 +tr101: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st246 + st246: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof246 + } + st_case_246: +//line plugins/parsers/influx/machine.go:5220 + switch ( m.data)[( m.p)] { + case 10: + goto tr395 + case 13: + goto tr395 + case 32: + goto tr394 + case 34: + goto tr26 + case 44: + goto tr396 + case 92: + goto tr27 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr394 + } + goto tr25 +tr394: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st247 +tr423: +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st247 +tr429: +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st247 +tr432: +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st247 + st247: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof247 + } + st_case_247: +//line plugins/parsers/influx/machine.go:5268 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 13: + goto tr398 + case 32: + goto st247 + case 34: + goto tr29 + case 45: + goto tr399 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr400 + } + case ( m.data)[( m.p)] >= 9: + goto st247 + } + goto st7 +tr398: + m.cs = 248 +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr402: + m.cs = 248 +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr424: + m.cs = 248 +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr430: + m.cs = 248 +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr433: + m.cs = 248 +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again +tr395: + m.cs = 248 +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; goto _out } + + goto _again + st248: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof248 + } + st_case_248: +//line plugins/parsers/influx/machine.go:5371 + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + } + goto st7 +tr399: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st44 + st44: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof44 + } + st_case_44: +//line plugins/parsers/influx/machine.go:5390 + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + } + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st249 + } + goto st7 +tr400: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st249 + st249: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof249 + } + st_case_249: +//line plugins/parsers/influx/machine.go:5412 + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st251 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 +tr401: +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st250 + st250: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof250 + } + st_case_250: +//line plugins/parsers/influx/machine.go:5445 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 13: + goto tr398 + case 32: + goto st250 + case 34: + goto tr29 + case 92: + goto st11 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st250 + } + goto st7 + st251: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof251 + } + st_case_251: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st252 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st252: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof252 + } + st_case_252: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st253 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st253: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof253 + } + st_case_253: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st254 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st254: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof254 + } + st_case_254: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st255 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st255: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof255 + } + st_case_255: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st256 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st256: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof256 + } + st_case_256: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st257 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st257: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof257 + } + st_case_257: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st258 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st258: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof258 + } + st_case_258: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st259 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st259: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof259 + } + st_case_259: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st260 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st260: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof260 + } + st_case_260: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st261 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st261: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof261 + } + st_case_261: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st262 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st262: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof262 + } + st_case_262: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st263 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st263: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof263 + } + st_case_263: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st264 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st264: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof264 + } + st_case_264: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st265 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st265: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof265 + } + st_case_265: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st266 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st266: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof266 + } + st_case_266: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st267 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st267: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof267 + } + st_case_267: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st268 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st7 + st268: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof268 + } + st_case_268: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr29 + case 92: + goto st11 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr401 + } + goto st7 +tr396: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st45 +tr439: +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st45 +tr443: +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st45 +tr444: +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st45 + st45: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof45 + } + st_case_45: +//line plugins/parsers/influx/machine.go:5954 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr112 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr113 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto tr111 +tr111: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st46 + st46: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof46 + } + st_case_46: +//line plugins/parsers/influx/machine.go:5987 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr115 + case 92: + goto st74 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto st46 +tr115: +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st47 + st47: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof47 + } + st_case_47: +//line plugins/parsers/influx/machine.go:6020 + switch ( m.data)[( m.p)] { + case 34: + goto tr117 + case 45: + goto tr102 + case 46: + goto tr103 + case 48: + goto tr104 + case 70: + goto tr106 + case 84: + goto tr107 + case 92: + goto st11 + case 102: + goto tr108 + case 116: + goto tr109 + } + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr105 + } + goto st7 +tr117: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st269 + st269: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof269 + } + st_case_269: +//line plugins/parsers/influx/machine.go:6056 + switch ( m.data)[( m.p)] { + case 10: + goto tr395 + case 13: + goto tr395 + case 32: + goto tr394 + case 34: + goto tr26 + case 44: + goto tr422 + case 92: + goto tr27 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr394 + } + goto tr25 +tr422: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st48 +tr425: +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st48 +tr431: +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st48 +tr434: +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st48 + st48: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof48 + } + st_case_48: +//line plugins/parsers/influx/machine.go:6104 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr119 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto tr118 +tr118: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st49 + st49: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof49 + } + st_case_49: +//line plugins/parsers/influx/machine.go:6137 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr121 + case 92: + goto st62 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto st49 +tr121: +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st50 + st50: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof50 + } + st_case_50: +//line plugins/parsers/influx/machine.go:6170 + switch ( m.data)[( m.p)] { + case 34: + goto tr117 + case 45: + goto tr123 + case 46: + goto tr124 + case 48: + goto tr125 + case 70: + goto tr127 + case 84: + goto tr128 + case 92: + goto st11 + case 102: + goto tr129 + case 116: + goto tr130 + } + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr126 + } + goto st7 +tr123: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st51 + st51: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof51 + } + st_case_51: +//line plugins/parsers/influx/machine.go:6206 + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 48: + goto st270 + case 92: + goto st11 + } + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st275 + } + goto st7 +tr125: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st270 + st270: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof270 + } + st_case_270: +//line plugins/parsers/influx/machine.go:6230 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 13: + goto tr424 + case 32: + goto tr423 + case 34: + goto tr29 + case 44: + goto tr425 + case 46: + goto st271 + case 69: + goto st52 + case 92: + goto st11 + case 101: + goto st52 + case 105: + goto st274 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr423 + } + goto st7 +tr124: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st271 + st271: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof271 + } + st_case_271: +//line plugins/parsers/influx/machine.go:6268 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 13: + goto tr424 + case 32: + goto tr423 + case 34: + goto tr29 + case 44: + goto tr425 + case 69: + goto st52 + case 92: + goto st11 + case 101: + goto st52 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st271 + } + case ( m.data)[( m.p)] >= 9: + goto tr423 + } + goto st7 + st52: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof52 + } + st_case_52: + switch ( m.data)[( m.p)] { + case 34: + goto tr133 + case 43: + goto st53 + case 45: + goto st53 + case 92: + goto st11 + } + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st273 + } + goto st7 +tr133: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st272 + st272: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof272 + } + st_case_272: +//line plugins/parsers/influx/machine.go:6326 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 13: + goto tr330 + case 32: + goto st192 + case 44: + goto st9 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st216 + } + case ( m.data)[( m.p)] >= 9: + goto st192 + } + goto tr99 + st53: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof53 + } + st_case_53: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + } + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st273 + } + goto st7 + st273: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof273 + } + st_case_273: + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 13: + goto tr424 + case 32: + goto tr423 + case 34: + goto tr29 + case 44: + goto tr425 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st273 + } + case ( m.data)[( m.p)] >= 9: + goto tr423 + } + goto st7 + st274: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof274 + } + st_case_274: + switch ( m.data)[( m.p)] { + case 10: + goto tr430 + case 13: + goto tr430 + case 32: + goto tr429 + case 34: + goto tr29 + case 44: + goto tr431 + case 92: + goto st11 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr429 + } + goto st7 +tr126: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st275 + st275: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof275 + } + st_case_275: +//line plugins/parsers/influx/machine.go:6423 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 13: + goto tr424 + case 32: + goto tr423 + case 34: + goto tr29 + case 44: + goto tr425 + case 46: + goto st271 + case 69: + goto st52 + case 92: + goto st11 + case 101: + goto st52 + case 105: + goto st274 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st275 + } + case ( m.data)[( m.p)] >= 9: + goto tr423 + } + goto st7 +tr127: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st276 + st276: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof276 + } + st_case_276: +//line plugins/parsers/influx/machine.go:6466 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr434 + case 65: + goto st54 + case 92: + goto st11 + case 97: + goto st57 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 + st54: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof54 + } + st_case_54: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 76: + goto st55 + case 92: + goto st11 + } + goto st7 + st55: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof55 + } + st_case_55: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 83: + goto st56 + case 92: + goto st11 + } + goto st7 + st56: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof56 + } + st_case_56: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 69: + goto st277 + case 92: + goto st11 + } + goto st7 + st277: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof277 + } + st_case_277: + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr434 + case 92: + goto st11 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 + st57: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof57 + } + st_case_57: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + case 108: + goto st58 + } + goto st7 + st58: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof58 + } + st_case_58: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + case 115: + goto st59 + } + goto st7 + st59: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof59 + } + st_case_59: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + case 101: + goto st277 + } + goto st7 +tr128: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st278 + st278: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof278 + } + st_case_278: +//line plugins/parsers/influx/machine.go:6607 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr434 + case 82: + goto st60 + case 92: + goto st11 + case 114: + goto st61 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 + st60: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof60 + } + st_case_60: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 85: + goto st56 + case 92: + goto st11 + } + goto st7 + st61: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof61 + } + st_case_61: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + case 117: + goto st59 + } + goto st7 +tr129: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st279 + st279: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof279 + } + st_case_279: +//line plugins/parsers/influx/machine.go:6669 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr434 + case 92: + goto st11 + case 97: + goto st57 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 +tr130: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st280 + st280: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof280 + } + st_case_280: +//line plugins/parsers/influx/machine.go:6701 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr434 + case 92: + goto st11 + case 114: + goto st61 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 +tr119: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st62 + st62: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof62 + } + st_case_62: +//line plugins/parsers/influx/machine.go:6733 + switch ( m.data)[( m.p)] { + case 34: + goto st49 + case 92: + goto st49 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st4 +tr102: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st63 + st63: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof63 + } + st_case_63: +//line plugins/parsers/influx/machine.go:6760 + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 48: + goto st281 + case 92: + goto st11 + } + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st285 + } + goto st7 +tr104: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st281 + st281: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof281 + } + st_case_281: +//line plugins/parsers/influx/machine.go:6784 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 13: + goto tr424 + case 32: + goto tr423 + case 34: + goto tr29 + case 44: + goto tr439 + case 46: + goto st282 + case 69: + goto st64 + case 92: + goto st11 + case 101: + goto st64 + case 105: + goto st284 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr423 + } + goto st7 +tr103: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st282 + st282: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof282 + } + st_case_282: +//line plugins/parsers/influx/machine.go:6822 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 13: + goto tr424 + case 32: + goto tr423 + case 34: + goto tr29 + case 44: + goto tr439 + case 69: + goto st64 + case 92: + goto st11 + case 101: + goto st64 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st282 + } + case ( m.data)[( m.p)] >= 9: + goto tr423 + } + goto st7 + st64: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof64 + } + st_case_64: + switch ( m.data)[( m.p)] { + case 34: + goto tr133 + case 43: + goto st65 + case 45: + goto st65 + case 92: + goto st11 + } + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st283 + } + goto st7 + st65: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof65 + } + st_case_65: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + } + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st283 + } + goto st7 + st283: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof283 + } + st_case_283: + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 13: + goto tr424 + case 32: + goto tr423 + case 34: + goto tr29 + case 44: + goto tr439 + case 92: + goto st11 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st283 + } + case ( m.data)[( m.p)] >= 9: + goto tr423 + } + goto st7 + st284: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof284 + } + st_case_284: + switch ( m.data)[( m.p)] { + case 10: + goto tr430 + case 13: + goto tr430 + case 32: + goto tr429 + case 34: + goto tr29 + case 44: + goto tr443 + case 92: + goto st11 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr429 + } + goto st7 +tr105: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st285 + st285: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof285 + } + st_case_285: +//line plugins/parsers/influx/machine.go:6946 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 13: + goto tr424 + case 32: + goto tr423 + case 34: + goto tr29 + case 44: + goto tr439 + case 46: + goto st282 + case 69: + goto st64 + case 92: + goto st11 + case 101: + goto st64 + case 105: + goto st284 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st285 + } + case ( m.data)[( m.p)] >= 9: + goto tr423 + } + goto st7 +tr106: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st286 + st286: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof286 + } + st_case_286: +//line plugins/parsers/influx/machine.go:6989 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr444 + case 65: + goto st66 + case 92: + goto st11 + case 97: + goto st69 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 + st66: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof66 + } + st_case_66: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 76: + goto st67 + case 92: + goto st11 + } + goto st7 + st67: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof67 + } + st_case_67: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 83: + goto st68 + case 92: + goto st11 + } + goto st7 + st68: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof68 + } + st_case_68: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 69: + goto st287 + case 92: + goto st11 + } + goto st7 + st287: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof287 + } + st_case_287: + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr444 + case 92: + goto st11 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 + st69: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof69 + } + st_case_69: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + case 108: + goto st70 + } + goto st7 + st70: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof70 + } + st_case_70: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + case 115: + goto st71 + } + goto st7 + st71: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof71 + } + st_case_71: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + case 101: + goto st287 + } + goto st7 +tr107: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st288 + st288: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof288 + } + st_case_288: +//line plugins/parsers/influx/machine.go:7130 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr444 + case 82: + goto st72 + case 92: + goto st11 + case 114: + goto st73 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 + st72: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof72 + } + st_case_72: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 85: + goto st68 + case 92: + goto st11 + } + goto st7 + st73: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof73 + } + st_case_73: + switch ( m.data)[( m.p)] { + case 34: + goto tr29 + case 92: + goto st11 + case 117: + goto st71 + } + goto st7 +tr108: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st289 + st289: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof289 + } + st_case_289: +//line plugins/parsers/influx/machine.go:7192 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr444 + case 92: + goto st11 + case 97: + goto st69 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 +tr109: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st290 + st290: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof290 + } + st_case_290: +//line plugins/parsers/influx/machine.go:7224 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 13: + goto tr433 + case 32: + goto tr432 + case 34: + goto tr29 + case 44: + goto tr444 + case 92: + goto st11 + case 114: + goto st73 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr432 + } + goto st7 +tr113: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st74 + st74: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof74 + } + st_case_74: +//line plugins/parsers/influx/machine.go:7256 + switch ( m.data)[( m.p)] { + case 34: + goto st46 + case 92: + goto st46 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st4 +tr94: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st75 + st75: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof75 + } + st_case_75: +//line plugins/parsers/influx/machine.go:7283 + switch ( m.data)[( m.p)] { + case 34: + goto st41 + case 92: + goto st41 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st4 +tr92: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st76 + st76: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof76 + } + st_case_76: +//line plugins/parsers/influx/machine.go:7310 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr92 + case 13: + goto st7 + case 32: + goto st40 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto tr94 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st40 + } + goto tr90 +tr86: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st77 +tr80: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st77 + st77: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof77 + } + st_case_77: +//line plugins/parsers/influx/machine.go:7354 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr151 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr152 + case 44: + goto tr88 + case 61: + goto st39 + case 92: + goto tr153 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto tr150 +tr150: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st78 + st78: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof78 + } + st_case_78: +//line plugins/parsers/influx/machine.go:7388 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr155 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st78 +tr155: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st79 +tr151: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st79 + st79: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof79 + } + st_case_79: +//line plugins/parsers/influx/machine.go:7432 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr151 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr152 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto tr153 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto tr150 +tr152: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st291 +tr156: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st291 + st291: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof291 + } + st_case_291: +//line plugins/parsers/influx/machine.go:7476 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr450 + case 13: + goto tr330 + case 32: + goto tr449 + case 44: + goto tr451 + case 61: + goto tr47 + case 92: + goto st81 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr449 + } + goto st25 +tr449: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st292 +tr481: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st292 +tr533: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st292 +tr539: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st292 +tr542: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st292 +tr747: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st292 +tr763: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st292 +tr766: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st292 + st292: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof292 + } + st_case_292: +//line plugins/parsers/influx/machine.go:7574 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr453 + case 13: + goto tr330 + case 32: + goto st292 + case 44: + goto tr99 + case 45: + goto tr372 + case 61: + goto tr99 + case 92: + goto tr12 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr373 + } + case ( m.data)[( m.p)] >= 9: + goto st292 + } + goto tr9 +tr453: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st293 + st293: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof293 + } + st_case_293: +//line plugins/parsers/influx/machine.go:7613 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr453 + case 13: + goto tr330 + case 32: + goto st292 + case 44: + goto tr99 + case 45: + goto tr372 + case 61: + goto tr14 + case 92: + goto tr12 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr373 + } + case ( m.data)[( m.p)] >= 9: + goto st292 + } + goto tr9 +tr450: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st294 +tr454: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st294 + st294: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof294 + } + st_case_294: +//line plugins/parsers/influx/machine.go:7662 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr454 + case 13: + goto tr330 + case 32: + goto tr449 + case 44: + goto tr7 + case 45: + goto tr455 + case 61: + goto tr47 + case 92: + goto tr44 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr456 + } + case ( m.data)[( m.p)] >= 9: + goto tr449 + } + goto tr42 +tr455: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st80 + st80: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof80 + } + st_case_80: +//line plugins/parsers/influx/machine.go:7701 + switch ( m.data)[( m.p)] { + case 10: + goto tr99 + case 11: + goto tr46 + case 13: + goto tr99 + case 32: + goto tr4 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st295 + } + case ( m.data)[( m.p)] >= 9: + goto tr4 + } + goto st25 +tr456: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st295 + st295: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof295 + } + st_case_295: +//line plugins/parsers/influx/machine.go:7738 + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st299 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 +tr462: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st296 +tr490: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st296 +tr457: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st296 +tr487: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st296 + st296: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof296 + } + st_case_296: +//line plugins/parsers/influx/machine.go:7801 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr461 + case 13: + goto tr330 + case 32: + goto st296 + case 44: + goto tr5 + case 61: + goto tr5 + case 92: + goto tr12 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st296 + } + goto tr9 +tr461: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st297 + st297: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof297 + } + st_case_297: +//line plugins/parsers/influx/machine.go:7833 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr461 + case 13: + goto tr330 + case 32: + goto st296 + case 44: + goto tr5 + case 61: + goto tr14 + case 92: + goto tr12 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st296 + } + goto tr9 +tr463: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st298 +tr458: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st298 + st298: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof298 + } + st_case_298: +//line plugins/parsers/influx/machine.go:7879 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr463 + case 13: + goto tr330 + case 32: + goto tr462 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto tr44 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr462 + } + goto tr42 +tr44: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st81 + st81: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof81 + } + st_case_81: +//line plugins/parsers/influx/machine.go:7911 + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st25 + st299: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof299 + } + st_case_299: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st300 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st300: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof300 + } + st_case_300: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st301 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st301: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof301 + } + st_case_301: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st302 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st302: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof302 + } + st_case_302: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st303 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st303: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof303 + } + st_case_303: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st304 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st304: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof304 + } + st_case_304: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st305 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st305: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof305 + } + st_case_305: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st306 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st306: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof306 + } + st_case_306: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st307 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st307: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof307 + } + st_case_307: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st308 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st308: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof308 + } + st_case_308: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st309 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st309: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof309 + } + st_case_309: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st310 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st310: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof310 + } + st_case_310: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st311 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st311: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof311 + } + st_case_311: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st312 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st312: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof312 + } + st_case_312: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st313 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st313: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof313 + } + st_case_313: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st314 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st314: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof314 + } + st_case_314: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st315 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st315: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof315 + } + st_case_315: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st316 + } + case ( m.data)[( m.p)] >= 9: + goto tr457 + } + goto st25 + st316: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof316 + } + st_case_316: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr458 + case 13: + goto tr335 + case 32: + goto tr457 + case 44: + goto tr7 + case 61: + goto tr47 + case 92: + goto st81 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr457 + } + goto st25 +tr451: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st82 +tr483: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st82 +tr535: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st82 +tr541: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st82 +tr544: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st82 +tr749: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st82 +tr765: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st82 +tr768: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st82 + st82: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof82 + } + st_case_82: +//line plugins/parsers/influx/machine.go:8533 + switch ( m.data)[( m.p)] { + case 32: + goto tr59 + case 44: + goto tr59 + case 61: + goto tr59 + case 92: + goto tr161 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto tr160 +tr160: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st83 + st83: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof83 + } + st_case_83: +//line plugins/parsers/influx/machine.go:8564 + switch ( m.data)[( m.p)] { + case 32: + goto tr59 + case 44: + goto tr59 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st83 +tr163: +//line plugins/parsers/influx/machine.go.rl:76 + + key = m.text() + +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st84 + st84: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof84 + } + st_case_84: +//line plugins/parsers/influx/machine.go:8599 + switch ( m.data)[( m.p)] { + case 32: + goto tr59 + case 34: + goto tr165 + case 44: + goto tr59 + case 45: + goto tr166 + case 46: + goto tr167 + case 48: + goto tr168 + case 61: + goto tr59 + case 70: + goto tr170 + case 84: + goto tr171 + case 92: + goto tr56 + case 102: + goto tr172 + case 116: + goto tr173 + } + switch { + case ( m.data)[( m.p)] < 12: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 10 { + goto tr59 + } + case ( m.data)[( m.p)] > 13: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr169 + } + default: + goto tr59 + } + goto tr55 +tr165: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st85 + st85: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof85 + } + st_case_85: +//line plugins/parsers/influx/machine.go:8650 + switch ( m.data)[( m.p)] { + case 10: + goto tr25 + case 11: + goto tr176 + case 13: + goto tr25 + case 32: + goto tr175 + case 34: + goto tr177 + case 44: + goto tr178 + case 61: + goto tr25 + case 92: + goto tr179 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr175 + } + goto tr174 +tr174: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st86 + st86: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof86 + } + st_case_86: +//line plugins/parsers/influx/machine.go:8684 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 92: + goto st100 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 +tr181: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st87 +tr175: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st87 + st87: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof87 + } + st_case_87: +//line plugins/parsers/influx/machine.go:8728 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr188 + case 13: + goto st7 + case 32: + goto st87 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr189 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st87 + } + goto tr186 +tr186: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st88 + st88: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof88 + } + st_case_88: +//line plugins/parsers/influx/machine.go:8762 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto st88 +tr191: +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st89 + st89: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof89 + } + st_case_89: +//line plugins/parsers/influx/machine.go:8795 + switch ( m.data)[( m.p)] { + case 34: + goto tr101 + case 45: + goto tr123 + case 46: + goto tr124 + case 48: + goto tr125 + case 70: + goto tr127 + case 84: + goto tr128 + case 92: + goto st11 + case 102: + goto tr129 + case 116: + goto tr130 + } + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr126 + } + goto st7 +tr189: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st90 + st90: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof90 + } + st_case_90: +//line plugins/parsers/influx/machine.go:8831 + switch ( m.data)[( m.p)] { + case 34: + goto st88 + case 92: + goto st88 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st4 +tr188: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st91 + st91: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof91 + } + st_case_91: +//line plugins/parsers/influx/machine.go:8858 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr188 + case 13: + goto st7 + case 32: + goto st87 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto tr189 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st87 + } + goto tr186 +tr182: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st92 +tr176: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st92 + st92: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof92 + } + st_case_92: +//line plugins/parsers/influx/machine.go:8902 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr194 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr195 + case 44: + goto tr184 + case 61: + goto st7 + case 92: + goto tr196 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto tr193 +tr193: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st93 + st93: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof93 + } + st_case_93: +//line plugins/parsers/influx/machine.go:8936 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr198 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st93 +tr198: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st94 +tr194: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st94 + st94: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof94 + } + st_case_94: +//line plugins/parsers/influx/machine.go:8980 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr194 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr195 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto tr196 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto tr193 +tr195: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st317 +tr199: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st317 + st317: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof317 + } + st_case_317: +//line plugins/parsers/influx/machine.go:9024 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr482 + case 13: + goto tr330 + case 32: + goto tr481 + case 44: + goto tr483 + case 61: + goto tr14 + case 92: + goto st34 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr481 + } + goto st32 +tr482: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st318 +tr484: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st318 + st318: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof318 + } + st_case_318: +//line plugins/parsers/influx/machine.go:9066 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr484 + case 13: + goto tr330 + case 32: + goto tr481 + case 44: + goto tr61 + case 45: + goto tr485 + case 61: + goto tr14 + case 92: + goto tr65 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr486 + } + case ( m.data)[( m.p)] >= 9: + goto tr481 + } + goto tr63 +tr485: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st95 + st95: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof95 + } + st_case_95: +//line plugins/parsers/influx/machine.go:9105 + switch ( m.data)[( m.p)] { + case 10: + goto tr201 + case 11: + goto tr67 + case 13: + goto tr201 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st319 + } + case ( m.data)[( m.p)] >= 9: + goto tr58 + } + goto st32 +tr486: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st319 + st319: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof319 + } + st_case_319: +//line plugins/parsers/influx/machine.go:9142 + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st321 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 +tr491: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st320 +tr488: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st320 + st320: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof320 + } + st_case_320: +//line plugins/parsers/influx/machine.go:9193 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr491 + case 13: + goto tr330 + case 32: + goto tr490 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto tr65 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr490 + } + goto tr63 + st321: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof321 + } + st_case_321: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st322 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st322: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof322 + } + st_case_322: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st323 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st323: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof323 + } + st_case_323: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st324 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st324: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof324 + } + st_case_324: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st325 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st325: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof325 + } + st_case_325: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st326 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st326: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof326 + } + st_case_326: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st327 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st327: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof327 + } + st_case_327: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st328 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st328: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof328 + } + st_case_328: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st329 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st329: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof329 + } + st_case_329: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st330 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st330: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof330 + } + st_case_330: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st331 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st331: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof331 + } + st_case_331: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st332 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st332: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof332 + } + st_case_332: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st333 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st333: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof333 + } + st_case_333: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st334 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st334: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof334 + } + st_case_334: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st335 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st335: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof335 + } + st_case_335: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st336 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st336: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof336 + } + st_case_336: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st337 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st337: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof337 + } + st_case_337: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st338 + } + case ( m.data)[( m.p)] >= 9: + goto tr487 + } + goto st32 + st338: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof338 + } + st_case_338: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr488 + case 13: + goto tr335 + case 32: + goto tr487 + case 44: + goto tr61 + case 61: + goto tr14 + case 92: + goto st34 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr487 + } + goto st32 +tr184: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st96 +tr178: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st96 + st96: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof96 + } + st_case_96: +//line plugins/parsers/influx/machine.go:9770 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr204 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr205 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto tr203 +tr203: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st97 + st97: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof97 + } + st_case_97: +//line plugins/parsers/influx/machine.go:9803 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr207 + case 44: + goto st7 + case 61: + goto tr208 + case 92: + goto st101 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto st97 +tr204: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st339 +tr207: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st339 + st339: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof339 + } + st_case_339: +//line plugins/parsers/influx/machine.go:9846 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st340 + case 13: + goto tr330 + case 32: + goto st192 + case 44: + goto st9 + case 61: + goto tr53 + case 92: + goto st36 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st192 + } + goto st28 + st340: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof340 + } + st_case_340: + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st340 + case 13: + goto tr330 + case 32: + goto st192 + case 44: + goto tr210 + case 45: + goto tr510 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr511 + } + case ( m.data)[( m.p)] >= 9: + goto st192 + } + goto st28 +tr510: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st98 + st98: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof98 + } + st_case_98: +//line plugins/parsers/influx/machine.go:9910 + switch ( m.data)[( m.p)] { + case 32: + goto tr210 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] < 12: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 10 { + goto tr210 + } + case ( m.data)[( m.p)] > 13: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st341 + } + default: + goto tr210 + } + goto st28 +tr511: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st341 + st341: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof341 + } + st_case_341: +//line plugins/parsers/influx/machine.go:9945 + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st343 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 +tr512: +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st342 + st342: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof342 + } + st_case_342: +//line plugins/parsers/influx/machine.go:9982 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st342 + case 13: + goto tr330 + case 32: + goto st195 + case 44: + goto tr50 + case 61: + goto tr53 + case 92: + goto st36 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st195 + } + goto st28 + st343: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof343 + } + st_case_343: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st344 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st344: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof344 + } + st_case_344: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st345 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st345: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof345 + } + st_case_345: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st346 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st346: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof346 + } + st_case_346: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st347 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st347: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof347 + } + st_case_347: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st348 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st348: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof348 + } + st_case_348: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st349 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st349: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof349 + } + st_case_349: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st350 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st350: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof350 + } + st_case_350: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st351 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st351: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof351 + } + st_case_351: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st352 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st352: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof352 + } + st_case_352: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st353 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st353: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof353 + } + st_case_353: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st354 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st354: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof354 + } + st_case_354: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st355 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st355: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof355 + } + st_case_355: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st356 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st356: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof356 + } + st_case_356: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st357 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st357: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof357 + } + st_case_357: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st358 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st358: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof358 + } + st_case_358: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st359 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st359: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof359 + } + st_case_359: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st360 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st28 + st360: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof360 + } + st_case_360: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr512 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr210 + case 61: + goto tr53 + case 92: + goto st36 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr334 + } + goto st28 +tr208: +//line plugins/parsers/influx/machine.go.rl:76 + + key = m.text() + + goto st99 + st99: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof99 + } + st_case_99: +//line plugins/parsers/influx/machine.go:10549 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr177 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr179 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto tr174 +tr177: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st361 +tr183: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st361 + st361: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof361 + } + st_case_361: +//line plugins/parsers/influx/machine.go:10592 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr532 + case 13: + goto tr330 + case 32: + goto tr481 + case 44: + goto tr483 + case 61: + goto tr201 + case 92: + goto st35 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr481 + } + goto st30 +tr532: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st362 +tr534: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st362 +tr540: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st362 +tr543: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st362 + st362: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof362 + } + st_case_362: +//line plugins/parsers/influx/machine.go:10654 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr484 + case 13: + goto tr330 + case 32: + goto tr481 + case 44: + goto tr61 + case 45: + goto tr485 + case 61: + goto tr201 + case 92: + goto tr65 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr486 + } + case ( m.data)[( m.p)] >= 9: + goto tr481 + } + goto tr63 +tr179: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st100 + st100: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof100 + } + st_case_100: +//line plugins/parsers/influx/machine.go:10693 + switch ( m.data)[( m.p)] { + case 34: + goto st86 + case 92: + goto st86 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st30 +tr205: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st101 + st101: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof101 + } + st_case_101: +//line plugins/parsers/influx/machine.go:10720 + switch ( m.data)[( m.p)] { + case 34: + goto st97 + case 92: + goto st97 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st28 +tr196: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st102 + st102: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof102 + } + st_case_102: +//line plugins/parsers/influx/machine.go:10747 + switch ( m.data)[( m.p)] { + case 34: + goto st93 + case 92: + goto st93 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st32 +tr166: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st103 + st103: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof103 + } + st_case_103: +//line plugins/parsers/influx/machine.go:10774 + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 48: + goto st363 + case 61: + goto tr59 + case 92: + goto st35 + } + switch { + case ( m.data)[( m.p)] > 12: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st367 + } + case ( m.data)[( m.p)] >= 9: + goto tr58 + } + goto st30 +tr168: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st363 + st363: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof363 + } + st_case_363: +//line plugins/parsers/influx/machine.go:10813 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 11: + goto tr534 + case 13: + goto tr356 + case 32: + goto tr533 + case 44: + goto tr535 + case 46: + goto st364 + case 61: + goto tr201 + case 69: + goto st104 + case 92: + goto st35 + case 101: + goto st104 + case 105: + goto st366 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr533 + } + goto st30 +tr167: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st364 + st364: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof364 + } + st_case_364: +//line plugins/parsers/influx/machine.go:10853 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 11: + goto tr534 + case 13: + goto tr356 + case 32: + goto tr533 + case 44: + goto tr535 + case 61: + goto tr201 + case 69: + goto st104 + case 92: + goto st35 + case 101: + goto st104 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st364 + } + case ( m.data)[( m.p)] >= 9: + goto tr533 + } + goto st30 + st104: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof104 + } + st_case_104: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 34: + goto st105 + case 44: + goto tr61 + case 61: + goto tr59 + case 92: + goto st35 + } + switch { + case ( m.data)[( m.p)] < 43: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + case ( m.data)[( m.p)] > 45: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st365 + } + default: + goto st105 + } + goto st30 + st105: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof105 + } + st_case_105: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 92: + goto st35 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st365 + } + case ( m.data)[( m.p)] >= 9: + goto tr58 + } + goto st30 + st365: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof365 + } + st_case_365: + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 11: + goto tr534 + case 13: + goto tr356 + case 32: + goto tr533 + case 44: + goto tr535 + case 61: + goto tr201 + case 92: + goto st35 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st365 + } + case ( m.data)[( m.p)] >= 9: + goto tr533 + } + goto st30 + st366: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof366 + } + st_case_366: + switch ( m.data)[( m.p)] { + case 10: + goto tr362 + case 11: + goto tr540 + case 13: + goto tr362 + case 32: + goto tr539 + case 44: + goto tr541 + case 61: + goto tr201 + case 92: + goto st35 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr539 + } + goto st30 +tr169: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st367 + st367: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof367 + } + st_case_367: +//line plugins/parsers/influx/machine.go:11015 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 11: + goto tr534 + case 13: + goto tr356 + case 32: + goto tr533 + case 44: + goto tr535 + case 46: + goto st364 + case 61: + goto tr201 + case 69: + goto st104 + case 92: + goto st35 + case 101: + goto st104 + case 105: + goto st366 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st367 + } + case ( m.data)[( m.p)] >= 9: + goto tr533 + } + goto st30 +tr170: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st368 + st368: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof368 + } + st_case_368: +//line plugins/parsers/influx/machine.go:11060 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr543 + case 13: + goto tr365 + case 32: + goto tr542 + case 44: + goto tr544 + case 61: + goto tr201 + case 65: + goto st106 + case 92: + goto st35 + case 97: + goto st109 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr542 + } + goto st30 + st106: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof106 + } + st_case_106: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 76: + goto st107 + case 92: + goto st35 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 + st107: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof107 + } + st_case_107: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 83: + goto st108 + case 92: + goto st35 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 + st108: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof108 + } + st_case_108: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 69: + goto st369 + case 92: + goto st35 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 + st369: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof369 + } + st_case_369: + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr543 + case 13: + goto tr365 + case 32: + goto tr542 + case 44: + goto tr544 + case 61: + goto tr201 + case 92: + goto st35 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr542 + } + goto st30 + st109: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof109 + } + st_case_109: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 92: + goto st35 + case 108: + goto st110 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 + st110: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof110 + } + st_case_110: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 92: + goto st35 + case 115: + goto st111 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 + st111: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof111 + } + st_case_111: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 92: + goto st35 + case 101: + goto st369 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 +tr171: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st370 + st370: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof370 + } + st_case_370: +//line plugins/parsers/influx/machine.go:11283 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr543 + case 13: + goto tr365 + case 32: + goto tr542 + case 44: + goto tr544 + case 61: + goto tr201 + case 82: + goto st112 + case 92: + goto st35 + case 114: + goto st113 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr542 + } + goto st30 + st112: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof112 + } + st_case_112: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 85: + goto st108 + case 92: + goto st35 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 + st113: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof113 + } + st_case_113: + switch ( m.data)[( m.p)] { + case 10: + goto tr59 + case 11: + goto tr60 + case 13: + goto tr59 + case 32: + goto tr58 + case 44: + goto tr61 + case 61: + goto tr59 + case 92: + goto st35 + case 117: + goto st111 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr58 + } + goto st30 +tr172: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st371 + st371: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof371 + } + st_case_371: +//line plugins/parsers/influx/machine.go:11373 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr543 + case 13: + goto tr365 + case 32: + goto tr542 + case 44: + goto tr544 + case 61: + goto tr201 + case 92: + goto st35 + case 97: + goto st109 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr542 + } + goto st30 +tr173: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st372 + st372: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof372 + } + st_case_372: +//line plugins/parsers/influx/machine.go:11407 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr543 + case 13: + goto tr365 + case 32: + goto tr542 + case 44: + goto tr544 + case 61: + goto tr201 + case 92: + goto st35 + case 114: + goto st113 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr542 + } + goto st30 +tr161: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st114 + st114: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof114 + } + st_case_114: +//line plugins/parsers/influx/machine.go:11441 + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st83 +tr88: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st115 +tr82: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st115 +tr231: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st115 + st115: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof115 + } + st_case_115: +//line plugins/parsers/influx/machine.go:11478 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr204 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr222 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto tr221 +tr221: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st116 + st116: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof116 + } + st_case_116: +//line plugins/parsers/influx/machine.go:11511 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr207 + case 44: + goto st7 + case 61: + goto tr224 + case 92: + goto st124 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto st116 +tr224: +//line plugins/parsers/influx/machine.go.rl:76 + + key = m.text() + + goto st117 + st117: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof117 + } + st_case_117: +//line plugins/parsers/influx/machine.go:11544 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr177 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr227 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto tr226 +tr226: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st118 + st118: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof118 + } + st_case_118: +//line plugins/parsers/influx/machine.go:11577 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 92: + goto st123 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 +tr230: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st119 + st119: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof119 + } + st_case_119: +//line plugins/parsers/influx/machine.go:11611 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr234 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr195 + case 44: + goto tr231 + case 61: + goto st7 + case 92: + goto tr235 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto tr233 +tr233: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st120 + st120: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof120 + } + st_case_120: +//line plugins/parsers/influx/machine.go:11645 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr237 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st120 +tr237: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st121 +tr234: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st121 + st121: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof121 + } + st_case_121: +//line plugins/parsers/influx/machine.go:11689 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr234 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr195 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto tr235 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto tr233 +tr235: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st122 + st122: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof122 + } + st_case_122: +//line plugins/parsers/influx/machine.go:11723 + switch ( m.data)[( m.p)] { + case 34: + goto st120 + case 92: + goto st120 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st32 +tr227: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st123 + st123: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof123 + } + st_case_123: +//line plugins/parsers/influx/machine.go:11750 + switch ( m.data)[( m.p)] { + case 34: + goto st118 + case 92: + goto st118 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st30 +tr222: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st124 + st124: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof124 + } + st_case_124: +//line plugins/parsers/influx/machine.go:11777 + switch ( m.data)[( m.p)] { + case 34: + goto st116 + case 92: + goto st116 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st28 +tr157: +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st125 + st125: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof125 + } + st_case_125: +//line plugins/parsers/influx/machine.go:11804 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr239 + case 44: + goto tr88 + case 45: + goto tr240 + case 46: + goto tr241 + case 48: + goto tr242 + case 70: + goto tr244 + case 84: + goto tr245 + case 92: + goto st164 + case 102: + goto tr246 + case 116: + goto tr247 + } + switch { + case ( m.data)[( m.p)] > 12: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr243 + } + case ( m.data)[( m.p)] >= 9: + goto tr85 + } + goto st39 +tr239: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st373 + st373: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof373 + } + st_case_373: +//line plugins/parsers/influx/machine.go:11855 + switch ( m.data)[( m.p)] { + case 10: + goto tr395 + case 11: + goto tr550 + case 13: + goto tr395 + case 32: + goto tr549 + case 34: + goto tr81 + case 44: + goto tr551 + case 92: + goto tr83 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr549 + } + goto tr78 +tr576: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st374 +tr549: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st374 +tr705: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st374 +tr699: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st374 +tr731: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st374 +tr734: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st374 +tr741: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st374 +tr750: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st374 +tr753: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st374 + st374: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof374 + } + st_case_374: +//line plugins/parsers/influx/machine.go:11963 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr553 + case 13: + goto tr398 + case 32: + goto st374 + case 34: + goto tr93 + case 44: + goto st7 + case 45: + goto tr554 + case 61: + goto st7 + case 92: + goto tr94 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr555 + } + case ( m.data)[( m.p)] >= 9: + goto st374 + } + goto tr90 +tr553: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st375 + st375: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof375 + } + st_case_375: +//line plugins/parsers/influx/machine.go:12004 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr553 + case 13: + goto tr398 + case 32: + goto st374 + case 34: + goto tr93 + case 44: + goto st7 + case 45: + goto tr554 + case 61: + goto tr97 + case 92: + goto tr94 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr555 + } + case ( m.data)[( m.p)] >= 9: + goto st374 + } + goto tr90 +tr554: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st126 + st126: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof126 + } + st_case_126: +//line plugins/parsers/influx/machine.go:12045 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] < 12: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 10 { + goto st7 + } + case ( m.data)[( m.p)] > 13: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st376 + } + default: + goto st7 + } + goto st41 +tr555: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st376 + st376: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof376 + } + st_case_376: +//line plugins/parsers/influx/machine.go:12082 + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st378 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 +tr556: +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st377 + st377: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof377 + } + st_case_377: +//line plugins/parsers/influx/machine.go:12121 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto st377 + case 13: + goto tr398 + case 32: + goto st250 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st250 + } + goto st41 + st378: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof378 + } + st_case_378: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st379 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st379: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof379 + } + st_case_379: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st380 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st380: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof380 + } + st_case_380: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st381 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st381: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof381 + } + st_case_381: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st382 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st382: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof382 + } + st_case_382: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st383 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st383: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof383 + } + st_case_383: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st384 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st384: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof384 + } + st_case_384: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st385 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st385: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof385 + } + st_case_385: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st386 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st386: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof386 + } + st_case_386: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st387 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st387: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof387 + } + st_case_387: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st388 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st388: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof388 + } + st_case_388: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st389 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st389: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof389 + } + st_case_389: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st390 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st390: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof390 + } + st_case_390: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st391 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st391: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof391 + } + st_case_391: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st392 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st392: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof392 + } + st_case_392: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st393 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st393: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof393 + } + st_case_393: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st394 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st394: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof394 + } + st_case_394: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st395 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st41 + st395: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof395 + } + st_case_395: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr556 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto st75 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr401 + } + goto st41 +tr550: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st396 +tr742: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st396 +tr751: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st396 +tr754: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st396 + st396: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof396 + } + st_case_396: +//line plugins/parsers/influx/machine.go:12760 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr577 + case 13: + goto tr398 + case 32: + goto tr576 + case 34: + goto tr152 + case 44: + goto tr88 + case 45: + goto tr578 + case 61: + goto st39 + case 92: + goto tr153 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr579 + } + case ( m.data)[( m.p)] >= 9: + goto tr576 + } + goto tr150 +tr577: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st397 + st397: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof397 + } + st_case_397: +//line plugins/parsers/influx/machine.go:12805 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr577 + case 13: + goto tr398 + case 32: + goto tr576 + case 34: + goto tr152 + case 44: + goto tr88 + case 45: + goto tr578 + case 61: + goto tr157 + case 92: + goto tr153 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr579 + } + case ( m.data)[( m.p)] >= 9: + goto tr576 + } + goto tr150 +tr578: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st127 + st127: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof127 + } + st_case_127: +//line plugins/parsers/influx/machine.go:12846 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr155 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st398 + } + case ( m.data)[( m.p)] >= 9: + goto tr85 + } + goto st78 +tr579: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st398 + st398: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof398 + } + st_case_398: +//line plugins/parsers/influx/machine.go:12885 + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st402 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 +tr585: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st399 +tr712: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st399 +tr580: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st399 +tr709: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st399 + st399: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof399 + } + st_case_399: +//line plugins/parsers/influx/machine.go:12950 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr584 + case 13: + goto tr398 + case 32: + goto st399 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr94 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st399 + } + goto tr90 +tr584: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st400 + st400: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof400 + } + st_case_400: +//line plugins/parsers/influx/machine.go:12984 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr584 + case 13: + goto tr398 + case 32: + goto st399 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto tr97 + case 92: + goto tr94 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st399 + } + goto tr90 +tr586: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st401 +tr581: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st401 + st401: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof401 + } + st_case_401: +//line plugins/parsers/influx/machine.go:13032 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr586 + case 13: + goto tr398 + case 32: + goto tr585 + case 34: + goto tr152 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto tr153 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr585 + } + goto tr150 +tr153: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st128 + st128: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof128 + } + st_case_128: +//line plugins/parsers/influx/machine.go:13066 + switch ( m.data)[( m.p)] { + case 34: + goto st78 + case 92: + goto st78 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st25 + st402: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof402 + } + st_case_402: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st403 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st403: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof403 + } + st_case_403: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st404 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st404: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof404 + } + st_case_404: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st405 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st405: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof405 + } + st_case_405: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st406 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st406: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof406 + } + st_case_406: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st407 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st407: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof407 + } + st_case_407: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st408 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st408: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof408 + } + st_case_408: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st409 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st409: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof409 + } + st_case_409: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st410 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st410: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof410 + } + st_case_410: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st411 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st411: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof411 + } + st_case_411: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st412 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st412: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof412 + } + st_case_412: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st413 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st413: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof413 + } + st_case_413: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st414 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st414: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof414 + } + st_case_414: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st415 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st415: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof415 + } + st_case_415: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st416 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st416: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof416 + } + st_case_416: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st417 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st417: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof417 + } + st_case_417: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st418 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st418: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof418 + } + st_case_418: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st419 + } + case ( m.data)[( m.p)] >= 9: + goto tr580 + } + goto st78 + st419: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof419 + } + st_case_419: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr581 + case 13: + goto tr402 + case 32: + goto tr580 + case 34: + goto tr156 + case 44: + goto tr88 + case 61: + goto tr157 + case 92: + goto st128 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr580 + } + goto st78 +tr81: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st420 +tr87: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st420 + st420: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof420 + } + st_case_420: +//line plugins/parsers/influx/machine.go:13674 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr604 + case 13: + goto tr330 + case 32: + goto tr449 + case 44: + goto tr451 + case 92: + goto st129 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr449 + } + goto st2 +tr604: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + + goto st421 +tr748: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st421 +tr764: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st421 +tr767: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st421 + st421: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof421 + } + st_case_421: +//line plugins/parsers/influx/machine.go:13734 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr454 + case 13: + goto tr330 + case 32: + goto tr449 + case 44: + goto tr7 + case 45: + goto tr455 + case 61: + goto st2 + case 92: + goto tr44 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr456 + } + case ( m.data)[( m.p)] >= 9: + goto tr449 + } + goto tr42 +tr2: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st129 + st129: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof129 + } + st_case_129: +//line plugins/parsers/influx/machine.go:13773 + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr1 + } + case ( m.data)[( m.p)] >= 9: + goto tr1 + } + goto st2 +tr551: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st130 +tr701: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st130 +tr733: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st130 +tr736: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st130 +tr743: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st130 +tr752: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st130 +tr755: +//line plugins/parsers/influx/machine.go.rl:72 + + m.handler.SetMeasurement(m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st130 + st130: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof130 + } + st_case_130: +//line plugins/parsers/influx/machine.go:13858 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr251 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr252 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto tr250 +tr250: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st131 + st131: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof131 + } + st_case_131: +//line plugins/parsers/influx/machine.go:13891 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr254 + case 44: + goto st7 + case 61: + goto tr255 + case 92: + goto st163 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto st131 +tr251: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st422 +tr254: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st422 + st422: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof422 + } + st_case_422: +//line plugins/parsers/influx/machine.go:13934 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st423 + case 13: + goto tr330 + case 32: + goto st192 + case 44: + goto st9 + case 61: + goto tr163 + case 92: + goto st114 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st192 + } + goto st83 + st423: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof423 + } + st_case_423: + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st423 + case 13: + goto tr330 + case 32: + goto st192 + case 44: + goto tr201 + case 45: + goto tr606 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr607 + } + case ( m.data)[( m.p)] >= 9: + goto st192 + } + goto st83 +tr606: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st132 + st132: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof132 + } + st_case_132: +//line plugins/parsers/influx/machine.go:13998 + switch ( m.data)[( m.p)] { + case 32: + goto tr201 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] < 12: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 10 { + goto tr201 + } + case ( m.data)[( m.p)] > 13: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st424 + } + default: + goto tr201 + } + goto st83 +tr607: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st424 + st424: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof424 + } + st_case_424: +//line plugins/parsers/influx/machine.go:14033 + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st426 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 +tr608: +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st425 + st425: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof425 + } + st_case_425: +//line plugins/parsers/influx/machine.go:14070 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto st425 + case 13: + goto tr330 + case 32: + goto st195 + case 44: + goto tr59 + case 61: + goto tr163 + case 92: + goto st114 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st195 + } + goto st83 + st426: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof426 + } + st_case_426: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st427 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st427: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof427 + } + st_case_427: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st428 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st428: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof428 + } + st_case_428: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st429 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st429: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof429 + } + st_case_429: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st430 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st430: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof430 + } + st_case_430: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st431 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st431: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof431 + } + st_case_431: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st432 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st432: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof432 + } + st_case_432: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st433 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st433: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof433 + } + st_case_433: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st434 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st434: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof434 + } + st_case_434: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st435 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st435: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof435 + } + st_case_435: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st436 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st436: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof436 + } + st_case_436: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st437 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st437: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof437 + } + st_case_437: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st438 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st438: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof438 + } + st_case_438: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st439 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st439: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof439 + } + st_case_439: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st440 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st440: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof440 + } + st_case_440: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st441 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st441: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof441 + } + st_case_441: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st442 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st442: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof442 + } + st_case_442: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st443 + } + case ( m.data)[( m.p)] >= 9: + goto tr334 + } + goto st83 + st443: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof443 + } + st_case_443: + switch ( m.data)[( m.p)] { + case 10: + goto tr335 + case 11: + goto tr608 + case 13: + goto tr335 + case 32: + goto tr334 + case 44: + goto tr201 + case 61: + goto tr163 + case 92: + goto st114 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr334 + } + goto st83 +tr255: +//line plugins/parsers/influx/machine.go.rl:76 + + key = m.text() + +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st133 + st133: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof133 + } + st_case_133: +//line plugins/parsers/influx/machine.go:14641 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr258 + case 44: + goto st7 + case 45: + goto tr259 + case 46: + goto tr260 + case 48: + goto tr261 + case 61: + goto st7 + case 70: + goto tr263 + case 84: + goto tr264 + case 92: + goto tr227 + case 102: + goto tr265 + case 116: + goto tr266 + } + switch { + case ( m.data)[( m.p)] < 12: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 10 { + goto st7 + } + case ( m.data)[( m.p)] > 13: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr262 + } + default: + goto st7 + } + goto tr226 +tr258: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st444 + st444: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof444 + } + st_case_444: +//line plugins/parsers/influx/machine.go:14696 + switch ( m.data)[( m.p)] { + case 10: + goto tr395 + case 11: + goto tr629 + case 13: + goto tr395 + case 32: + goto tr628 + case 34: + goto tr177 + case 44: + goto tr630 + case 61: + goto tr25 + case 92: + goto tr179 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr628 + } + goto tr174 +tr655: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st445 +tr628: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st445 +tr683: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st445 +tr689: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st445 +tr692: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st445 + st445: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof445 + } + st_case_445: +//line plugins/parsers/influx/machine.go:14770 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr632 + case 13: + goto tr398 + case 32: + goto st445 + case 34: + goto tr93 + case 44: + goto st7 + case 45: + goto tr633 + case 61: + goto st7 + case 92: + goto tr189 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr634 + } + case ( m.data)[( m.p)] >= 9: + goto st445 + } + goto tr186 +tr632: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st446 + st446: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof446 + } + st_case_446: +//line plugins/parsers/influx/machine.go:14811 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr632 + case 13: + goto tr398 + case 32: + goto st445 + case 34: + goto tr93 + case 44: + goto st7 + case 45: + goto tr633 + case 61: + goto tr191 + case 92: + goto tr189 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr634 + } + case ( m.data)[( m.p)] >= 9: + goto st445 + } + goto tr186 +tr633: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st134 + st134: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof134 + } + st_case_134: +//line plugins/parsers/influx/machine.go:14852 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] < 12: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 10 { + goto st7 + } + case ( m.data)[( m.p)] > 13: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st447 + } + default: + goto st7 + } + goto st88 +tr634: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st447 + st447: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof447 + } + st_case_447: +//line plugins/parsers/influx/machine.go:14889 + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st449 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 +tr635: +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st448 + st448: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof448 + } + st_case_448: +//line plugins/parsers/influx/machine.go:14928 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto st448 + case 13: + goto tr398 + case 32: + goto st250 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st250 + } + goto st88 + st449: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof449 + } + st_case_449: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st450 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st450: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof450 + } + st_case_450: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st451 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st451: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof451 + } + st_case_451: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st452 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st452: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof452 + } + st_case_452: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st453 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st453: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof453 + } + st_case_453: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st454 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st454: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof454 + } + st_case_454: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st455 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st455: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof455 + } + st_case_455: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st456 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st456: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof456 + } + st_case_456: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st457 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st457: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof457 + } + st_case_457: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st458 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st458: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof458 + } + st_case_458: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st459 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st459: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof459 + } + st_case_459: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st460 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st460: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof460 + } + st_case_460: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st461 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st461: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof461 + } + st_case_461: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st462 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st462: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof462 + } + st_case_462: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st463 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st463: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof463 + } + st_case_463: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st464 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st464: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof464 + } + st_case_464: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st465 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st465: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof465 + } + st_case_465: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st466 + } + case ( m.data)[( m.p)] >= 9: + goto tr401 + } + goto st88 + st466: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof466 + } + st_case_466: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr635 + case 13: + goto tr402 + case 32: + goto tr401 + case 34: + goto tr96 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto st90 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr401 + } + goto st88 +tr629: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st467 +tr684: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st467 +tr690: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st467 +tr693: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st467 + st467: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof467 + } + st_case_467: +//line plugins/parsers/influx/machine.go:15567 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr656 + case 13: + goto tr398 + case 32: + goto tr655 + case 34: + goto tr195 + case 44: + goto tr184 + case 45: + goto tr657 + case 61: + goto st7 + case 92: + goto tr196 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr658 + } + case ( m.data)[( m.p)] >= 9: + goto tr655 + } + goto tr193 +tr656: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st468 + st468: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof468 + } + st_case_468: +//line plugins/parsers/influx/machine.go:15612 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr656 + case 13: + goto tr398 + case 32: + goto tr655 + case 34: + goto tr195 + case 44: + goto tr184 + case 45: + goto tr657 + case 61: + goto tr191 + case 92: + goto tr196 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr658 + } + case ( m.data)[( m.p)] >= 9: + goto tr655 + } + goto tr193 +tr657: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st135 + st135: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof135 + } + st_case_135: +//line plugins/parsers/influx/machine.go:15653 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr198 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st469 + } + case ( m.data)[( m.p)] >= 9: + goto tr181 + } + goto st93 +tr658: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st469 + st469: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof469 + } + st_case_469: +//line plugins/parsers/influx/machine.go:15692 + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st473 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 +tr664: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + + goto st470 +tr659: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st470 + st470: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof470 + } + st_case_470: +//line plugins/parsers/influx/machine.go:15741 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr663 + case 13: + goto tr398 + case 32: + goto st470 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr189 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st470 + } + goto tr186 +tr663: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st471 + st471: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof471 + } + st_case_471: +//line plugins/parsers/influx/machine.go:15775 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr663 + case 13: + goto tr398 + case 32: + goto st470 + case 34: + goto tr93 + case 44: + goto st7 + case 61: + goto tr191 + case 92: + goto tr189 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto st470 + } + goto tr186 +tr665: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st472 +tr660: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st472 + st472: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof472 + } + st_case_472: +//line plugins/parsers/influx/machine.go:15823 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr665 + case 13: + goto tr398 + case 32: + goto tr664 + case 34: + goto tr195 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto tr196 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr664 + } + goto tr193 + st473: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof473 + } + st_case_473: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st474 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st474: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof474 + } + st_case_474: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st475 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st475: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof475 + } + st_case_475: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st476 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st476: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof476 + } + st_case_476: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st477 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st477: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof477 + } + st_case_477: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st478 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st478: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof478 + } + st_case_478: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st479 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st479: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof479 + } + st_case_479: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st480 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st480: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof480 + } + st_case_480: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st481 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st481: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof481 + } + st_case_481: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st482 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st482: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof482 + } + st_case_482: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st483 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st483: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof483 + } + st_case_483: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st484 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st484: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof484 + } + st_case_484: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st485 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st485: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof485 + } + st_case_485: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st486 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st486: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof486 + } + st_case_486: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st487 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st487: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof487 + } + st_case_487: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st488 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st488: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof488 + } + st_case_488: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st489 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st489: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof489 + } + st_case_489: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st490 + } + case ( m.data)[( m.p)] >= 9: + goto tr659 + } + goto st93 + st490: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof490 + } + st_case_490: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr660 + case 13: + goto tr402 + case 32: + goto tr659 + case 34: + goto tr199 + case 44: + goto tr184 + case 61: + goto tr191 + case 92: + goto st102 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr659 + } + goto st93 +tr630: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st136 +tr685: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st136 +tr691: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st136 +tr694: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st136 + st136: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof136 + } + st_case_136: +//line plugins/parsers/influx/machine.go:16462 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr251 + case 44: + goto st7 + case 61: + goto st7 + case 92: + goto tr270 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto tr269 +tr269: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st137 + st137: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof137 + } + st_case_137: +//line plugins/parsers/influx/machine.go:16495 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr254 + case 44: + goto st7 + case 61: + goto tr272 + case 92: + goto st150 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st7 + } + case ( m.data)[( m.p)] >= 9: + goto st7 + } + goto st137 +tr272: +//line plugins/parsers/influx/machine.go.rl:76 + + key = m.text() + +//line plugins/parsers/influx/machine.go.rl:84 + + key = m.text() + + goto st138 + st138: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof138 + } + st_case_138: +//line plugins/parsers/influx/machine.go:16532 + switch ( m.data)[( m.p)] { + case 32: + goto st7 + case 34: + goto tr258 + case 44: + goto st7 + case 45: + goto tr274 + case 46: + goto tr275 + case 48: + goto tr276 + case 61: + goto st7 + case 70: + goto tr278 + case 84: + goto tr279 + case 92: + goto tr179 + case 102: + goto tr280 + case 116: + goto tr281 + } + switch { + case ( m.data)[( m.p)] < 12: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 10 { + goto st7 + } + case ( m.data)[( m.p)] > 13: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr277 + } + default: + goto st7 + } + goto tr174 +tr274: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st139 + st139: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof139 + } + st_case_139: +//line plugins/parsers/influx/machine.go:16583 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 48: + goto st491 + case 61: + goto st7 + case 92: + goto st100 + } + switch { + case ( m.data)[( m.p)] > 12: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st496 + } + case ( m.data)[( m.p)] >= 9: + goto tr181 + } + goto st86 +tr276: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st491 + st491: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof491 + } + st_case_491: +//line plugins/parsers/influx/machine.go:16624 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr684 + case 13: + goto tr424 + case 32: + goto tr683 + case 34: + goto tr183 + case 44: + goto tr685 + case 46: + goto st492 + case 61: + goto st7 + case 69: + goto st140 + case 92: + goto st100 + case 101: + goto st140 + case 105: + goto st495 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr683 + } + goto st86 +tr275: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st492 + st492: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof492 + } + st_case_492: +//line plugins/parsers/influx/machine.go:16666 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr684 + case 13: + goto tr424 + case 32: + goto tr683 + case 34: + goto tr183 + case 44: + goto tr685 + case 61: + goto st7 + case 69: + goto st140 + case 92: + goto st100 + case 101: + goto st140 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st492 + } + case ( m.data)[( m.p)] >= 9: + goto tr683 + } + goto st86 + st140: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof140 + } + st_case_140: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr284 + case 44: + goto tr184 + case 61: + goto st7 + case 92: + goto st100 + } + switch { + case ( m.data)[( m.p)] < 43: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + case ( m.data)[( m.p)] > 45: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st494 + } + default: + goto st141 + } + goto st86 +tr284: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st493 + st493: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof493 + } + st_case_493: +//line plugins/parsers/influx/machine.go:16745 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr532 + case 13: + goto tr330 + case 32: + goto tr481 + case 44: + goto tr483 + case 61: + goto tr201 + case 92: + goto st35 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st365 + } + case ( m.data)[( m.p)] >= 9: + goto tr481 + } + goto st30 + st141: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof141 + } + st_case_141: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 92: + goto st100 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st494 + } + case ( m.data)[( m.p)] >= 9: + goto tr181 + } + goto st86 + st494: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof494 + } + st_case_494: + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr684 + case 13: + goto tr424 + case 32: + goto tr683 + case 34: + goto tr183 + case 44: + goto tr685 + case 61: + goto st7 + case 92: + goto st100 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st494 + } + case ( m.data)[( m.p)] >= 9: + goto tr683 + } + goto st86 + st495: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof495 + } + st_case_495: + switch ( m.data)[( m.p)] { + case 10: + goto tr430 + case 11: + goto tr690 + case 13: + goto tr430 + case 32: + goto tr689 + case 34: + goto tr183 + case 44: + goto tr691 + case 61: + goto st7 + case 92: + goto st100 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr689 + } + goto st86 +tr277: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st496 + st496: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof496 + } + st_case_496: +//line plugins/parsers/influx/machine.go:16873 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr684 + case 13: + goto tr424 + case 32: + goto tr683 + case 34: + goto tr183 + case 44: + goto tr685 + case 46: + goto st492 + case 61: + goto st7 + case 69: + goto st140 + case 92: + goto st100 + case 101: + goto st140 + case 105: + goto st495 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st496 + } + case ( m.data)[( m.p)] >= 9: + goto tr683 + } + goto st86 +tr278: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st497 + st497: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof497 + } + st_case_497: +//line plugins/parsers/influx/machine.go:16920 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr693 + case 13: + goto tr433 + case 32: + goto tr692 + case 34: + goto tr183 + case 44: + goto tr694 + case 61: + goto st7 + case 65: + goto st142 + case 92: + goto st100 + case 97: + goto st145 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr692 + } + goto st86 + st142: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof142 + } + st_case_142: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 76: + goto st143 + case 92: + goto st100 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 + st143: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof143 + } + st_case_143: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 83: + goto st144 + case 92: + goto st100 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 + st144: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof144 + } + st_case_144: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 69: + goto st498 + case 92: + goto st100 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 + st498: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof498 + } + st_case_498: + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr693 + case 13: + goto tr433 + case 32: + goto tr692 + case 34: + goto tr183 + case 44: + goto tr694 + case 61: + goto st7 + case 92: + goto st100 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr692 + } + goto st86 + st145: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof145 + } + st_case_145: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 92: + goto st100 + case 108: + goto st146 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 + st146: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof146 + } + st_case_146: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 92: + goto st100 + case 115: + goto st147 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 + st147: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof147 + } + st_case_147: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 92: + goto st100 + case 101: + goto st498 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 +tr279: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st499 + st499: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof499 + } + st_case_499: +//line plugins/parsers/influx/machine.go:17159 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr693 + case 13: + goto tr433 + case 32: + goto tr692 + case 34: + goto tr183 + case 44: + goto tr694 + case 61: + goto st7 + case 82: + goto st148 + case 92: + goto st100 + case 114: + goto st149 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr692 + } + goto st86 + st148: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof148 + } + st_case_148: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 85: + goto st144 + case 92: + goto st100 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 + st149: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof149 + } + st_case_149: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr182 + case 13: + goto st7 + case 32: + goto tr181 + case 34: + goto tr183 + case 44: + goto tr184 + case 61: + goto st7 + case 92: + goto st100 + case 117: + goto st147 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr181 + } + goto st86 +tr280: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st500 + st500: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof500 + } + st_case_500: +//line plugins/parsers/influx/machine.go:17255 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr693 + case 13: + goto tr433 + case 32: + goto tr692 + case 34: + goto tr183 + case 44: + goto tr694 + case 61: + goto st7 + case 92: + goto st100 + case 97: + goto st145 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr692 + } + goto st86 +tr281: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st501 + st501: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof501 + } + st_case_501: +//line plugins/parsers/influx/machine.go:17291 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr693 + case 13: + goto tr433 + case 32: + goto tr692 + case 34: + goto tr183 + case 44: + goto tr694 + case 61: + goto st7 + case 92: + goto st100 + case 114: + goto st149 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr692 + } + goto st86 +tr270: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st150 + st150: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof150 + } + st_case_150: +//line plugins/parsers/influx/machine.go:17327 + switch ( m.data)[( m.p)] { + case 34: + goto st137 + case 92: + goto st137 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st83 +tr259: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st151 + st151: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof151 + } + st_case_151: +//line plugins/parsers/influx/machine.go:17354 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 48: + goto st502 + case 61: + goto st7 + case 92: + goto st123 + } + switch { + case ( m.data)[( m.p)] > 12: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st528 + } + case ( m.data)[( m.p)] >= 9: + goto tr229 + } + goto st118 +tr261: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st502 + st502: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof502 + } + st_case_502: +//line plugins/parsers/influx/machine.go:17395 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr700 + case 13: + goto tr424 + case 32: + goto tr699 + case 34: + goto tr183 + case 44: + goto tr701 + case 46: + goto st525 + case 61: + goto st7 + case 69: + goto st153 + case 92: + goto st123 + case 101: + goto st153 + case 105: + goto st527 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr699 + } + goto st118 +tr700: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + + goto st503 +tr732: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + + goto st503 +tr735: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + + goto st503 + st503: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof503 + } + st_case_503: +//line plugins/parsers/influx/machine.go:17461 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr706 + case 13: + goto tr398 + case 32: + goto tr705 + case 34: + goto tr195 + case 44: + goto tr231 + case 45: + goto tr707 + case 61: + goto st7 + case 92: + goto tr235 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr708 + } + case ( m.data)[( m.p)] >= 9: + goto tr705 + } + goto tr233 +tr706: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st504 + st504: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof504 + } + st_case_504: +//line plugins/parsers/influx/machine.go:17506 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr706 + case 13: + goto tr398 + case 32: + goto tr705 + case 34: + goto tr195 + case 44: + goto tr231 + case 45: + goto tr707 + case 61: + goto tr97 + case 92: + goto tr235 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto tr708 + } + case ( m.data)[( m.p)] >= 9: + goto tr705 + } + goto tr233 +tr707: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st152 + st152: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof152 + } + st_case_152: +//line plugins/parsers/influx/machine.go:17547 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr237 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st505 + } + case ( m.data)[( m.p)] >= 9: + goto tr229 + } + goto st120 +tr708: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st505 + st505: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof505 + } + st_case_505: +//line plugins/parsers/influx/machine.go:17586 + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st507 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 +tr713: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st506 +tr710: +//line plugins/parsers/influx/machine.go.rl:80 + + m.handler.AddTag(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + + goto st506 + st506: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof506 + } + st_case_506: +//line plugins/parsers/influx/machine.go:17639 + switch ( m.data)[( m.p)] { + case 10: + goto tr398 + case 11: + goto tr713 + case 13: + goto tr398 + case 32: + goto tr712 + case 34: + goto tr195 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto tr235 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr712 + } + goto tr233 + st507: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof507 + } + st_case_507: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st508 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st508: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof508 + } + st_case_508: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st509 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st509: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof509 + } + st_case_509: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st510 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st510: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof510 + } + st_case_510: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st511 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st511: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof511 + } + st_case_511: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st512 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st512: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof512 + } + st_case_512: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st513 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st513: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof513 + } + st_case_513: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st514 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st514: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof514 + } + st_case_514: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st515 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st515: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof515 + } + st_case_515: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st516 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st516: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof516 + } + st_case_516: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st517 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st517: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof517 + } + st_case_517: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st518 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st518: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof518 + } + st_case_518: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st519 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st519: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof519 + } + st_case_519: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st520 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st520: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof520 + } + st_case_520: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st521 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st521: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof521 + } + st_case_521: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st522 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st522: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof522 + } + st_case_522: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st523 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st523: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof523 + } + st_case_523: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st524 + } + case ( m.data)[( m.p)] >= 9: + goto tr709 + } + goto st120 + st524: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof524 + } + st_case_524: + switch ( m.data)[( m.p)] { + case 10: + goto tr402 + case 11: + goto tr710 + case 13: + goto tr402 + case 32: + goto tr709 + case 34: + goto tr199 + case 44: + goto tr231 + case 61: + goto tr97 + case 92: + goto st122 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr709 + } + goto st120 +tr260: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st525 + st525: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof525 + } + st_case_525: +//line plugins/parsers/influx/machine.go:18244 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr700 + case 13: + goto tr424 + case 32: + goto tr699 + case 34: + goto tr183 + case 44: + goto tr701 + case 61: + goto st7 + case 69: + goto st153 + case 92: + goto st123 + case 101: + goto st153 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st525 + } + case ( m.data)[( m.p)] >= 9: + goto tr699 + } + goto st118 + st153: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof153 + } + st_case_153: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr284 + case 44: + goto tr231 + case 61: + goto st7 + case 92: + goto st123 + } + switch { + case ( m.data)[( m.p)] < 43: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + case ( m.data)[( m.p)] > 45: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st526 + } + default: + goto st154 + } + goto st118 + st154: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof154 + } + st_case_154: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 92: + goto st123 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st526 + } + case ( m.data)[( m.p)] >= 9: + goto tr229 + } + goto st118 + st526: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof526 + } + st_case_526: + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr700 + case 13: + goto tr424 + case 32: + goto tr699 + case 34: + goto tr183 + case 44: + goto tr701 + case 61: + goto st7 + case 92: + goto st123 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st526 + } + case ( m.data)[( m.p)] >= 9: + goto tr699 + } + goto st118 + st527: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof527 + } + st_case_527: + switch ( m.data)[( m.p)] { + case 10: + goto tr430 + case 11: + goto tr732 + case 13: + goto tr430 + case 32: + goto tr731 + case 34: + goto tr183 + case 44: + goto tr733 + case 61: + goto st7 + case 92: + goto st123 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr731 + } + goto st118 +tr262: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st528 + st528: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof528 + } + st_case_528: +//line plugins/parsers/influx/machine.go:18414 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr700 + case 13: + goto tr424 + case 32: + goto tr699 + case 34: + goto tr183 + case 44: + goto tr701 + case 46: + goto st525 + case 61: + goto st7 + case 69: + goto st153 + case 92: + goto st123 + case 101: + goto st153 + case 105: + goto st527 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st528 + } + case ( m.data)[( m.p)] >= 9: + goto tr699 + } + goto st118 +tr263: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st529 + st529: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof529 + } + st_case_529: +//line plugins/parsers/influx/machine.go:18461 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr735 + case 13: + goto tr433 + case 32: + goto tr734 + case 34: + goto tr183 + case 44: + goto tr736 + case 61: + goto st7 + case 65: + goto st155 + case 92: + goto st123 + case 97: + goto st158 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr734 + } + goto st118 + st155: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof155 + } + st_case_155: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 76: + goto st156 + case 92: + goto st123 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 + st156: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof156 + } + st_case_156: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 83: + goto st157 + case 92: + goto st123 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 + st157: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof157 + } + st_case_157: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 69: + goto st530 + case 92: + goto st123 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 + st530: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof530 + } + st_case_530: + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr735 + case 13: + goto tr433 + case 32: + goto tr734 + case 34: + goto tr183 + case 44: + goto tr736 + case 61: + goto st7 + case 92: + goto st123 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr734 + } + goto st118 + st158: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof158 + } + st_case_158: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 92: + goto st123 + case 108: + goto st159 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 + st159: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof159 + } + st_case_159: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 92: + goto st123 + case 115: + goto st160 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 + st160: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof160 + } + st_case_160: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 92: + goto st123 + case 101: + goto st530 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 +tr264: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st531 + st531: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof531 + } + st_case_531: +//line plugins/parsers/influx/machine.go:18700 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr735 + case 13: + goto tr433 + case 32: + goto tr734 + case 34: + goto tr183 + case 44: + goto tr736 + case 61: + goto st7 + case 82: + goto st161 + case 92: + goto st123 + case 114: + goto st162 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr734 + } + goto st118 + st161: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof161 + } + st_case_161: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 85: + goto st157 + case 92: + goto st123 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 + st162: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof162 + } + st_case_162: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr230 + case 13: + goto st7 + case 32: + goto tr229 + case 34: + goto tr183 + case 44: + goto tr231 + case 61: + goto st7 + case 92: + goto st123 + case 117: + goto st160 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr229 + } + goto st118 +tr265: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st532 + st532: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof532 + } + st_case_532: +//line plugins/parsers/influx/machine.go:18796 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr735 + case 13: + goto tr433 + case 32: + goto tr734 + case 34: + goto tr183 + case 44: + goto tr736 + case 61: + goto st7 + case 92: + goto st123 + case 97: + goto st158 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr734 + } + goto st118 +tr266: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st533 + st533: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof533 + } + st_case_533: +//line plugins/parsers/influx/machine.go:18832 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr735 + case 13: + goto tr433 + case 32: + goto tr734 + case 34: + goto tr183 + case 44: + goto tr736 + case 61: + goto st7 + case 92: + goto st123 + case 114: + goto st162 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr734 + } + goto st118 +tr252: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st163 + st163: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof163 + } + st_case_163: +//line plugins/parsers/influx/machine.go:18868 + switch ( m.data)[( m.p)] { + case 34: + goto st131 + case 92: + goto st131 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr59 + } + case ( m.data)[( m.p)] >= 9: + goto tr59 + } + goto st83 +tr83: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st164 + st164: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof164 + } + st_case_164: +//line plugins/parsers/influx/machine.go:18895 + switch ( m.data)[( m.p)] { + case 34: + goto st39 + case 92: + goto st39 + } + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto tr5 + } + case ( m.data)[( m.p)] >= 9: + goto tr5 + } + goto st2 +tr240: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st165 + st165: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof165 + } + st_case_165: +//line plugins/parsers/influx/machine.go:18922 + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 48: + goto st534 + case 92: + goto st164 + } + switch { + case ( m.data)[( m.p)] > 12: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st540 + } + case ( m.data)[( m.p)] >= 9: + goto tr85 + } + goto st39 +tr242: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st534 + st534: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof534 + } + st_case_534: +//line plugins/parsers/influx/machine.go:18961 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr742 + case 13: + goto tr424 + case 32: + goto tr741 + case 34: + goto tr87 + case 44: + goto tr743 + case 46: + goto st535 + case 69: + goto st166 + case 92: + goto st164 + case 101: + goto st166 + case 105: + goto st539 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr741 + } + goto st39 +tr241: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st535 + st535: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof535 + } + st_case_535: +//line plugins/parsers/influx/machine.go:19001 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr742 + case 13: + goto tr424 + case 32: + goto tr741 + case 34: + goto tr87 + case 44: + goto tr743 + case 69: + goto st166 + case 92: + goto st164 + case 101: + goto st166 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st535 + } + case ( m.data)[( m.p)] >= 9: + goto tr741 + } + goto st39 + st166: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof166 + } + st_case_166: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr304 + case 44: + goto tr88 + case 92: + goto st164 + } + switch { + case ( m.data)[( m.p)] < 43: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + case ( m.data)[( m.p)] > 45: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st538 + } + default: + goto st167 + } + goto st39 +tr304: +//line plugins/parsers/influx/machine.go.rl:100 + + m.handler.AddString(key, m.text()) + + goto st536 + st536: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof536 + } + st_case_536: +//line plugins/parsers/influx/machine.go:19076 + switch ( m.data)[( m.p)] { + case 10: + goto tr330 + case 11: + goto tr604 + case 13: + goto tr330 + case 32: + goto tr449 + case 44: + goto tr451 + case 92: + goto st129 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st537 + } + case ( m.data)[( m.p)] >= 9: + goto tr449 + } + goto st2 + st537: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof537 + } + st_case_537: + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 11: + goto tr748 + case 13: + goto tr356 + case 32: + goto tr747 + case 44: + goto tr749 + case 92: + goto st129 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st537 + } + case ( m.data)[( m.p)] >= 9: + goto tr747 + } + goto st2 + st167: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof167 + } + st_case_167: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 92: + goto st164 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st538 + } + case ( m.data)[( m.p)] >= 9: + goto tr85 + } + goto st39 + st538: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof538 + } + st_case_538: + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr742 + case 13: + goto tr424 + case 32: + goto tr741 + case 34: + goto tr87 + case 44: + goto tr743 + case 92: + goto st164 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st538 + } + case ( m.data)[( m.p)] >= 9: + goto tr741 + } + goto st39 + st539: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof539 + } + st_case_539: + switch ( m.data)[( m.p)] { + case 10: + goto tr430 + case 11: + goto tr751 + case 13: + goto tr430 + case 32: + goto tr750 + case 34: + goto tr87 + case 44: + goto tr752 + case 92: + goto st164 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr750 + } + goto st39 +tr243: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st540 + st540: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof540 + } + st_case_540: +//line plugins/parsers/influx/machine.go:19224 + switch ( m.data)[( m.p)] { + case 10: + goto tr424 + case 11: + goto tr742 + case 13: + goto tr424 + case 32: + goto tr741 + case 34: + goto tr87 + case 44: + goto tr743 + case 46: + goto st535 + case 69: + goto st166 + case 92: + goto st164 + case 101: + goto st166 + case 105: + goto st539 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st540 + } + case ( m.data)[( m.p)] >= 9: + goto tr741 + } + goto st39 +tr244: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st541 + st541: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof541 + } + st_case_541: +//line plugins/parsers/influx/machine.go:19269 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr754 + case 13: + goto tr433 + case 32: + goto tr753 + case 34: + goto tr87 + case 44: + goto tr755 + case 65: + goto st168 + case 92: + goto st164 + case 97: + goto st171 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr753 + } + goto st39 + st168: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof168 + } + st_case_168: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 76: + goto st169 + case 92: + goto st164 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 + st169: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof169 + } + st_case_169: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 83: + goto st170 + case 92: + goto st164 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 + st170: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof170 + } + st_case_170: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 69: + goto st542 + case 92: + goto st164 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 + st542: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof542 + } + st_case_542: + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr754 + case 13: + goto tr433 + case 32: + goto tr753 + case 34: + goto tr87 + case 44: + goto tr755 + case 92: + goto st164 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr753 + } + goto st39 + st171: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof171 + } + st_case_171: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 92: + goto st164 + case 108: + goto st172 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 + st172: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof172 + } + st_case_172: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 92: + goto st164 + case 115: + goto st173 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 + st173: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof173 + } + st_case_173: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 92: + goto st164 + case 101: + goto st542 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 +tr245: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st543 + st543: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof543 + } + st_case_543: +//line plugins/parsers/influx/machine.go:19492 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr754 + case 13: + goto tr433 + case 32: + goto tr753 + case 34: + goto tr87 + case 44: + goto tr755 + case 82: + goto st174 + case 92: + goto st164 + case 114: + goto st175 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr753 + } + goto st39 + st174: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof174 + } + st_case_174: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 85: + goto st170 + case 92: + goto st164 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 + st175: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof175 + } + st_case_175: + switch ( m.data)[( m.p)] { + case 10: + goto st7 + case 11: + goto tr86 + case 13: + goto st7 + case 32: + goto tr85 + case 34: + goto tr87 + case 44: + goto tr88 + case 92: + goto st164 + case 117: + goto st173 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr85 + } + goto st39 +tr246: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st544 + st544: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof544 + } + st_case_544: +//line plugins/parsers/influx/machine.go:19582 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr754 + case 13: + goto tr433 + case 32: + goto tr753 + case 34: + goto tr87 + case 44: + goto tr755 + case 92: + goto st164 + case 97: + goto st171 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr753 + } + goto st39 +tr247: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st545 + st545: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof545 + } + st_case_545: +//line plugins/parsers/influx/machine.go:19616 + switch ( m.data)[( m.p)] { + case 10: + goto tr433 + case 11: + goto tr754 + case 13: + goto tr433 + case 32: + goto tr753 + case 34: + goto tr87 + case 44: + goto tr755 + case 92: + goto st164 + case 114: + goto st175 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr753 + } + goto st39 +tr70: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st176 + st176: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof176 + } + st_case_176: +//line plugins/parsers/influx/machine.go:19650 + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 48: + goto st546 + case 92: + goto st129 + } + switch { + case ( m.data)[( m.p)] > 12: + if 49 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st549 + } + case ( m.data)[( m.p)] >= 9: + goto tr4 + } + goto st2 +tr72: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st546 + st546: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof546 + } + st_case_546: +//line plugins/parsers/influx/machine.go:19687 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 11: + goto tr748 + case 13: + goto tr356 + case 32: + goto tr747 + case 44: + goto tr749 + case 46: + goto st547 + case 69: + goto st177 + case 92: + goto st129 + case 101: + goto st177 + case 105: + goto st548 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr747 + } + goto st2 +tr71: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st547 + st547: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof547 + } + st_case_547: +//line plugins/parsers/influx/machine.go:19725 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 11: + goto tr748 + case 13: + goto tr356 + case 32: + goto tr747 + case 44: + goto tr749 + case 69: + goto st177 + case 92: + goto st129 + case 101: + goto st177 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st547 + } + case ( m.data)[( m.p)] >= 9: + goto tr747 + } + goto st2 + st177: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof177 + } + st_case_177: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 34: + goto st178 + case 44: + goto tr7 + case 92: + goto st129 + } + switch { + case ( m.data)[( m.p)] < 43: + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + case ( m.data)[( m.p)] > 45: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st537 + } + default: + goto st178 + } + goto st2 + st178: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof178 + } + st_case_178: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 92: + goto st129 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st537 + } + case ( m.data)[( m.p)] >= 9: + goto tr4 + } + goto st2 + st548: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof548 + } + st_case_548: + switch ( m.data)[( m.p)] { + case 10: + goto tr362 + case 11: + goto tr764 + case 13: + goto tr362 + case 32: + goto tr763 + case 44: + goto tr765 + case 92: + goto st129 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr763 + } + goto st2 +tr73: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st549 + st549: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof549 + } + st_case_549: +//line plugins/parsers/influx/machine.go:19849 + switch ( m.data)[( m.p)] { + case 10: + goto tr356 + case 11: + goto tr748 + case 13: + goto tr356 + case 32: + goto tr747 + case 44: + goto tr749 + case 46: + goto st547 + case 69: + goto st177 + case 92: + goto st129 + case 101: + goto st177 + case 105: + goto st548 + } + switch { + case ( m.data)[( m.p)] > 12: + if 48 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 57 { + goto st549 + } + case ( m.data)[( m.p)] >= 9: + goto tr747 + } + goto st2 +tr74: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st550 + st550: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof550 + } + st_case_550: +//line plugins/parsers/influx/machine.go:19892 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr767 + case 13: + goto tr365 + case 32: + goto tr766 + case 44: + goto tr768 + case 65: + goto st179 + case 92: + goto st129 + case 97: + goto st182 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr766 + } + goto st2 + st179: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof179 + } + st_case_179: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 76: + goto st180 + case 92: + goto st129 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 + st180: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof180 + } + st_case_180: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 83: + goto st181 + case 92: + goto st129 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 + st181: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof181 + } + st_case_181: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 69: + goto st551 + case 92: + goto st129 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 + st551: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof551 + } + st_case_551: + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr767 + case 13: + goto tr365 + case 32: + goto tr766 + case 44: + goto tr768 + case 92: + goto st129 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr766 + } + goto st2 + st182: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof182 + } + st_case_182: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 92: + goto st129 + case 108: + goto st183 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 + st183: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof183 + } + st_case_183: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 92: + goto st129 + case 115: + goto st184 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 + st184: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof184 + } + st_case_184: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 92: + goto st129 + case 101: + goto st551 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 +tr75: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st552 + st552: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof552 + } + st_case_552: +//line plugins/parsers/influx/machine.go:20099 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr767 + case 13: + goto tr365 + case 32: + goto tr766 + case 44: + goto tr768 + case 82: + goto st185 + case 92: + goto st129 + case 114: + goto st186 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr766 + } + goto st2 + st185: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof185 + } + st_case_185: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 85: + goto st181 + case 92: + goto st129 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 + st186: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof186 + } + st_case_186: + switch ( m.data)[( m.p)] { + case 10: + goto tr5 + case 11: + goto tr6 + case 13: + goto tr5 + case 32: + goto tr4 + case 44: + goto tr7 + case 92: + goto st129 + case 117: + goto st184 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr4 + } + goto st2 +tr76: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st553 + st553: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof553 + } + st_case_553: +//line plugins/parsers/influx/machine.go:20183 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr767 + case 13: + goto tr365 + case 32: + goto tr766 + case 44: + goto tr768 + case 92: + goto st129 + case 97: + goto st182 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr766 + } + goto st2 +tr77: +//line plugins/parsers/influx/machine.go.rl:18 + + m.pb = m.p + + goto st554 + st554: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof554 + } + st_case_554: +//line plugins/parsers/influx/machine.go:20215 + switch ( m.data)[( m.p)] { + case 10: + goto tr365 + case 11: + goto tr767 + case 13: + goto tr365 + case 32: + goto tr766 + case 44: + goto tr768 + case 92: + goto st129 + case 114: + goto st186 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 12 { + goto tr766 + } + goto st2 + st187: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof187 + } + st_case_187: + switch ( m.data)[( m.p)] { + case 10: + goto tr322 + case 13: + goto tr322 + } + goto st187 +tr322: +//line plugins/parsers/influx/machine.go.rl:68 + + {goto st188 } + + goto st555 + st555: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof555 + } + st_case_555: +//line plugins/parsers/influx/machine.go:20259 + goto st0 + st188: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof188 + } + st_case_188: + switch ( m.data)[( m.p)] { + case 11: + goto tr325 + case 32: + goto st188 + case 35: + goto st189 + case 44: + goto st0 + case 92: + goto st190 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st188 + } + goto tr323 +tr323: +//line plugins/parsers/influx/machine.go.rl:63 + + ( m.p)-- + + {goto st1 } + + goto st556 + st556: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof556 + } + st_case_556: +//line plugins/parsers/influx/machine.go:20295 + goto st0 +tr325: +//line plugins/parsers/influx/machine.go.rl:63 + + ( m.p)-- + + {goto st1 } + + goto st557 + st557: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof557 + } + st_case_557: +//line plugins/parsers/influx/machine.go:20310 + switch ( m.data)[( m.p)] { + case 11: + goto tr325 + case 32: + goto st188 + case 35: + goto st189 + case 44: + goto st0 + case 92: + goto st190 + } + if 9 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st188 + } + goto tr323 + st189: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof189 + } + st_case_189: + switch ( m.data)[( m.p)] { + case 10: + goto st188 + case 13: + goto st188 + } + goto st189 + st190: + if ( m.p)++; ( m.p) == ( m.pe) { + goto _test_eof190 + } + st_case_190: + switch { + case ( m.data)[( m.p)] > 10: + if 12 <= ( m.data)[( m.p)] && ( m.data)[( m.p)] <= 13 { + goto st0 + } + case ( m.data)[( m.p)] >= 9: + goto st0 + } + goto tr323 + st_out: + _test_eof1: m.cs = 1; goto _test_eof + _test_eof2: m.cs = 2; goto _test_eof + _test_eof3: m.cs = 3; goto _test_eof + _test_eof4: m.cs = 4; goto _test_eof + _test_eof5: m.cs = 5; goto _test_eof + _test_eof6: m.cs = 6; goto _test_eof + _test_eof7: m.cs = 7; goto _test_eof + _test_eof191: m.cs = 191; goto _test_eof + _test_eof192: m.cs = 192; goto _test_eof + _test_eof193: m.cs = 193; goto _test_eof + _test_eof8: m.cs = 8; goto _test_eof + _test_eof194: m.cs = 194; goto _test_eof + _test_eof195: m.cs = 195; goto _test_eof + _test_eof196: m.cs = 196; goto _test_eof + _test_eof197: m.cs = 197; goto _test_eof + _test_eof198: m.cs = 198; goto _test_eof + _test_eof199: m.cs = 199; goto _test_eof + _test_eof200: m.cs = 200; goto _test_eof + _test_eof201: m.cs = 201; goto _test_eof + _test_eof202: m.cs = 202; goto _test_eof + _test_eof203: m.cs = 203; goto _test_eof + _test_eof204: m.cs = 204; goto _test_eof + _test_eof205: m.cs = 205; goto _test_eof + _test_eof206: m.cs = 206; goto _test_eof + _test_eof207: m.cs = 207; goto _test_eof + _test_eof208: m.cs = 208; goto _test_eof + _test_eof209: m.cs = 209; goto _test_eof + _test_eof210: m.cs = 210; goto _test_eof + _test_eof211: m.cs = 211; goto _test_eof + _test_eof212: m.cs = 212; goto _test_eof + _test_eof213: m.cs = 213; goto _test_eof + _test_eof9: m.cs = 9; goto _test_eof + _test_eof10: m.cs = 10; goto _test_eof + _test_eof11: m.cs = 11; goto _test_eof + _test_eof12: m.cs = 12; goto _test_eof + _test_eof214: m.cs = 214; goto _test_eof + _test_eof215: m.cs = 215; goto _test_eof + _test_eof13: m.cs = 13; goto _test_eof + _test_eof14: m.cs = 14; goto _test_eof + _test_eof216: m.cs = 216; goto _test_eof + _test_eof217: m.cs = 217; goto _test_eof + _test_eof218: m.cs = 218; goto _test_eof + _test_eof219: m.cs = 219; goto _test_eof + _test_eof15: m.cs = 15; goto _test_eof + _test_eof16: m.cs = 16; goto _test_eof + _test_eof17: m.cs = 17; goto _test_eof + _test_eof220: m.cs = 220; goto _test_eof + _test_eof18: m.cs = 18; goto _test_eof + _test_eof19: m.cs = 19; goto _test_eof + _test_eof20: m.cs = 20; goto _test_eof + _test_eof221: m.cs = 221; goto _test_eof + _test_eof21: m.cs = 21; goto _test_eof + _test_eof22: m.cs = 22; goto _test_eof + _test_eof222: m.cs = 222; goto _test_eof + _test_eof223: m.cs = 223; goto _test_eof + _test_eof23: m.cs = 23; goto _test_eof + _test_eof24: m.cs = 24; goto _test_eof + _test_eof25: m.cs = 25; goto _test_eof + _test_eof26: m.cs = 26; goto _test_eof + _test_eof27: m.cs = 27; goto _test_eof + _test_eof28: m.cs = 28; goto _test_eof + _test_eof29: m.cs = 29; goto _test_eof + _test_eof30: m.cs = 30; goto _test_eof + _test_eof31: m.cs = 31; goto _test_eof + _test_eof32: m.cs = 32; goto _test_eof + _test_eof33: m.cs = 33; goto _test_eof + _test_eof34: m.cs = 34; goto _test_eof + _test_eof35: m.cs = 35; goto _test_eof + _test_eof36: m.cs = 36; goto _test_eof + _test_eof37: m.cs = 37; goto _test_eof + _test_eof38: m.cs = 38; goto _test_eof + _test_eof39: m.cs = 39; goto _test_eof + _test_eof40: m.cs = 40; goto _test_eof + _test_eof41: m.cs = 41; goto _test_eof + _test_eof224: m.cs = 224; goto _test_eof + _test_eof225: m.cs = 225; goto _test_eof + _test_eof42: m.cs = 42; goto _test_eof + _test_eof226: m.cs = 226; goto _test_eof + _test_eof227: m.cs = 227; goto _test_eof + _test_eof228: m.cs = 228; goto _test_eof + _test_eof229: m.cs = 229; goto _test_eof + _test_eof230: m.cs = 230; goto _test_eof + _test_eof231: m.cs = 231; goto _test_eof + _test_eof232: m.cs = 232; goto _test_eof + _test_eof233: m.cs = 233; goto _test_eof + _test_eof234: m.cs = 234; goto _test_eof + _test_eof235: m.cs = 235; goto _test_eof + _test_eof236: m.cs = 236; goto _test_eof + _test_eof237: m.cs = 237; goto _test_eof + _test_eof238: m.cs = 238; goto _test_eof + _test_eof239: m.cs = 239; goto _test_eof + _test_eof240: m.cs = 240; goto _test_eof + _test_eof241: m.cs = 241; goto _test_eof + _test_eof242: m.cs = 242; goto _test_eof + _test_eof243: m.cs = 243; goto _test_eof + _test_eof244: m.cs = 244; goto _test_eof + _test_eof245: m.cs = 245; goto _test_eof + _test_eof43: m.cs = 43; goto _test_eof + _test_eof246: m.cs = 246; goto _test_eof + _test_eof247: m.cs = 247; goto _test_eof + _test_eof248: m.cs = 248; goto _test_eof + _test_eof44: m.cs = 44; goto _test_eof + _test_eof249: m.cs = 249; goto _test_eof + _test_eof250: m.cs = 250; goto _test_eof + _test_eof251: m.cs = 251; goto _test_eof + _test_eof252: m.cs = 252; goto _test_eof + _test_eof253: m.cs = 253; goto _test_eof + _test_eof254: m.cs = 254; goto _test_eof + _test_eof255: m.cs = 255; goto _test_eof + _test_eof256: m.cs = 256; goto _test_eof + _test_eof257: m.cs = 257; goto _test_eof + _test_eof258: m.cs = 258; goto _test_eof + _test_eof259: m.cs = 259; goto _test_eof + _test_eof260: m.cs = 260; goto _test_eof + _test_eof261: m.cs = 261; goto _test_eof + _test_eof262: m.cs = 262; goto _test_eof + _test_eof263: m.cs = 263; goto _test_eof + _test_eof264: m.cs = 264; goto _test_eof + _test_eof265: m.cs = 265; goto _test_eof + _test_eof266: m.cs = 266; goto _test_eof + _test_eof267: m.cs = 267; goto _test_eof + _test_eof268: m.cs = 268; goto _test_eof + _test_eof45: m.cs = 45; goto _test_eof + _test_eof46: m.cs = 46; goto _test_eof + _test_eof47: m.cs = 47; goto _test_eof + _test_eof269: m.cs = 269; goto _test_eof + _test_eof48: m.cs = 48; goto _test_eof + _test_eof49: m.cs = 49; goto _test_eof + _test_eof50: m.cs = 50; goto _test_eof + _test_eof51: m.cs = 51; goto _test_eof + _test_eof270: m.cs = 270; goto _test_eof + _test_eof271: m.cs = 271; goto _test_eof + _test_eof52: m.cs = 52; goto _test_eof + _test_eof272: m.cs = 272; goto _test_eof + _test_eof53: m.cs = 53; goto _test_eof + _test_eof273: m.cs = 273; goto _test_eof + _test_eof274: m.cs = 274; goto _test_eof + _test_eof275: m.cs = 275; goto _test_eof + _test_eof276: m.cs = 276; goto _test_eof + _test_eof54: m.cs = 54; goto _test_eof + _test_eof55: m.cs = 55; goto _test_eof + _test_eof56: m.cs = 56; goto _test_eof + _test_eof277: m.cs = 277; goto _test_eof + _test_eof57: m.cs = 57; goto _test_eof + _test_eof58: m.cs = 58; goto _test_eof + _test_eof59: m.cs = 59; goto _test_eof + _test_eof278: m.cs = 278; goto _test_eof + _test_eof60: m.cs = 60; goto _test_eof + _test_eof61: m.cs = 61; goto _test_eof + _test_eof279: m.cs = 279; goto _test_eof + _test_eof280: m.cs = 280; goto _test_eof + _test_eof62: m.cs = 62; goto _test_eof + _test_eof63: m.cs = 63; goto _test_eof + _test_eof281: m.cs = 281; goto _test_eof + _test_eof282: m.cs = 282; goto _test_eof + _test_eof64: m.cs = 64; goto _test_eof + _test_eof65: m.cs = 65; goto _test_eof + _test_eof283: m.cs = 283; goto _test_eof + _test_eof284: m.cs = 284; goto _test_eof + _test_eof285: m.cs = 285; goto _test_eof + _test_eof286: m.cs = 286; goto _test_eof + _test_eof66: m.cs = 66; goto _test_eof + _test_eof67: m.cs = 67; goto _test_eof + _test_eof68: m.cs = 68; goto _test_eof + _test_eof287: m.cs = 287; goto _test_eof + _test_eof69: m.cs = 69; goto _test_eof + _test_eof70: m.cs = 70; goto _test_eof + _test_eof71: m.cs = 71; goto _test_eof + _test_eof288: m.cs = 288; goto _test_eof + _test_eof72: m.cs = 72; goto _test_eof + _test_eof73: m.cs = 73; goto _test_eof + _test_eof289: m.cs = 289; goto _test_eof + _test_eof290: m.cs = 290; goto _test_eof + _test_eof74: m.cs = 74; goto _test_eof + _test_eof75: m.cs = 75; goto _test_eof + _test_eof76: m.cs = 76; goto _test_eof + _test_eof77: m.cs = 77; goto _test_eof + _test_eof78: m.cs = 78; goto _test_eof + _test_eof79: m.cs = 79; goto _test_eof + _test_eof291: m.cs = 291; goto _test_eof + _test_eof292: m.cs = 292; goto _test_eof + _test_eof293: m.cs = 293; goto _test_eof + _test_eof294: m.cs = 294; goto _test_eof + _test_eof80: m.cs = 80; goto _test_eof + _test_eof295: m.cs = 295; goto _test_eof + _test_eof296: m.cs = 296; goto _test_eof + _test_eof297: m.cs = 297; goto _test_eof + _test_eof298: m.cs = 298; goto _test_eof + _test_eof81: m.cs = 81; goto _test_eof + _test_eof299: m.cs = 299; goto _test_eof + _test_eof300: m.cs = 300; goto _test_eof + _test_eof301: m.cs = 301; goto _test_eof + _test_eof302: m.cs = 302; goto _test_eof + _test_eof303: m.cs = 303; goto _test_eof + _test_eof304: m.cs = 304; goto _test_eof + _test_eof305: m.cs = 305; goto _test_eof + _test_eof306: m.cs = 306; goto _test_eof + _test_eof307: m.cs = 307; goto _test_eof + _test_eof308: m.cs = 308; goto _test_eof + _test_eof309: m.cs = 309; goto _test_eof + _test_eof310: m.cs = 310; goto _test_eof + _test_eof311: m.cs = 311; goto _test_eof + _test_eof312: m.cs = 312; goto _test_eof + _test_eof313: m.cs = 313; goto _test_eof + _test_eof314: m.cs = 314; goto _test_eof + _test_eof315: m.cs = 315; goto _test_eof + _test_eof316: m.cs = 316; goto _test_eof + _test_eof82: m.cs = 82; goto _test_eof + _test_eof83: m.cs = 83; goto _test_eof + _test_eof84: m.cs = 84; goto _test_eof + _test_eof85: m.cs = 85; goto _test_eof + _test_eof86: m.cs = 86; goto _test_eof + _test_eof87: m.cs = 87; goto _test_eof + _test_eof88: m.cs = 88; goto _test_eof + _test_eof89: m.cs = 89; goto _test_eof + _test_eof90: m.cs = 90; goto _test_eof + _test_eof91: m.cs = 91; goto _test_eof + _test_eof92: m.cs = 92; goto _test_eof + _test_eof93: m.cs = 93; goto _test_eof + _test_eof94: m.cs = 94; goto _test_eof + _test_eof317: m.cs = 317; goto _test_eof + _test_eof318: m.cs = 318; goto _test_eof + _test_eof95: m.cs = 95; goto _test_eof + _test_eof319: m.cs = 319; goto _test_eof + _test_eof320: m.cs = 320; goto _test_eof + _test_eof321: m.cs = 321; goto _test_eof + _test_eof322: m.cs = 322; goto _test_eof + _test_eof323: m.cs = 323; goto _test_eof + _test_eof324: m.cs = 324; goto _test_eof + _test_eof325: m.cs = 325; goto _test_eof + _test_eof326: m.cs = 326; goto _test_eof + _test_eof327: m.cs = 327; goto _test_eof + _test_eof328: m.cs = 328; goto _test_eof + _test_eof329: m.cs = 329; goto _test_eof + _test_eof330: m.cs = 330; goto _test_eof + _test_eof331: m.cs = 331; goto _test_eof + _test_eof332: m.cs = 332; goto _test_eof + _test_eof333: m.cs = 333; goto _test_eof + _test_eof334: m.cs = 334; goto _test_eof + _test_eof335: m.cs = 335; goto _test_eof + _test_eof336: m.cs = 336; goto _test_eof + _test_eof337: m.cs = 337; goto _test_eof + _test_eof338: m.cs = 338; goto _test_eof + _test_eof96: m.cs = 96; goto _test_eof + _test_eof97: m.cs = 97; goto _test_eof + _test_eof339: m.cs = 339; goto _test_eof + _test_eof340: m.cs = 340; goto _test_eof + _test_eof98: m.cs = 98; goto _test_eof + _test_eof341: m.cs = 341; goto _test_eof + _test_eof342: m.cs = 342; goto _test_eof + _test_eof343: m.cs = 343; goto _test_eof + _test_eof344: m.cs = 344; goto _test_eof + _test_eof345: m.cs = 345; goto _test_eof + _test_eof346: m.cs = 346; goto _test_eof + _test_eof347: m.cs = 347; goto _test_eof + _test_eof348: m.cs = 348; goto _test_eof + _test_eof349: m.cs = 349; goto _test_eof + _test_eof350: m.cs = 350; goto _test_eof + _test_eof351: m.cs = 351; goto _test_eof + _test_eof352: m.cs = 352; goto _test_eof + _test_eof353: m.cs = 353; goto _test_eof + _test_eof354: m.cs = 354; goto _test_eof + _test_eof355: m.cs = 355; goto _test_eof + _test_eof356: m.cs = 356; goto _test_eof + _test_eof357: m.cs = 357; goto _test_eof + _test_eof358: m.cs = 358; goto _test_eof + _test_eof359: m.cs = 359; goto _test_eof + _test_eof360: m.cs = 360; goto _test_eof + _test_eof99: m.cs = 99; goto _test_eof + _test_eof361: m.cs = 361; goto _test_eof + _test_eof362: m.cs = 362; goto _test_eof + _test_eof100: m.cs = 100; goto _test_eof + _test_eof101: m.cs = 101; goto _test_eof + _test_eof102: m.cs = 102; goto _test_eof + _test_eof103: m.cs = 103; goto _test_eof + _test_eof363: m.cs = 363; goto _test_eof + _test_eof364: m.cs = 364; goto _test_eof + _test_eof104: m.cs = 104; goto _test_eof + _test_eof105: m.cs = 105; goto _test_eof + _test_eof365: m.cs = 365; goto _test_eof + _test_eof366: m.cs = 366; goto _test_eof + _test_eof367: m.cs = 367; goto _test_eof + _test_eof368: m.cs = 368; goto _test_eof + _test_eof106: m.cs = 106; goto _test_eof + _test_eof107: m.cs = 107; goto _test_eof + _test_eof108: m.cs = 108; goto _test_eof + _test_eof369: m.cs = 369; goto _test_eof + _test_eof109: m.cs = 109; goto _test_eof + _test_eof110: m.cs = 110; goto _test_eof + _test_eof111: m.cs = 111; goto _test_eof + _test_eof370: m.cs = 370; goto _test_eof + _test_eof112: m.cs = 112; goto _test_eof + _test_eof113: m.cs = 113; goto _test_eof + _test_eof371: m.cs = 371; goto _test_eof + _test_eof372: m.cs = 372; goto _test_eof + _test_eof114: m.cs = 114; goto _test_eof + _test_eof115: m.cs = 115; goto _test_eof + _test_eof116: m.cs = 116; goto _test_eof + _test_eof117: m.cs = 117; goto _test_eof + _test_eof118: m.cs = 118; goto _test_eof + _test_eof119: m.cs = 119; goto _test_eof + _test_eof120: m.cs = 120; goto _test_eof + _test_eof121: m.cs = 121; goto _test_eof + _test_eof122: m.cs = 122; goto _test_eof + _test_eof123: m.cs = 123; goto _test_eof + _test_eof124: m.cs = 124; goto _test_eof + _test_eof125: m.cs = 125; goto _test_eof + _test_eof373: m.cs = 373; goto _test_eof + _test_eof374: m.cs = 374; goto _test_eof + _test_eof375: m.cs = 375; goto _test_eof + _test_eof126: m.cs = 126; goto _test_eof + _test_eof376: m.cs = 376; goto _test_eof + _test_eof377: m.cs = 377; goto _test_eof + _test_eof378: m.cs = 378; goto _test_eof + _test_eof379: m.cs = 379; goto _test_eof + _test_eof380: m.cs = 380; goto _test_eof + _test_eof381: m.cs = 381; goto _test_eof + _test_eof382: m.cs = 382; goto _test_eof + _test_eof383: m.cs = 383; goto _test_eof + _test_eof384: m.cs = 384; goto _test_eof + _test_eof385: m.cs = 385; goto _test_eof + _test_eof386: m.cs = 386; goto _test_eof + _test_eof387: m.cs = 387; goto _test_eof + _test_eof388: m.cs = 388; goto _test_eof + _test_eof389: m.cs = 389; goto _test_eof + _test_eof390: m.cs = 390; goto _test_eof + _test_eof391: m.cs = 391; goto _test_eof + _test_eof392: m.cs = 392; goto _test_eof + _test_eof393: m.cs = 393; goto _test_eof + _test_eof394: m.cs = 394; goto _test_eof + _test_eof395: m.cs = 395; goto _test_eof + _test_eof396: m.cs = 396; goto _test_eof + _test_eof397: m.cs = 397; goto _test_eof + _test_eof127: m.cs = 127; goto _test_eof + _test_eof398: m.cs = 398; goto _test_eof + _test_eof399: m.cs = 399; goto _test_eof + _test_eof400: m.cs = 400; goto _test_eof + _test_eof401: m.cs = 401; goto _test_eof + _test_eof128: m.cs = 128; goto _test_eof + _test_eof402: m.cs = 402; goto _test_eof + _test_eof403: m.cs = 403; goto _test_eof + _test_eof404: m.cs = 404; goto _test_eof + _test_eof405: m.cs = 405; goto _test_eof + _test_eof406: m.cs = 406; goto _test_eof + _test_eof407: m.cs = 407; goto _test_eof + _test_eof408: m.cs = 408; goto _test_eof + _test_eof409: m.cs = 409; goto _test_eof + _test_eof410: m.cs = 410; goto _test_eof + _test_eof411: m.cs = 411; goto _test_eof + _test_eof412: m.cs = 412; goto _test_eof + _test_eof413: m.cs = 413; goto _test_eof + _test_eof414: m.cs = 414; goto _test_eof + _test_eof415: m.cs = 415; goto _test_eof + _test_eof416: m.cs = 416; goto _test_eof + _test_eof417: m.cs = 417; goto _test_eof + _test_eof418: m.cs = 418; goto _test_eof + _test_eof419: m.cs = 419; goto _test_eof + _test_eof420: m.cs = 420; goto _test_eof + _test_eof421: m.cs = 421; goto _test_eof + _test_eof129: m.cs = 129; goto _test_eof + _test_eof130: m.cs = 130; goto _test_eof + _test_eof131: m.cs = 131; goto _test_eof + _test_eof422: m.cs = 422; goto _test_eof + _test_eof423: m.cs = 423; goto _test_eof + _test_eof132: m.cs = 132; goto _test_eof + _test_eof424: m.cs = 424; goto _test_eof + _test_eof425: m.cs = 425; goto _test_eof + _test_eof426: m.cs = 426; goto _test_eof + _test_eof427: m.cs = 427; goto _test_eof + _test_eof428: m.cs = 428; goto _test_eof + _test_eof429: m.cs = 429; goto _test_eof + _test_eof430: m.cs = 430; goto _test_eof + _test_eof431: m.cs = 431; goto _test_eof + _test_eof432: m.cs = 432; goto _test_eof + _test_eof433: m.cs = 433; goto _test_eof + _test_eof434: m.cs = 434; goto _test_eof + _test_eof435: m.cs = 435; goto _test_eof + _test_eof436: m.cs = 436; goto _test_eof + _test_eof437: m.cs = 437; goto _test_eof + _test_eof438: m.cs = 438; goto _test_eof + _test_eof439: m.cs = 439; goto _test_eof + _test_eof440: m.cs = 440; goto _test_eof + _test_eof441: m.cs = 441; goto _test_eof + _test_eof442: m.cs = 442; goto _test_eof + _test_eof443: m.cs = 443; goto _test_eof + _test_eof133: m.cs = 133; goto _test_eof + _test_eof444: m.cs = 444; goto _test_eof + _test_eof445: m.cs = 445; goto _test_eof + _test_eof446: m.cs = 446; goto _test_eof + _test_eof134: m.cs = 134; goto _test_eof + _test_eof447: m.cs = 447; goto _test_eof + _test_eof448: m.cs = 448; goto _test_eof + _test_eof449: m.cs = 449; goto _test_eof + _test_eof450: m.cs = 450; goto _test_eof + _test_eof451: m.cs = 451; goto _test_eof + _test_eof452: m.cs = 452; goto _test_eof + _test_eof453: m.cs = 453; goto _test_eof + _test_eof454: m.cs = 454; goto _test_eof + _test_eof455: m.cs = 455; goto _test_eof + _test_eof456: m.cs = 456; goto _test_eof + _test_eof457: m.cs = 457; goto _test_eof + _test_eof458: m.cs = 458; goto _test_eof + _test_eof459: m.cs = 459; goto _test_eof + _test_eof460: m.cs = 460; goto _test_eof + _test_eof461: m.cs = 461; goto _test_eof + _test_eof462: m.cs = 462; goto _test_eof + _test_eof463: m.cs = 463; goto _test_eof + _test_eof464: m.cs = 464; goto _test_eof + _test_eof465: m.cs = 465; goto _test_eof + _test_eof466: m.cs = 466; goto _test_eof + _test_eof467: m.cs = 467; goto _test_eof + _test_eof468: m.cs = 468; goto _test_eof + _test_eof135: m.cs = 135; goto _test_eof + _test_eof469: m.cs = 469; goto _test_eof + _test_eof470: m.cs = 470; goto _test_eof + _test_eof471: m.cs = 471; goto _test_eof + _test_eof472: m.cs = 472; goto _test_eof + _test_eof473: m.cs = 473; goto _test_eof + _test_eof474: m.cs = 474; goto _test_eof + _test_eof475: m.cs = 475; goto _test_eof + _test_eof476: m.cs = 476; goto _test_eof + _test_eof477: m.cs = 477; goto _test_eof + _test_eof478: m.cs = 478; goto _test_eof + _test_eof479: m.cs = 479; goto _test_eof + _test_eof480: m.cs = 480; goto _test_eof + _test_eof481: m.cs = 481; goto _test_eof + _test_eof482: m.cs = 482; goto _test_eof + _test_eof483: m.cs = 483; goto _test_eof + _test_eof484: m.cs = 484; goto _test_eof + _test_eof485: m.cs = 485; goto _test_eof + _test_eof486: m.cs = 486; goto _test_eof + _test_eof487: m.cs = 487; goto _test_eof + _test_eof488: m.cs = 488; goto _test_eof + _test_eof489: m.cs = 489; goto _test_eof + _test_eof490: m.cs = 490; goto _test_eof + _test_eof136: m.cs = 136; goto _test_eof + _test_eof137: m.cs = 137; goto _test_eof + _test_eof138: m.cs = 138; goto _test_eof + _test_eof139: m.cs = 139; goto _test_eof + _test_eof491: m.cs = 491; goto _test_eof + _test_eof492: m.cs = 492; goto _test_eof + _test_eof140: m.cs = 140; goto _test_eof + _test_eof493: m.cs = 493; goto _test_eof + _test_eof141: m.cs = 141; goto _test_eof + _test_eof494: m.cs = 494; goto _test_eof + _test_eof495: m.cs = 495; goto _test_eof + _test_eof496: m.cs = 496; goto _test_eof + _test_eof497: m.cs = 497; goto _test_eof + _test_eof142: m.cs = 142; goto _test_eof + _test_eof143: m.cs = 143; goto _test_eof + _test_eof144: m.cs = 144; goto _test_eof + _test_eof498: m.cs = 498; goto _test_eof + _test_eof145: m.cs = 145; goto _test_eof + _test_eof146: m.cs = 146; goto _test_eof + _test_eof147: m.cs = 147; goto _test_eof + _test_eof499: m.cs = 499; goto _test_eof + _test_eof148: m.cs = 148; goto _test_eof + _test_eof149: m.cs = 149; goto _test_eof + _test_eof500: m.cs = 500; goto _test_eof + _test_eof501: m.cs = 501; goto _test_eof + _test_eof150: m.cs = 150; goto _test_eof + _test_eof151: m.cs = 151; goto _test_eof + _test_eof502: m.cs = 502; goto _test_eof + _test_eof503: m.cs = 503; goto _test_eof + _test_eof504: m.cs = 504; goto _test_eof + _test_eof152: m.cs = 152; goto _test_eof + _test_eof505: m.cs = 505; goto _test_eof + _test_eof506: m.cs = 506; goto _test_eof + _test_eof507: m.cs = 507; goto _test_eof + _test_eof508: m.cs = 508; goto _test_eof + _test_eof509: m.cs = 509; goto _test_eof + _test_eof510: m.cs = 510; goto _test_eof + _test_eof511: m.cs = 511; goto _test_eof + _test_eof512: m.cs = 512; goto _test_eof + _test_eof513: m.cs = 513; goto _test_eof + _test_eof514: m.cs = 514; goto _test_eof + _test_eof515: m.cs = 515; goto _test_eof + _test_eof516: m.cs = 516; goto _test_eof + _test_eof517: m.cs = 517; goto _test_eof + _test_eof518: m.cs = 518; goto _test_eof + _test_eof519: m.cs = 519; goto _test_eof + _test_eof520: m.cs = 520; goto _test_eof + _test_eof521: m.cs = 521; goto _test_eof + _test_eof522: m.cs = 522; goto _test_eof + _test_eof523: m.cs = 523; goto _test_eof + _test_eof524: m.cs = 524; goto _test_eof + _test_eof525: m.cs = 525; goto _test_eof + _test_eof153: m.cs = 153; goto _test_eof + _test_eof154: m.cs = 154; goto _test_eof + _test_eof526: m.cs = 526; goto _test_eof + _test_eof527: m.cs = 527; goto _test_eof + _test_eof528: m.cs = 528; goto _test_eof + _test_eof529: m.cs = 529; goto _test_eof + _test_eof155: m.cs = 155; goto _test_eof + _test_eof156: m.cs = 156; goto _test_eof + _test_eof157: m.cs = 157; goto _test_eof + _test_eof530: m.cs = 530; goto _test_eof + _test_eof158: m.cs = 158; goto _test_eof + _test_eof159: m.cs = 159; goto _test_eof + _test_eof160: m.cs = 160; goto _test_eof + _test_eof531: m.cs = 531; goto _test_eof + _test_eof161: m.cs = 161; goto _test_eof + _test_eof162: m.cs = 162; goto _test_eof + _test_eof532: m.cs = 532; goto _test_eof + _test_eof533: m.cs = 533; goto _test_eof + _test_eof163: m.cs = 163; goto _test_eof + _test_eof164: m.cs = 164; goto _test_eof + _test_eof165: m.cs = 165; goto _test_eof + _test_eof534: m.cs = 534; goto _test_eof + _test_eof535: m.cs = 535; goto _test_eof + _test_eof166: m.cs = 166; goto _test_eof + _test_eof536: m.cs = 536; goto _test_eof + _test_eof537: m.cs = 537; goto _test_eof + _test_eof167: m.cs = 167; goto _test_eof + _test_eof538: m.cs = 538; goto _test_eof + _test_eof539: m.cs = 539; goto _test_eof + _test_eof540: m.cs = 540; goto _test_eof + _test_eof541: m.cs = 541; goto _test_eof + _test_eof168: m.cs = 168; goto _test_eof + _test_eof169: m.cs = 169; goto _test_eof + _test_eof170: m.cs = 170; goto _test_eof + _test_eof542: m.cs = 542; goto _test_eof + _test_eof171: m.cs = 171; goto _test_eof + _test_eof172: m.cs = 172; goto _test_eof + _test_eof173: m.cs = 173; goto _test_eof + _test_eof543: m.cs = 543; goto _test_eof + _test_eof174: m.cs = 174; goto _test_eof + _test_eof175: m.cs = 175; goto _test_eof + _test_eof544: m.cs = 544; goto _test_eof + _test_eof545: m.cs = 545; goto _test_eof + _test_eof176: m.cs = 176; goto _test_eof + _test_eof546: m.cs = 546; goto _test_eof + _test_eof547: m.cs = 547; goto _test_eof + _test_eof177: m.cs = 177; goto _test_eof + _test_eof178: m.cs = 178; goto _test_eof + _test_eof548: m.cs = 548; goto _test_eof + _test_eof549: m.cs = 549; goto _test_eof + _test_eof550: m.cs = 550; goto _test_eof + _test_eof179: m.cs = 179; goto _test_eof + _test_eof180: m.cs = 180; goto _test_eof + _test_eof181: m.cs = 181; goto _test_eof + _test_eof551: m.cs = 551; goto _test_eof + _test_eof182: m.cs = 182; goto _test_eof + _test_eof183: m.cs = 183; goto _test_eof + _test_eof184: m.cs = 184; goto _test_eof + _test_eof552: m.cs = 552; goto _test_eof + _test_eof185: m.cs = 185; goto _test_eof + _test_eof186: m.cs = 186; goto _test_eof + _test_eof553: m.cs = 553; goto _test_eof + _test_eof554: m.cs = 554; goto _test_eof + _test_eof187: m.cs = 187; goto _test_eof + _test_eof555: m.cs = 555; goto _test_eof + _test_eof188: m.cs = 188; goto _test_eof + _test_eof556: m.cs = 556; goto _test_eof + _test_eof557: m.cs = 557; goto _test_eof + _test_eof189: m.cs = 189; goto _test_eof + _test_eof190: m.cs = 190; goto _test_eof + + _test_eof: {} + if ( m.p) == ( m.eof) { + switch m.cs { + case 191, 192, 193, 195, 224, 225, 227, 246, 247, 248, 250, 269, 272, 291, 292, 293, 294, 296, 297, 298, 317, 318, 320, 339, 340, 342, 361, 362, 373, 374, 375, 377, 396, 397, 399, 400, 401, 420, 421, 422, 423, 425, 444, 445, 446, 448, 467, 468, 470, 471, 472, 493, 503, 504, 506, 536, 556, 557: +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; m.cs = 0; goto _out } + + case 1, 129: +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + + case 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 37, 38, 39, 40, 41, 43, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 81, 87, 88, 89, 90, 91, 125, 128, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186: +//line plugins/parsers/influx/machine.go.rl:35 + + m.err = ErrFieldParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + + case 27, 28, 29, 35, 36: +//line plugins/parsers/influx/machine.go.rl:42 + + m.err = ErrTagParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + + case 8: +//line plugins/parsers/influx/machine.go.rl:49 + + m.err = ErrTimestampParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + + case 217, 274, 284, 366, 495, 527, 539, 548: +//line plugins/parsers/influx/machine.go.rl:88 + + m.handler.AddInt(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; m.cs = 0; goto _out } + + case 214, 215, 216, 218, 270, 271, 273, 275, 281, 282, 283, 285, 363, 364, 365, 367, 491, 492, 494, 496, 502, 525, 526, 528, 534, 535, 537, 538, 540, 546, 547, 549: +//line plugins/parsers/influx/machine.go.rl:92 + + m.handler.AddFloat(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; m.cs = 0; goto _out } + + case 219, 220, 221, 222, 223, 276, 277, 278, 279, 280, 286, 287, 288, 289, 290, 368, 369, 370, 371, 372, 497, 498, 499, 500, 501, 529, 530, 531, 532, 533, 541, 542, 543, 544, 545, 550, 551, 552, 553, 554: +//line plugins/parsers/influx/machine.go.rl:96 + + m.handler.AddBool(key, m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; m.cs = 0; goto _out } + + case 194, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 226, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 249, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 295, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 319, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 341, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 376, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 398, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 424, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 447, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 469, 473, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 505, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524: +//line plugins/parsers/influx/machine.go.rl:104 + + m.handler.SetTimestamp(m.text()) + +//line plugins/parsers/influx/machine.go.rl:22 + + yield = true + m.cs = 188; + {( m.p)++; m.cs = 0; goto _out } + + case 42, 44, 80, 126, 127, 134: +//line plugins/parsers/influx/machine.go.rl:35 + + m.err = ErrFieldParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:49 + + m.err = ErrTimestampParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + + case 30, 31, 32, 33, 34, 82, 83, 84, 85, 86, 92, 93, 94, 96, 97, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 130, 131, 133, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163: +//line plugins/parsers/influx/machine.go.rl:42 + + m.err = ErrTagParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:35 + + m.err = ErrFieldParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + + case 98: +//line plugins/parsers/influx/machine.go.rl:42 + + m.err = ErrTagParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:49 + + m.err = ErrTimestampParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + + case 95, 132, 135, 152: +//line plugins/parsers/influx/machine.go.rl:42 + + m.err = ErrTagParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:35 + + m.err = ErrFieldParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:49 + + m.err = ErrTimestampParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go.rl:56 + + m.err = ErrParse + ( m.p)-- + + m.cs = 187; + {( m.p)++; m.cs = 0; goto _out } + +//line plugins/parsers/influx/machine.go:21134 + } + } + + _out: {} + } + +//line plugins/parsers/influx/machine.go.rl:267 + + // Even if there was an error, return true. On the next call to this + // function we will attempt to scan to the next line of input and recover. + if m.err != nil { + return true + } + + // Don't check the error state in the case that we just yielded, because + // the yield indicates we just completed parsing a line. + if !yield && m.cs == LineProtocol_error { + m.err = ErrParse + return true + } + + return true +} + +// Err returns the error that occurred on the last call to ParseLine. If the +// result is nil, then the line was parsed successfully. +func (m *machine) Err() error { + return m.err +} + +// Position returns the current position into the input. +func (m *machine) Position() int { + return m.p +} + +func (m *machine) text() []byte { + return m.data[m.pb:m.p] +} diff --git a/plugins/parsers/influx/machine.go.rl b/plugins/parsers/influx/machine.go.rl new file mode 100644 index 000000000..2edc5b8c8 --- /dev/null +++ b/plugins/parsers/influx/machine.go.rl @@ -0,0 +1,297 @@ +package influx + +import ( + "errors" +) + +var ( + ErrNameParse = errors.New("expected measurement name") + ErrFieldParse = errors.New("expected field") + ErrTagParse = errors.New("expected tag") + ErrTimestampParse = errors.New("expected timestamp") + ErrParse = errors.New("parse error") +) + +%%{ +machine LineProtocol; + +action begin { + m.pb = m.p +} + +action yield { + yield = true + fnext align; + fbreak; +} + +action name_error { + m.err = ErrNameParse + fhold; + fnext discard_line; + fbreak; +} + +action field_error { + m.err = ErrFieldParse + fhold; + fnext discard_line; + fbreak; +} + +action tagset_error { + m.err = ErrTagParse + fhold; + fnext discard_line; + fbreak; +} + +action timestamp_error { + m.err = ErrTimestampParse + fhold; + fnext discard_line; + fbreak; +} + +action parse_error { + m.err = ErrParse + fhold; + fnext discard_line; + fbreak; +} + +action hold_recover { + fhold; + fgoto main; +} + +action discard { + fgoto align; +} + +action name { + m.handler.SetMeasurement(m.text()) +} + +action tagkey { + key = m.text() +} + +action tagvalue { + m.handler.AddTag(key, m.text()) +} + +action fieldkey { + key = m.text() +} + +action integer { + m.handler.AddInt(key, m.text()) +} + +action float { + m.handler.AddFloat(key, m.text()) +} + +action bool { + m.handler.AddBool(key, m.text()) +} + +action string { + m.handler.AddString(key, m.text()) +} + +action timestamp { + m.handler.SetTimestamp(m.text()) +} + +ws = + [\t\v\f ]; + +non_zero_digit = + [1-9]; + +integer = + '-'? ( digit | ( non_zero_digit digit* ) ); + +number = + ( integer ( '.' digit* )? ) | ( '.' digit* ); + +scientific = + number 'e'i ["\-+"]? digit+; + +timestamp = + ('-'? digit{1,19}) >begin %timestamp; + +fieldkeychar = + [^\t\n\f\r ,=\\] | ( '\\' [^\t\n\f\r] ); + +fieldkey = + fieldkeychar+ >begin %fieldkey; + +fieldfloat = + (scientific | number) >begin %float; + +fieldinteger = + (integer 'i') >begin %integer; + +false = + "false" | "FALSE" | "False" | "F" | "f"; + +true = + "true" | "TRUE" | "True" | "T" | "t"; + +fieldbool = + (true | false) >begin %bool; + +fieldstringchar = + [^\\"] | '\\' [\\"]; + +fieldstring = + fieldstringchar* >begin %string; + +fieldstringquoted = + '"' fieldstring '"'; + +fieldvalue = fieldinteger | fieldfloat | fieldstringquoted | fieldbool; + +field = + fieldkey '=' fieldvalue; + +fieldset = + field ( ',' field )*; + +tagchar = + [^\t\n\f\r ,=\\] | ( '\\' [^\t\n\f\r] ); + +tagkey = + tagchar+ >begin %tagkey; + +tagvalue = + tagchar+ >begin %tagvalue; + +tagset = + (',' (tagkey '=' tagvalue) $err(tagset_error))*; + +measurement_chars = + [^\t\n\f\r ,\\] | ( '\\' [^\t\n\f\r] ); + +measurement_start = + measurement_chars - '#'; + +measurement = + (measurement_start measurement_chars*) >begin %name; + +newline = + [\r\n]; + +comment = + '#' (any -- newline)* newline; + +eol = + ws* newline? >yield %eof(yield); + +line = + measurement + tagset + (ws+ fieldset) $err(field_error) + (ws+ timestamp)? $err(timestamp_error) + eol; + +# The main machine parses a single line of line protocol. +main := line $err(parse_error); + +# The discard_line machine discards the current line. Useful for recovering +# on the next line when an error occurs. +discard_line := + (any - newline)* newline @discard; + +# The align machine scans forward to the start of the next line. This machine +# is used to skip over whitespace and comments, keeping this logic out of the +# main machine. +align := + (space* comment)* space* measurement_start @hold_recover %eof(yield); +}%% + +%% write data; + +type machine struct { + data []byte + cs int + p, pe, eof int + pb int + handler Handler + err error +} + +func NewMachine(handler Handler) *machine { + m := &machine{ + handler: handler, + } + + %% access m.; + %% variable p m.p; + %% variable pe m.pe; + %% variable eof m.eof; + %% variable data m.data; + %% write init; + + return m +} + +func (m *machine) SetData(data []byte) { + m.data = data + m.p = 0 + m.pb = 0 + m.pe = len(data) + m.eof = len(data) + m.err = nil + + %% write init; + m.cs = LineProtocol_en_align +} + +// ParseLine parses a line of input and returns true if more data can be +// parsed. +func (m *machine) ParseLine() bool { + if m.data == nil || m.p >= m.pe { + m.err = nil + return false + } + + m.err = nil + var key []byte + var yield bool + + %% write exec; + + // Even if there was an error, return true. On the next call to this + // function we will attempt to scan to the next line of input and recover. + if m.err != nil { + return true + } + + // Don't check the error state in the case that we just yielded, because + // the yield indicates we just completed parsing a line. + if !yield && m.cs == LineProtocol_error { + m.err = ErrParse + return true + } + + return true +} + +// Err returns the error that occurred on the last call to ParseLine. If the +// result is nil, then the line was parsed successfully. +func (m *machine) Err() error { + return m.err +} + +// Position returns the current position into the input. +func (m *machine) Position() int { + return m.p +} + +func (m *machine) text() []byte { + return m.data[m.pb:m.p] +} diff --git a/plugins/parsers/influx/machine_test.go b/plugins/parsers/influx/machine_test.go new file mode 100644 index 000000000..3b8bcdf8b --- /dev/null +++ b/plugins/parsers/influx/machine_test.go @@ -0,0 +1,1312 @@ +package influx + +import ( + "fmt" + "testing" + + "github.com/stretchr/testify/require" +) + +type TestingHandler struct { + results []Result +} + +func (h *TestingHandler) SetMeasurement(name []byte) { + mname := Result{ + Name: Measurement, + Value: name, + } + h.results = append(h.results, mname) +} + +func (h *TestingHandler) AddTag(key []byte, value []byte) { + tagkey := Result{ + Name: TagKey, + Value: key, + } + tagvalue := Result{ + Name: TagValue, + Value: value, + } + h.results = append(h.results, tagkey, tagvalue) +} + +func (h *TestingHandler) AddInt(key []byte, value []byte) { + fieldkey := Result{ + Name: FieldKey, + Value: key, + } + fieldvalue := Result{ + Name: FieldInt, + Value: value, + } + h.results = append(h.results, fieldkey, fieldvalue) +} + +func (h *TestingHandler) AddFloat(key []byte, value []byte) { + fieldkey := Result{ + Name: FieldKey, + Value: key, + } + fieldvalue := Result{ + Name: FieldFloat, + Value: value, + } + h.results = append(h.results, fieldkey, fieldvalue) +} + +func (h *TestingHandler) AddString(key []byte, value []byte) { + fieldkey := Result{ + Name: FieldKey, + Value: key, + } + fieldvalue := Result{ + Name: FieldString, + Value: value, + } + h.results = append(h.results, fieldkey, fieldvalue) +} + +func (h *TestingHandler) AddBool(key []byte, value []byte) { + fieldkey := Result{ + Name: FieldKey, + Value: key, + } + fieldvalue := Result{ + Name: FieldBool, + Value: value, + } + h.results = append(h.results, fieldkey, fieldvalue) +} + +func (h *TestingHandler) SetTimestamp(tm []byte) { + timestamp := Result{ + Name: Timestamp, + Value: tm, + } + h.results = append(h.results, timestamp) +} + +func (h *TestingHandler) Reset() { +} + +func (h *TestingHandler) Results() []Result { + return h.results +} + +func (h *TestingHandler) AddError(err error) { + e := Result{ + err: err, + } + h.results = append(h.results, e) +} + +type BenchmarkingHandler struct { +} + +func (h *BenchmarkingHandler) SetMeasurement(name []byte) { +} + +func (h *BenchmarkingHandler) AddTag(key []byte, value []byte) { +} + +func (h *BenchmarkingHandler) AddInt(key []byte, value []byte) { +} + +func (h *BenchmarkingHandler) AddFloat(key []byte, value []byte) { +} + +func (h *BenchmarkingHandler) AddString(key []byte, value []byte) { +} + +func (h *BenchmarkingHandler) AddBool(key []byte, value []byte) { +} + +func (h *BenchmarkingHandler) SetTimestamp(tm []byte) { +} + +func (h *BenchmarkingHandler) Reset() { +} + +type TokenType int + +const ( + NoMatch TokenType = iota + Measurement + TagKey + TagValue + FieldKey + FieldString + FieldInt + FieldUint + FieldFloat + FieldBool + Timestamp + EOL + EOF + Punc + WhiteSpace +) + +func (t TokenType) String() string { + switch t { + case NoMatch: + return "NoMatch" + case Measurement: + return "Measurement" + case TagKey: + return "TagKey" + case TagValue: + return "TagValue" + case FieldKey: + return "FieldKey" + case FieldInt: + return "FieldInt" + case FieldUint: + return "FieldUint" + case FieldFloat: + return "FieldFloat" + case FieldString: + return "FieldString" + case FieldBool: + return "FieldBool" + case Timestamp: + return "Timestamp" + case EOL: + return "EOL" + case EOF: + return "EOF" + case Punc: + return "Punc" + case WhiteSpace: + return "WhiteSpace" + default: + panic("Unknown TokenType") + } +} + +type Token struct { + Name TokenType + Value []byte +} + +func (t Token) String() string { + return fmt.Sprintf("(%s %q)", t.Name, t.Value) +} + +type Result struct { + Name TokenType + Value []byte + err error +} + +func (r Result) String() string { + return fmt.Sprintf("(%s, %q, %v)", r.Name, r.Value, r.err) +} + +var tests = []struct { + name string + input []byte + results []Result + err error +}{ + { + name: "empty string", + input: []byte(""), + results: nil, + }, + { + name: "minimal", + input: []byte("cpu value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "newline", + input: []byte("cpu value=42\n"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "minimal with timestamp", + input: []byte("cpu value=42 1516241192000000000"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + Name: Timestamp, + Value: []byte("1516241192000000000"), + }, + }, + }, + { + name: "measurement escape non-special", + input: []byte(`c\pu value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte(`c\pu`), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "measurement escaped trailing backslash", + input: []byte(`cpu\\ value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte(`cpu\\`), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "single char measurement", + input: []byte("c value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("c"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "escape backslash in measurement", + input: []byte(`cp\\u value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte(`cp\\u`), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "measurement escape space", + input: []byte(`cpu\ abc value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte(`cpu\ abc`), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "scientific float", + input: []byte("cpu value=42e0"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42e0"), + }, + }, + }, + { + name: "scientific float negative mantissa", + input: []byte("cpu value=-42e0"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("-42e0"), + }, + }, + }, + { + name: "scientific float negative exponent", + input: []byte("cpu value=42e-1"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42e-1"), + }, + }, + }, + { + name: "scientific float big e", + input: []byte("cpu value=42E0"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42E0"), + }, + }, + }, + { + name: "scientific float missing exponent", + input: []byte("cpu value=42E"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "float with decimal", + input: []byte("cpu value=42.2"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42.2"), + }, + }, + }, + { + name: "negative float", + input: []byte("cpu value=-42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("-42"), + }, + }, + }, + { + name: "float without integer digits", + input: []byte("cpu value=.42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte(".42"), + }, + }, + }, + { + name: "multiple fields", + input: []byte("cpu x=42,y=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("x"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + Name: FieldKey, + Value: []byte("y"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "integer field", + input: []byte("cpu value=42i"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldInt, + Value: []byte("42i"), + }, + }, + }, + { + name: "negative integer field", + input: []byte("cpu value=-42i"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldInt, + Value: []byte("-42i"), + }, + }, + }, + { + name: "zero integer field", + input: []byte("cpu value=0i"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldInt, + Value: []byte("0i"), + }, + }, + }, + { + name: "negative zero integer field", + input: []byte("cpu value=-0i"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldInt, + Value: []byte("-0i"), + }, + }, + }, + { + name: "invalid field", + input: []byte("cpu value=howdy"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "string field", + input: []byte(`cpu value="42"`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldString, + Value: []byte("42"), + }, + }, + }, + { + name: "bool field", + input: []byte(`cpu value=true`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldBool, + Value: []byte("true"), + }, + }, + }, + { + name: "tag", + input: []byte(`cpu,host=localhost value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: TagKey, + Value: []byte("host"), + }, + Result{ + Name: TagValue, + Value: []byte("localhost"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "tag key escape space", + input: []byte(`cpu,h\ ost=localhost value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: TagKey, + Value: []byte(`h\ ost`), + }, + Result{ + Name: TagValue, + Value: []byte("localhost"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "tag key escape comma", + input: []byte(`cpu,h\,ost=localhost value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: TagKey, + Value: []byte(`h\,ost`), + }, + Result{ + Name: TagValue, + Value: []byte("localhost"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "tag key escape equal", + input: []byte(`cpu,h\=ost=localhost value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: TagKey, + Value: []byte(`h\=ost`), + }, + Result{ + Name: TagValue, + Value: []byte("localhost"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "multiple tags", + input: []byte(`cpu,host=localhost,cpu=cpu0 value=42`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: TagKey, + Value: []byte("host"), + }, + Result{ + Name: TagValue, + Value: []byte("localhost"), + }, + Result{ + Name: TagKey, + Value: []byte("cpu"), + }, + Result{ + Name: TagValue, + Value: []byte("cpu0"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "tag invalid missing separator", + input: []byte("cpu,xyzzy value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrTagParse, + }, + }, + }, + { + name: "tag invalid missing value", + input: []byte("cpu,xyzzy= value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrTagParse, + }, + }, + }, + { + name: "tag invalid unescaped space", + input: []byte("cpu,h ost=localhost value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrTagParse, + }, + }, + }, + { + name: "tag invalid unescaped comma", + input: []byte("cpu,h,ost=localhost value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrTagParse, + }, + }, + }, + { + name: "tag invalid unescaped equals", + input: []byte("cpu,h=ost=localhost value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrTagParse, + }, + }, + }, + { + name: "timestamp negative", + input: []byte("cpu value=42 -1"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + Name: Timestamp, + Value: []byte("-1"), + }, + }, + }, + { + name: "timestamp zero", + input: []byte("cpu value=42 0"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + Name: Timestamp, + Value: []byte("0"), + }, + }, + }, + { + name: "multiline", + input: []byte("cpu value=42\n\n\ncpu value=43\n"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("43"), + }, + }, + }, + { + name: "error recovery", + input: []byte("cpu value=howdy\ncpu\ncpu value=42\n"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrFieldParse, + }, + Result{ + err: ErrFieldParse, + }, + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "line whitespace", + input: []byte(" cpu value=42 1516241192000000000 \n\n cpu value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + Name: Timestamp, + Value: []byte("1516241192000000000"), + }, + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "leading newline", + input: []byte("\ncpu value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "invalid missing field value", + input: []byte("cpu value="), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "invalid eof field key", + input: []byte("cpu value"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "invalid measurement only", + input: []byte("cpu"), + results: []Result{ + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "invalid measurement only eol", + input: []byte("cpu\n"), + results: []Result{ + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "invalid missing tag", + input: []byte("cpu, value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrTagParse, + }, + }, + }, + { + name: "invalid missing field", + input: []byte("cpu,x=y "), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: TagKey, + Value: []byte("x"), + }, + Result{ + Name: TagValue, + Value: []byte("y"), + }, + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "invalid too many fields", + input: []byte("cpu value=42 value=43"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + err: ErrTimestampParse, + }, + }, + }, + { + name: "invalid timestamp too long", + input: []byte("cpu value=42 12345678901234567890"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + err: ErrTimestampParse, + }, + }, + }, + { + name: "invalid open string field", + input: []byte(`cpu value="42 12345678901234567890`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "invalid field value", + input: []byte(`cpu value=howdy`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + err: ErrFieldParse, + }, + }, + }, + { + name: "invalid quoted timestamp", + input: []byte(`cpu value=42 "12345678901234567890"`), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + Result{ + err: ErrTimestampParse, + }, + }, + }, + { + name: "commented line", + input: []byte("# blah blah\ncpu value=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "end with comment", + input: []byte("cpu value=42\n# blah blah"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "end with comment and whitespace", + input: []byte("cpu value=42\n# blah blah\n\n "), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("value"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, + { + name: "unicode", + input: []byte("cpu ☺=42"), + results: []Result{ + Result{ + Name: Measurement, + Value: []byte("cpu"), + }, + Result{ + Name: FieldKey, + Value: []byte("☺"), + }, + Result{ + Name: FieldFloat, + Value: []byte("42"), + }, + }, + }, +} + +func TestMachine(t *testing.T) { + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + handler := &TestingHandler{} + fsm := NewMachine(handler) + fsm.SetData(tt.input) + + count := 0 + for fsm.ParseLine() { + if fsm.Err() != nil { + handler.AddError(fsm.Err()) + } + count++ + if count > 20 { + break + } + } + + if fsm.Err() != nil { + handler.AddError(fsm.Err()) + } + + results := handler.Results() + require.Equal(t, tt.results, results) + }) + } +} + +func BenchmarkMachine(b *testing.B) { + for _, tt := range tests { + b.Run(tt.name, func(b *testing.B) { + handler := &BenchmarkingHandler{} + fsm := NewMachine(handler) + + for n := 0; n < b.N; n++ { + fsm.SetData(tt.input) + + for fsm.ParseLine() { + } + } + }) + } +} + +func TestMachineProcstat(t *testing.T) { + input := []byte("procstat,exe=bash,process_name=bash voluntary_context_switches=42i,memory_rss=5103616i,rlimit_memory_data_hard=2147483647i,cpu_time_user=0.02,rlimit_file_locks_soft=2147483647i,pid=29417i,cpu_time_nice=0,rlimit_memory_locked_soft=65536i,read_count=259i,rlimit_memory_vms_hard=2147483647i,memory_swap=0i,rlimit_num_fds_soft=1024i,rlimit_nice_priority_hard=0i,cpu_time_soft_irq=0,cpu_time=0i,rlimit_memory_locked_hard=65536i,realtime_priority=0i,signals_pending=0i,nice_priority=20i,cpu_time_idle=0,memory_stack=139264i,memory_locked=0i,rlimit_memory_stack_soft=8388608i,cpu_time_iowait=0,cpu_time_guest=0,cpu_time_guest_nice=0,rlimit_memory_data_soft=2147483647i,read_bytes=0i,rlimit_cpu_time_soft=2147483647i,involuntary_context_switches=2i,write_bytes=106496i,cpu_time_system=0,cpu_time_irq=0,cpu_usage=0,memory_vms=21659648i,memory_data=1576960i,rlimit_memory_stack_hard=2147483647i,num_threads=1i,cpu_time_stolen=0,rlimit_memory_rss_soft=2147483647i,rlimit_realtime_priority_soft=0i,num_fds=4i,write_count=35i,rlimit_signals_pending_soft=78994i,cpu_time_steal=0,rlimit_num_fds_hard=4096i,rlimit_file_locks_hard=2147483647i,rlimit_cpu_time_hard=2147483647i,rlimit_signals_pending_hard=78994i,rlimit_nice_priority_soft=0i,rlimit_memory_rss_hard=2147483647i,rlimit_memory_vms_soft=2147483647i,rlimit_realtime_priority_hard=0i 1517620624000000000") + handler := &TestingHandler{} + fsm := NewMachine(handler) + fsm.SetData(input) + for fsm.ParseLine() { + } +} + +func BenchmarkMachineProcstat(b *testing.B) { + input := []byte("procstat,exe=bash,process_name=bash voluntary_context_switches=42i,memory_rss=5103616i,rlimit_memory_data_hard=2147483647i,cpu_time_user=0.02,rlimit_file_locks_soft=2147483647i,pid=29417i,cpu_time_nice=0,rlimit_memory_locked_soft=65536i,read_count=259i,rlimit_memory_vms_hard=2147483647i,memory_swap=0i,rlimit_num_fds_soft=1024i,rlimit_nice_priority_hard=0i,cpu_time_soft_irq=0,cpu_time=0i,rlimit_memory_locked_hard=65536i,realtime_priority=0i,signals_pending=0i,nice_priority=20i,cpu_time_idle=0,memory_stack=139264i,memory_locked=0i,rlimit_memory_stack_soft=8388608i,cpu_time_iowait=0,cpu_time_guest=0,cpu_time_guest_nice=0,rlimit_memory_data_soft=2147483647i,read_bytes=0i,rlimit_cpu_time_soft=2147483647i,involuntary_context_switches=2i,write_bytes=106496i,cpu_time_system=0,cpu_time_irq=0,cpu_usage=0,memory_vms=21659648i,memory_data=1576960i,rlimit_memory_stack_hard=2147483647i,num_threads=1i,cpu_time_stolen=0,rlimit_memory_rss_soft=2147483647i,rlimit_realtime_priority_soft=0i,num_fds=4i,write_count=35i,rlimit_signals_pending_soft=78994i,cpu_time_steal=0,rlimit_num_fds_hard=4096i,rlimit_file_locks_hard=2147483647i,rlimit_cpu_time_hard=2147483647i,rlimit_signals_pending_hard=78994i,rlimit_nice_priority_soft=0i,rlimit_memory_rss_hard=2147483647i,rlimit_memory_vms_soft=2147483647i,rlimit_realtime_priority_hard=0i 1517620624000000000") + handler := &BenchmarkingHandler{} + fsm := NewMachine(handler) + for n := 0; n < b.N; n++ { + fsm.SetData(input) + for fsm.ParseLine() { + } + } +} diff --git a/plugins/parsers/influx/parser.go b/plugins/parsers/influx/parser.go index 0abb330e8..273877d30 100644 --- a/plugins/parsers/influx/parser.go +++ b/plugins/parsers/influx/parser.go @@ -1,64 +1,112 @@ package influx import ( - "bytes" + "errors" "fmt" - "time" "github.com/influxdata/telegraf" - "github.com/influxdata/telegraf/metric" ) -// InfluxParser is an object for Parsing incoming metrics. -type InfluxParser struct { - // DefaultTags will be added to every parsed metric - DefaultTags map[string]string +const ( + maxErrorBufferSize = 1024 +) + +var ( + ErrNoMetric = errors.New("no metric in line") +) + +type Handler interface { + SetMeasurement(name []byte) + AddTag(key []byte, value []byte) + AddInt(key []byte, value []byte) + AddFloat(key []byte, value []byte) + AddString(key []byte, value []byte) + AddBool(key []byte, value []byte) + SetTimestamp(tm []byte) + Reset() } -func (p *InfluxParser) ParseWithDefaultTimePrecision(buf []byte, t time.Time, precision string) ([]telegraf.Metric, error) { - if !bytes.HasSuffix(buf, []byte("\n")) { - buf = append(buf, '\n') +type ParseError struct { + Offset int + msg string + buf string +} + +func (e *ParseError) Error() string { + buffer := e.buf + if len(buffer) > maxErrorBufferSize { + buffer = buffer[:maxErrorBufferSize] + "..." } - // parse even if the buffer begins with a newline - buf = bytes.TrimPrefix(buf, []byte("\n")) - metrics, err := metric.ParseWithDefaultTimePrecision(buf, t, precision) - if len(p.DefaultTags) > 0 { - for _, m := range metrics { - for k, v := range p.DefaultTags { - // only set the default tag if it doesn't already exist: - if !m.HasTag(k) { - m.AddTag(k, v) - } + return fmt.Sprintf("metric parse error: %s at offset %d: %q", e.msg, e.Offset, buffer) +} + +type Parser struct { + DefaultTags map[string]string + + *machine + handler *MetricHandler +} + +func NewParser(handler *MetricHandler) *Parser { + return &Parser{ + machine: NewMachine(handler), + handler: handler, + } +} + +func (p *Parser) Parse(input []byte) ([]telegraf.Metric, error) { + metrics := make([]telegraf.Metric, 0) + p.machine.SetData(input) + + for p.machine.ParseLine() { + err := p.machine.Err() + if err != nil { + return nil, &ParseError{ + Offset: p.machine.Position(), + msg: err.Error(), + buf: string(input), } } + + metric, err := p.handler.Metric() + if err != nil { + return nil, err + } + p.handler.Reset() + metrics = append(metrics, metric) } - return metrics, err + + p.applyDefaultTags(metrics) + return metrics, nil } -// Parse returns a slice of Metrics from a text representation of a -// metric (in line-protocol format) -// with each metric separated by newlines. If any metrics fail to parse, -// a non-nil error will be returned in addition to the metrics that parsed -// successfully. -func (p *InfluxParser) Parse(buf []byte) ([]telegraf.Metric, error) { - return p.ParseWithDefaultTimePrecision(buf, time.Now(), "") -} - -func (p *InfluxParser) ParseLine(line string) (telegraf.Metric, error) { +func (p *Parser) ParseLine(line string) (telegraf.Metric, error) { metrics, err := p.Parse([]byte(line + "\n")) - if err != nil { return nil, err } if len(metrics) < 1 { - return nil, fmt.Errorf( - "Can not parse the line: %s, for data format: influx ", line) + return nil, ErrNoMetric } return metrics[0], nil } -func (p *InfluxParser) SetDefaultTags(tags map[string]string) { +func (p *Parser) SetDefaultTags(tags map[string]string) { p.DefaultTags = tags } + +func (p *Parser) applyDefaultTags(metrics []telegraf.Metric) { + if len(p.DefaultTags) == 0 { + return + } + + for _, m := range metrics { + for k, v := range p.DefaultTags { + if !m.HasTag(k) { + m.AddTag(k, v) + } + } + } +} diff --git a/plugins/parsers/influx/parser_test.go b/plugins/parsers/influx/parser_test.go index 959fc0982..28d57cfee 100644 --- a/plugins/parsers/influx/parser_test.go +++ b/plugins/parsers/influx/parser_test.go @@ -1,294 +1,488 @@ package influx import ( - "fmt" - "io/ioutil" "testing" "time" "github.com/influxdata/telegraf" - - "github.com/stretchr/testify/assert" + "github.com/influxdata/telegraf/metric" + "github.com/stretchr/testify/require" ) -var ( - ms []telegraf.Metric - writer = ioutil.Discard - metrics500 []byte - exptime = time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC).UnixNano() -) - -const ( - validInflux = "cpu_load_short,cpu=cpu0 value=10 1257894000000000000\n" - negativeFloat = "cpu_load_short,cpu=cpu0 value=-13.4 1257894000000000000\n" - validInfluxNewline = "\ncpu_load_short,cpu=cpu0 value=10 1257894000000000000\n" - validInfluxNoNewline = "cpu_load_short,cpu=cpu0 value=10 1257894000000000000" - invalidInflux = "I don't think this is line protocol\n" - invalidInflux2 = "{\"a\": 5, \"b\": {\"c\": 6}}\n" - invalidInflux3 = `name text="unescaped "quote" ",value=1 1498077493081000000` - invalidInflux4 = `name text="unbalanced "quote" 1498077493081000000` -) - -const influxMulti = ` -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -` - -const influxMultiSomeInvalid = ` -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,cpu=cpu3, host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -cpu,cpu=cpu4 , usage_idle=99,usage_busy=1 -cpu,host=foo,datacenter=us-east usage_idle=99,usage_busy=1 -` - -func TestParseValidInflux(t *testing.T) { - parser := InfluxParser{} - - metrics, err := parser.Parse([]byte(validInflux)) - assert.NoError(t, err) - assert.Len(t, metrics, 1) - assert.Equal(t, "cpu_load_short", metrics[0].Name()) - assert.Equal(t, map[string]interface{}{ - "value": float64(10), - }, metrics[0].Fields()) - assert.Equal(t, map[string]string{ - "cpu": "cpu0", - }, metrics[0].Tags()) - assert.Equal(t, exptime, metrics[0].Time().UnixNano()) - - metrics, err = parser.Parse([]byte(validInfluxNewline)) - assert.NoError(t, err) - assert.Len(t, metrics, 1) - assert.Equal(t, "cpu_load_short", metrics[0].Name()) - assert.Equal(t, map[string]interface{}{ - "value": float64(10), - }, metrics[0].Fields()) - assert.Equal(t, map[string]string{ - "cpu": "cpu0", - }, metrics[0].Tags()) - assert.Equal(t, exptime, metrics[0].Time().UnixNano()) - - metrics, err = parser.Parse([]byte(validInfluxNoNewline)) - assert.NoError(t, err) - assert.Len(t, metrics, 1) - assert.Equal(t, "cpu_load_short", metrics[0].Name()) - assert.Equal(t, map[string]interface{}{ - "value": float64(10), - }, metrics[0].Fields()) - assert.Equal(t, map[string]string{ - "cpu": "cpu0", - }, metrics[0].Tags()) - assert.Equal(t, exptime, metrics[0].Time().UnixNano()) - - metrics, err = parser.Parse([]byte(negativeFloat)) - assert.NoError(t, err) - assert.Len(t, metrics, 1) - assert.Equal(t, "cpu_load_short", metrics[0].Name()) - assert.Equal(t, map[string]interface{}{ - "value": float64(-13.4), - }, metrics[0].Fields()) - assert.Equal(t, map[string]string{ - "cpu": "cpu0", - }, metrics[0].Tags()) - assert.Equal(t, exptime, metrics[0].Time().UnixNano()) -} - -func TestParseLineValidInflux(t *testing.T) { - parser := InfluxParser{} - - metric, err := parser.ParseLine(validInflux) - assert.NoError(t, err) - assert.Equal(t, "cpu_load_short", metric.Name()) - assert.Equal(t, map[string]interface{}{ - "value": float64(10), - }, metric.Fields()) - assert.Equal(t, map[string]string{ - "cpu": "cpu0", - }, metric.Tags()) - assert.Equal(t, exptime, metric.Time().UnixNano()) - - metric, err = parser.ParseLine(validInfluxNewline) - assert.NoError(t, err) - assert.Equal(t, "cpu_load_short", metric.Name()) - assert.Equal(t, map[string]interface{}{ - "value": float64(10), - }, metric.Fields()) - assert.Equal(t, map[string]string{ - "cpu": "cpu0", - }, metric.Tags()) - assert.Equal(t, exptime, metric.Time().UnixNano()) -} - -func TestParseMultipleValid(t *testing.T) { - parser := InfluxParser{} - - metrics, err := parser.Parse([]byte(influxMulti)) - assert.NoError(t, err) - assert.Len(t, metrics, 7) - - for _, metric := range metrics { - assert.Equal(t, "cpu", metric.Name()) - assert.Equal(t, map[string]string{ - "datacenter": "us-east", - "host": "foo", - }, metrics[0].Tags()) - assert.Equal(t, map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), - }, metrics[0].Fields()) - } -} - -func TestParseSomeValid(t *testing.T) { - parser := InfluxParser{} - - metrics, err := parser.Parse([]byte(influxMultiSomeInvalid)) - assert.Error(t, err) - assert.Len(t, metrics, 4) - - for _, metric := range metrics { - assert.Equal(t, "cpu", metric.Name()) - assert.Equal(t, map[string]string{ - "datacenter": "us-east", - "host": "foo", - }, metrics[0].Tags()) - assert.Equal(t, map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), - }, metrics[0].Fields()) - } -} - -// Test that default tags are applied. -func TestParseDefaultTags(t *testing.T) { - parser := InfluxParser{ - DefaultTags: map[string]string{ - "tag": "default", - }, - } - - metrics, err := parser.Parse([]byte(influxMultiSomeInvalid)) - assert.Error(t, err) - assert.Len(t, metrics, 4) - - for _, metric := range metrics { - assert.Equal(t, "cpu", metric.Name()) - assert.Equal(t, map[string]string{ - "datacenter": "us-east", - "host": "foo", - "tag": "default", - }, metric.Tags()) - assert.Equal(t, map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), - }, metric.Fields()) - } -} - -// Verify that metric tags will override default tags -func TestParseDefaultTagsOverride(t *testing.T) { - parser := InfluxParser{ - DefaultTags: map[string]string{ - "host": "default", - }, - } - - metrics, err := parser.Parse([]byte(influxMultiSomeInvalid)) - assert.Error(t, err) - assert.Len(t, metrics, 4) - - for _, metric := range metrics { - assert.Equal(t, "cpu", metric.Name()) - assert.Equal(t, map[string]string{ - "datacenter": "us-east", - "host": "foo", - }, metrics[0].Tags()) - assert.Equal(t, map[string]interface{}{ - "usage_idle": float64(99), - "usage_busy": float64(1), - }, metrics[0].Fields()) - } -} - -func TestParseInvalidInflux(t *testing.T) { - parser := InfluxParser{} - - _, err := parser.Parse([]byte(invalidInflux)) - assert.Error(t, err) - _, err = parser.Parse([]byte(invalidInflux2)) - assert.Error(t, err) - _, err = parser.Parse([]byte(invalidInflux3)) - assert.Error(t, err) - fmt.Printf("%+v\n", err) // output for debug - _, err = parser.Parse([]byte(invalidInflux4)) - assert.Error(t, err) - - _, err = parser.ParseLine(invalidInflux) - assert.Error(t, err) - _, err = parser.ParseLine(invalidInflux2) - assert.Error(t, err) - _, err = parser.ParseLine(invalidInflux3) - assert.Error(t, err) - _, err = parser.ParseLine(invalidInflux4) - assert.Error(t, err) - -} - -func BenchmarkSingle(b *testing.B) { - parser := InfluxParser{} - b.ResetTimer() - for n := 0; n < b.N; n++ { - _, err := parser.Parse([]byte("cpu value=42\n")) - if err != nil { - panic(err) - } - } -} - -func BenchmarkParse(b *testing.B) { - var err error - parser := InfluxParser{} - for n := 0; n < b.N; n++ { - // parse: - ms, err = parser.Parse(metrics500) - if err != nil { - panic(err) - } - if len(ms) != 500 { - panic("500 metrics not parsed!!") - } - } -} - -func BenchmarkParseAddTagWrite(b *testing.B) { - var err error - parser := InfluxParser{} - for n := 0; n < b.N; n++ { - ms, err = parser.Parse(metrics500) - if err != nil { - panic(err) - } - if len(ms) != 500 { - panic("500 metrics not parsed!!") - } - for _, tmp := range ms { - tmp.AddTag("host", "localhost") - writer.Write(tmp.Serialize()) - } - } -} - -func init() { - var err error - metrics500, err = ioutil.ReadFile("500.metrics") +func Metric(v telegraf.Metric, err error) telegraf.Metric { if err != nil { panic(err) } + return v +} + +var DefaultTime = func() time.Time { + return time.Unix(42, 0) +} + +var ptests = []struct { + name string + input []byte + metrics []telegraf.Metric + err error +}{ + { + name: "minimal", + input: []byte("cpu value=42 0"), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ), + }, + err: nil, + }, + { + name: "minimal with newline", + input: []byte("cpu value=42 0\n"), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ), + }, + err: nil, + }, + { + name: "measurement escape space", + input: []byte(`c\ pu value=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "c pu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "measurement escape comma", + input: []byte(`c\,pu value=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "c,pu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "tags", + input: []byte(`cpu,cpu=cpu0,host=localhost value=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{ + "cpu": "cpu0", + "host": "localhost", + }, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "tags escape unescapable", + input: []byte(`cpu,ho\st=localhost value=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{ + `ho\st`: "localhost", + }, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "tags escape equals", + input: []byte(`cpu,ho\=st=localhost value=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{ + "ho=st": "localhost", + }, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "tags escape comma", + input: []byte(`cpu,ho\,st=localhost value=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{ + "ho,st": "localhost", + }, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field key escape not escapable", + input: []byte(`cpu va\lue=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + `va\lue`: 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field key escape equals", + input: []byte(`cpu va\=lue=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + `va=lue`: 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field key escape comma", + input: []byte(`cpu va\,lue=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + `va,lue`: 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field key escape space", + input: []byte(`cpu va\ lue=42`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + `va lue`: 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field int", + input: []byte("cpu value=42i"), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field boolean", + input: []byte("cpu value=true"), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": true, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field string", + input: []byte(`cpu value="42"`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": "42", + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field string escape quote", + input: []byte(`cpu value="how\"dy"`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + `value`: `how"dy`, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "field string escape backslash", + input: []byte(`cpu value="how\\dy"`), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + `value`: `how\dy`, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "default timestamp", + input: []byte("cpu value=42"), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "multiple lines", + input: []byte("cpu value=42\ncpu value=42"), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + Metric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(42, 0), + ), + ), + }, + err: nil, + }, + { + name: "invalid measurement only", + input: []byte("cpu"), + metrics: nil, + err: &ParseError{ + Offset: 3, + msg: ErrFieldParse.Error(), + buf: "cpu", + }, + }, + { + name: "procstat", + input: []byte("procstat,exe=bash,process_name=bash voluntary_context_switches=42i,memory_rss=5103616i,rlimit_memory_data_hard=2147483647i,cpu_time_user=0.02,rlimit_file_locks_soft=2147483647i,pid=29417i,cpu_time_nice=0,rlimit_memory_locked_soft=65536i,read_count=259i,rlimit_memory_vms_hard=2147483647i,memory_swap=0i,rlimit_num_fds_soft=1024i,rlimit_nice_priority_hard=0i,cpu_time_soft_irq=0,cpu_time=0i,rlimit_memory_locked_hard=65536i,realtime_priority=0i,signals_pending=0i,nice_priority=20i,cpu_time_idle=0,memory_stack=139264i,memory_locked=0i,rlimit_memory_stack_soft=8388608i,cpu_time_iowait=0,cpu_time_guest=0,cpu_time_guest_nice=0,rlimit_memory_data_soft=2147483647i,read_bytes=0i,rlimit_cpu_time_soft=2147483647i,involuntary_context_switches=2i,write_bytes=106496i,cpu_time_system=0,cpu_time_irq=0,cpu_usage=0,memory_vms=21659648i,memory_data=1576960i,rlimit_memory_stack_hard=2147483647i,num_threads=1i,cpu_time_stolen=0,rlimit_memory_rss_soft=2147483647i,rlimit_realtime_priority_soft=0i,num_fds=4i,write_count=35i,rlimit_signals_pending_soft=78994i,cpu_time_steal=0,rlimit_num_fds_hard=4096i,rlimit_file_locks_hard=2147483647i,rlimit_cpu_time_hard=2147483647i,rlimit_signals_pending_hard=78994i,rlimit_nice_priority_soft=0i,rlimit_memory_rss_hard=2147483647i,rlimit_memory_vms_soft=2147483647i,rlimit_realtime_priority_hard=0i 1517620624000000000"), + metrics: []telegraf.Metric{ + Metric( + metric.New( + "procstat", + map[string]string{ + "exe": "bash", + "process_name": "bash", + }, + map[string]interface{}{ + "cpu_time": 0, + "cpu_time_guest": float64(0), + "cpu_time_guest_nice": float64(0), + "cpu_time_idle": float64(0), + "cpu_time_iowait": float64(0), + "cpu_time_irq": float64(0), + "cpu_time_nice": float64(0), + "cpu_time_soft_irq": float64(0), + "cpu_time_steal": float64(0), + "cpu_time_stolen": float64(0), + "cpu_time_system": float64(0), + "cpu_time_user": float64(0.02), + "cpu_usage": float64(0), + "involuntary_context_switches": 2, + "memory_data": 1576960, + "memory_locked": 0, + "memory_rss": 5103616, + "memory_stack": 139264, + "memory_swap": 0, + "memory_vms": 21659648, + "nice_priority": 20, + "num_fds": 4, + "num_threads": 1, + "pid": 29417, + "read_bytes": 0, + "read_count": 259, + "realtime_priority": 0, + "rlimit_cpu_time_hard": 2147483647, + "rlimit_cpu_time_soft": 2147483647, + "rlimit_file_locks_hard": 2147483647, + "rlimit_file_locks_soft": 2147483647, + "rlimit_memory_data_hard": 2147483647, + "rlimit_memory_data_soft": 2147483647, + "rlimit_memory_locked_hard": 65536, + "rlimit_memory_locked_soft": 65536, + "rlimit_memory_rss_hard": 2147483647, + "rlimit_memory_rss_soft": 2147483647, + "rlimit_memory_stack_hard": 2147483647, + "rlimit_memory_stack_soft": 8388608, + "rlimit_memory_vms_hard": 2147483647, + "rlimit_memory_vms_soft": 2147483647, + "rlimit_nice_priority_hard": 0, + "rlimit_nice_priority_soft": 0, + "rlimit_num_fds_hard": 4096, + "rlimit_num_fds_soft": 1024, + "rlimit_realtime_priority_hard": 0, + "rlimit_realtime_priority_soft": 0, + "rlimit_signals_pending_hard": 78994, + "rlimit_signals_pending_soft": 78994, + "signals_pending": 0, + "voluntary_context_switches": 42, + "write_bytes": 106496, + "write_count": 35, + }, + time.Unix(0, 1517620624000000000), + ), + ), + }, + err: nil, + }, +} + +func TestParser(t *testing.T) { + for _, tt := range ptests { + t.Run(tt.name, func(t *testing.T) { + handler := NewMetricHandler() + handler.SetTimeFunc(DefaultTime) + parser := NewParser(handler) + + metrics, err := parser.Parse(tt.input) + require.Equal(t, tt.err, err) + + require.Equal(t, len(tt.metrics), len(metrics)) + for i, expected := range tt.metrics { + require.Equal(t, expected.Name(), metrics[i].Name()) + require.Equal(t, expected.Tags(), metrics[i].Tags()) + require.Equal(t, expected.Fields(), metrics[i].Fields()) + require.Equal(t, expected.Time(), metrics[i].Time()) + } + }) + } +} + +func BenchmarkParser(b *testing.B) { + for _, tt := range ptests { + b.Run(tt.name, func(b *testing.B) { + handler := NewMetricHandler() + parser := NewParser(handler) + for n := 0; n < b.N; n++ { + metrics, err := parser.Parse(tt.input) + _ = err + _ = metrics + } + }) + } } diff --git a/plugins/parsers/nagios/parser.go b/plugins/parsers/nagios/parser.go index 621a3514c..4d5f7f008 100644 --- a/plugins/parsers/nagios/parser.go +++ b/plugins/parsers/nagios/parser.go @@ -2,6 +2,7 @@ package nagios import ( "regexp" + "strconv" "strings" "time" @@ -72,23 +73,41 @@ func (p *NagiosParser) Parse(buf []byte) ([]telegraf.Metric, error) { fieldName := string(perf[0][1]) tags := make(map[string]string) if perf[0][3] != nil { - tags["unit"] = string(perf[0][3]) + str := string(perf[0][3]) + if str != "" { + tags["unit"] = str + } } fields := make(map[string]interface{}) - fields["value"] = perf[0][2] + f, err := strconv.ParseFloat(string(perf[0][2]), 64) + if err == nil { + fields["value"] = f + } // TODO should we set empty field // if metric if there is no data ? if perf[0][4] != nil { - fields["warning"] = perf[0][4] + f, err := strconv.ParseFloat(string(perf[0][4]), 64) + if err == nil { + fields["warning"] = f + } } if perf[0][5] != nil { - fields["critical"] = perf[0][5] + f, err := strconv.ParseFloat(string(perf[0][5]), 64) + if err == nil { + fields["critical"] = f + } } if perf[0][6] != nil { - fields["min"] = perf[0][6] + f, err := strconv.ParseFloat(string(perf[0][6]), 64) + if err == nil { + fields["min"] = f + } } if perf[0][7] != nil { - fields["max"] = perf[0][7] + f, err := strconv.ParseFloat(string(perf[0][7]), 64) + if err == nil { + fields["max"] = f + } } // Create metric metric, err := metric.New(fieldName, tags, fields, time.Now().UTC()) diff --git a/plugins/parsers/registry.go b/plugins/parsers/registry.go index fbeca17e8..177726dbb 100644 --- a/plugins/parsers/registry.go +++ b/plugins/parsers/registry.go @@ -134,7 +134,8 @@ func NewNagiosParser() (Parser, error) { } func NewInfluxParser() (Parser, error) { - return &influx.InfluxParser{}, nil + handler := influx.NewMetricHandler() + return influx.NewParser(handler), nil } func NewGraphiteParser( diff --git a/plugins/processors/override/override.go b/plugins/processors/override/override.go index 46a2f84db..7f8798806 100644 --- a/plugins/processors/override/override.go +++ b/plugins/processors/override/override.go @@ -37,10 +37,10 @@ func (p *Override) Apply(in ...telegraf.Metric) []telegraf.Metric { metric.SetName(p.NameOverride) } if len(p.NamePrefix) > 0 { - metric.SetPrefix(p.NamePrefix) + metric.AddPrefix(p.NamePrefix) } if len(p.NameSuffix) > 0 { - metric.SetSuffix(p.NameSuffix) + metric.AddSuffix(p.NameSuffix) } for key, value := range p.Tags { metric.AddTag(key, value) diff --git a/plugins/processors/printer/printer.go b/plugins/processors/printer/printer.go index a65a104e6..363e9a21d 100644 --- a/plugins/processors/printer/printer.go +++ b/plugins/processors/printer/printer.go @@ -5,9 +5,12 @@ import ( "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/plugins/processors" + "github.com/influxdata/telegraf/plugins/serializers" + "github.com/influxdata/telegraf/plugins/serializers/influx" ) type Printer struct { + serializer serializers.Serializer } var sampleConfig = ` @@ -23,13 +26,19 @@ func (p *Printer) Description() string { func (p *Printer) Apply(in ...telegraf.Metric) []telegraf.Metric { for _, metric := range in { - fmt.Println(metric.String()) + octets, err := p.serializer.Serialize(metric) + if err != nil { + continue + } + fmt.Println(octets) } return in } func init() { processors.Add("printer", func() telegraf.Processor { - return &Printer{} + return &Printer{ + serializer: influx.NewSerializer(), + } }) } diff --git a/plugins/serializers/graphite/graphite.go b/plugins/serializers/graphite/graphite.go index f88305ab4..ee390d17f 100644 --- a/plugins/serializers/graphite/graphite.go +++ b/plugins/serializers/graphite/graphite.go @@ -35,7 +35,7 @@ func (s *GraphiteSerializer) Serialize(metric telegraf.Metric) ([]byte, error) { out := []byte{} // Convert UnixNano to Unix timestamps - timestamp := metric.UnixNano() / 1000000000 + timestamp := metric.Time().UnixNano() / 1000000000 bucket := SerializeBucketName(metric.Name(), metric.Tags(), s.Template, s.Prefix) if bucket == "" { diff --git a/plugins/serializers/influx/escape.go b/plugins/serializers/influx/escape.go new file mode 100644 index 000000000..2040b5eed --- /dev/null +++ b/plugins/serializers/influx/escape.go @@ -0,0 +1,52 @@ +package influx + +import "strings" + +const ( + escapes = " ,=" + nameEscapes = " ," + stringFieldEscapes = `\"` +) + +var ( + escaper = strings.NewReplacer( + `,`, `\,`, + `"`, `\"`, // ??? + ` `, `\ `, + `=`, `\=`, + ) + + nameEscaper = strings.NewReplacer( + `,`, `\,`, + ` `, `\ `, + ) + + stringFieldEscaper = strings.NewReplacer( + `"`, `\"`, + `\`, `\\`, + ) +) + +func escape(s string) string { + if strings.ContainsAny(s, escapes) { + return escaper.Replace(s) + } else { + return s + } +} + +func nameEscape(s string) string { + if strings.ContainsAny(s, nameEscapes) { + return nameEscaper.Replace(s) + } else { + return s + } +} + +func stringFieldEscape(s string) string { + if strings.ContainsAny(s, stringFieldEscapes) { + return stringFieldEscaper.Replace(s) + } else { + return s + } +} diff --git a/plugins/serializers/influx/influx.go b/plugins/serializers/influx/influx.go index 459a8a74b..51aed0d09 100644 --- a/plugins/serializers/influx/influx.go +++ b/plugins/serializers/influx/influx.go @@ -1,12 +1,277 @@ package influx import ( + "bytes" + "errors" + "io" + "math" + "sort" + "strconv" + "github.com/influxdata/telegraf" ) -type InfluxSerializer struct { +const MaxInt = int(^uint(0) >> 1) + +type FieldSortOrder int + +const ( + NoSortFields FieldSortOrder = iota + SortFields +) + +var ( + ErrNeedMoreSpace = errors.New("need more space") + ErrInvalidName = errors.New("invalid name") + ErrInvalidFieldKey = errors.New("invalid field key") + ErrInvalidFieldType = errors.New("invalid field type") + ErrFieldIsNaN = errors.New("is NaN") + ErrFieldIsInf = errors.New("is Inf") + ErrNoFields = errors.New("no fields") +) + +// Serializer is a serializer for line protocol. +type Serializer struct { + maxLineBytes int + bytesWritten int + fieldSortOrder FieldSortOrder + + buf bytes.Buffer + header []byte + footer []byte + pair []byte } -func (s *InfluxSerializer) Serialize(m telegraf.Metric) ([]byte, error) { - return m.Serialize(), nil +func NewSerializer() *Serializer { + serializer := &Serializer{ + fieldSortOrder: NoSortFields, + + header: make([]byte, 0, 50), + footer: make([]byte, 0, 21), + pair: make([]byte, 0, 50), + } + return serializer +} + +func (s *Serializer) SetMaxLineBytes(bytes int) { + s.maxLineBytes = bytes +} + +func (s *Serializer) SetFieldSortOrder(order FieldSortOrder) { + s.fieldSortOrder = order +} + +// Serialize writes the telegraf.Metric to a byte slice. May produce multiple +// lines of output if longer than maximum line length. Lines are terminated +// with a newline (LF) char. +func (s *Serializer) Serialize(m telegraf.Metric) ([]byte, error) { + s.buf.Reset() + err := s.writeMetric(&s.buf, m) + if err != nil { + return nil, err + } + + out := make([]byte, s.buf.Len()) + copy(out, s.buf.Bytes()) + return out, nil +} + +func (s *Serializer) Write(w io.Writer, m telegraf.Metric) (int, error) { + err := s.writeMetric(w, m) + return s.bytesWritten, err +} + +func (s *Serializer) writeString(w io.Writer, str string) error { + n, err := io.WriteString(w, str) + s.bytesWritten += n + return err +} + +func (s *Serializer) write(w io.Writer, b []byte) error { + n, err := w.Write(b) + s.bytesWritten += n + return err +} + +func (s *Serializer) buildHeader(m telegraf.Metric) error { + s.header = s.header[:0] + + name := nameEscape(m.Name()) + if name == "" { + return ErrInvalidName + } + + s.header = append(s.header, name...) + + for _, tag := range m.TagList() { + key := escape(tag.Key) + value := escape(tag.Value) + + // Some keys and values are not encodeable as line protocol, such as + // those with a trailing '\' or empty strings. + if key == "" || value == "" { + continue + } + + s.header = append(s.header, ',') + s.header = append(s.header, key...) + s.header = append(s.header, '=') + s.header = append(s.header, value...) + } + + s.header = append(s.header, ' ') + return nil +} + +func (s *Serializer) buildFooter(m telegraf.Metric) { + s.footer = s.footer[:0] + s.footer = append(s.footer, ' ') + s.footer = strconv.AppendInt(s.footer, m.Time().UnixNano(), 10) + s.footer = append(s.footer, '\n') +} + +func (s *Serializer) buildFieldPair(key string, value interface{}) error { + s.pair = s.pair[:0] + key = escape(key) + + // Some keys are not encodeable as line protocol, such as those with a + // trailing '\' or empty strings. + if key == "" { + return ErrInvalidFieldKey + } + + s.pair = append(s.pair, key...) + s.pair = append(s.pair, '=') + pair, err := appendFieldValue(s.pair, value) + if err != nil { + return err + } + s.pair = pair + return nil +} + +func (s *Serializer) writeMetric(w io.Writer, m telegraf.Metric) error { + var err error + + err = s.buildHeader(m) + if err != nil { + return err + } + + s.buildFooter(m) + + if s.fieldSortOrder == SortFields { + sort.Slice(m.FieldList(), func(i, j int) bool { + return m.FieldList()[i].Key < m.FieldList()[j].Key + }) + } + + pairsLen := 0 + firstField := true + for _, field := range m.FieldList() { + err = s.buildFieldPair(field.Key, field.Value) + if err != nil { + continue + } + + bytesNeeded := len(s.header) + pairsLen + len(s.pair) + len(s.footer) + + // Additional length needed for field separator `,` + if !firstField { + bytesNeeded += 1 + } + + if s.maxLineBytes > 0 && bytesNeeded > s.maxLineBytes { + // Need at least one field per line + if firstField { + return ErrNeedMoreSpace + } + + err = s.write(w, s.footer) + if err != nil { + return err + } + + bytesNeeded = len(s.header) + len(s.pair) + len(s.footer) + + if s.maxLineBytes > 0 && bytesNeeded > s.maxLineBytes { + return ErrNeedMoreSpace + } + + err = s.write(w, s.header) + if err != nil { + return err + } + + s.write(w, s.pair) + pairsLen += len(s.pair) + firstField = false + continue + } + + if firstField { + err = s.write(w, s.header) + if err != nil { + return err + } + } else { + err = s.writeString(w, ",") + if err != nil { + return err + } + } + + s.write(w, s.pair) + + pairsLen += len(s.pair) + firstField = false + } + + if firstField { + return ErrNoFields + } + + return s.write(w, s.footer) + +} + +func appendFieldValue(buf []byte, value interface{}) ([]byte, error) { + switch v := value.(type) { + case int64: + return appendIntField(buf, v), nil + case float64: + if math.IsNaN(v) { + return nil, ErrFieldIsNaN + } + + if math.IsInf(v, 0) { + return nil, ErrFieldIsInf + } + + return appendFloatField(buf, v), nil + case string: + return appendStringField(buf, v), nil + case bool: + return appendBoolField(buf, v), nil + } + return buf, ErrInvalidFieldType +} + +func appendIntField(buf []byte, value int64) []byte { + return append(strconv.AppendInt(buf, value, 10), 'i') +} + +func appendFloatField(buf []byte, value float64) []byte { + return strconv.AppendFloat(buf, value, 'g', -1, 64) +} + +func appendBoolField(buf []byte, value bool) []byte { + return strconv.AppendBool(buf, value) +} + +func appendStringField(buf []byte, value string) []byte { + buf = append(buf, '"') + buf = append(buf, stringFieldEscape(value)...) + buf = append(buf, '"') + return buf } diff --git a/plugins/serializers/influx/influx_test.go b/plugins/serializers/influx/influx_test.go index 7ced52103..2795cfb38 100644 --- a/plugins/serializers/influx/influx_test.go +++ b/plugins/serializers/influx/influx_test.go @@ -1,72 +1,330 @@ package influx import ( - "fmt" - "strings" + "math" "testing" "time" - "github.com/stretchr/testify/assert" - + "github.com/influxdata/telegraf" "github.com/influxdata/telegraf/metric" + "github.com/stretchr/testify/require" ) -func TestSerializeMetricFloat(t *testing.T) { - now := time.Now() - tags := map[string]string{ - "cpu": "cpu0", +func MustMetric(v telegraf.Metric, err error) telegraf.Metric { + if err != nil { + panic(err) } - fields := map[string]interface{}{ - "usage_idle": float64(91.5), - } - m, err := metric.New("cpu", tags, fields, now) - assert.NoError(t, err) - - s := InfluxSerializer{} - buf, _ := s.Serialize(m) - mS := strings.Split(strings.TrimSpace(string(buf)), "\n") - assert.NoError(t, err) - - expS := []string{fmt.Sprintf("cpu,cpu=cpu0 usage_idle=91.5 %d", now.UnixNano())} - assert.Equal(t, expS, mS) + return v } -func TestSerializeMetricInt(t *testing.T) { - now := time.Now() - tags := map[string]string{ - "cpu": "cpu0", - } - fields := map[string]interface{}{ - "usage_idle": int64(90), - } - m, err := metric.New("cpu", tags, fields, now) - assert.NoError(t, err) - - s := InfluxSerializer{} - buf, _ := s.Serialize(m) - mS := strings.Split(strings.TrimSpace(string(buf)), "\n") - assert.NoError(t, err) - - expS := []string{fmt.Sprintf("cpu,cpu=cpu0 usage_idle=90i %d", now.UnixNano())} - assert.Equal(t, expS, mS) +var tests = []struct { + name string + maxBytes int + input telegraf.Metric + output []byte + err error +}{ + { + name: "minimal", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ), + output: []byte("cpu value=42 0\n"), + }, + { + name: "multiple tags", + input: MustMetric( + metric.New( + "cpu", + map[string]string{ + "host": "localhost", + "cpu": "CPU0", + }, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ), + output: []byte("cpu,cpu=CPU0,host=localhost value=42 0\n"), + }, + { + name: "multiple fields", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "x": 42.0, + "y": 42.0, + }, + time.Unix(0, 0), + ), + ), + output: []byte("cpu x=42,y=42 0\n"), + }, + { + name: "float NaN", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "x": math.NaN(), + "y": 42, + }, + time.Unix(0, 0), + ), + ), + output: []byte("cpu y=42i 0\n"), + }, + { + name: "float NaN only", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": math.NaN(), + }, + time.Unix(0, 0), + ), + ), + err: ErrNoFields, + }, + { + name: "float Inf", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": math.Inf(1), + "y": 42, + }, + time.Unix(0, 0), + ), + ), + output: []byte("cpu y=42i 0\n"), + }, + { + name: "integer field", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42, + }, + time.Unix(0, 0), + ), + ), + output: []byte("cpu value=42i 0\n"), + }, + { + name: "bool field", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": true, + }, + time.Unix(0, 0), + ), + ), + output: []byte("cpu value=true 0\n"), + }, + { + name: "string field", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": "howdy", + }, + time.Unix(0, 0), + ), + ), + output: []byte("cpu value=\"howdy\" 0\n"), + }, + { + name: "timestamp", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(1519194109, 42), + ), + ), + output: []byte("cpu value=42 1519194109000000042\n"), + }, + { + name: "split fields exact", + maxBytes: 33, + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "abc": 123, + "def": 456, + }, + time.Unix(1519194109, 42), + ), + ), + output: []byte("cpu abc=123i 1519194109000000042\ncpu def=456i 1519194109000000042\n"), + }, + { + name: "split fields extra", + maxBytes: 34, + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "abc": 123, + "def": 456, + }, + time.Unix(1519194109, 42), + ), + ), + output: []byte("cpu abc=123i 1519194109000000042\ncpu def=456i 1519194109000000042\n"), + }, + { + name: "need more space", + maxBytes: 32, + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "abc": 123, + "def": 456, + }, + time.Unix(1519194109, 42), + ), + ), + output: nil, + err: ErrNeedMoreSpace, + }, + { + name: "no fields", + input: MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{}, + time.Unix(0, 0), + ), + ), + err: ErrNoFields, + }, + { + name: "procstat", + input: MustMetric( + metric.New( + "procstat", + map[string]string{ + "exe": "bash", + "process_name": "bash", + }, + map[string]interface{}{ + "cpu_time": 0, + "cpu_time_guest": float64(0), + "cpu_time_guest_nice": float64(0), + "cpu_time_idle": float64(0), + "cpu_time_iowait": float64(0), + "cpu_time_irq": float64(0), + "cpu_time_nice": float64(0), + "cpu_time_soft_irq": float64(0), + "cpu_time_steal": float64(0), + "cpu_time_stolen": float64(0), + "cpu_time_system": float64(0), + "cpu_time_user": float64(0.02), + "cpu_usage": float64(0), + "involuntary_context_switches": 2, + "memory_data": 1576960, + "memory_locked": 0, + "memory_rss": 5103616, + "memory_stack": 139264, + "memory_swap": 0, + "memory_vms": 21659648, + "nice_priority": 20, + "num_fds": 4, + "num_threads": 1, + "pid": 29417, + "read_bytes": 0, + "read_count": 259, + "realtime_priority": 0, + "rlimit_cpu_time_hard": 2147483647, + "rlimit_cpu_time_soft": 2147483647, + "rlimit_file_locks_hard": 2147483647, + "rlimit_file_locks_soft": 2147483647, + "rlimit_memory_data_hard": 2147483647, + "rlimit_memory_data_soft": 2147483647, + "rlimit_memory_locked_hard": 65536, + "rlimit_memory_locked_soft": 65536, + "rlimit_memory_rss_hard": 2147483647, + "rlimit_memory_rss_soft": 2147483647, + "rlimit_memory_stack_hard": 2147483647, + "rlimit_memory_stack_soft": 8388608, + "rlimit_memory_vms_hard": 2147483647, + "rlimit_memory_vms_soft": 2147483647, + "rlimit_nice_priority_hard": 0, + "rlimit_nice_priority_soft": 0, + "rlimit_num_fds_hard": 4096, + "rlimit_num_fds_soft": 1024, + "rlimit_realtime_priority_hard": 0, + "rlimit_realtime_priority_soft": 0, + "rlimit_signals_pending_hard": 78994, + "rlimit_signals_pending_soft": 78994, + "signals_pending": 0, + "voluntary_context_switches": 42, + "write_bytes": 106496, + "write_count": 35, + }, + time.Unix(0, 1517620624000000000), + ), + ), + output: []byte("procstat,exe=bash,process_name=bash cpu_time=0i,cpu_time_guest=0,cpu_time_guest_nice=0,cpu_time_idle=0,cpu_time_iowait=0,cpu_time_irq=0,cpu_time_nice=0,cpu_time_soft_irq=0,cpu_time_steal=0,cpu_time_stolen=0,cpu_time_system=0,cpu_time_user=0.02,cpu_usage=0,involuntary_context_switches=2i,memory_data=1576960i,memory_locked=0i,memory_rss=5103616i,memory_stack=139264i,memory_swap=0i,memory_vms=21659648i,nice_priority=20i,num_fds=4i,num_threads=1i,pid=29417i,read_bytes=0i,read_count=259i,realtime_priority=0i,rlimit_cpu_time_hard=2147483647i,rlimit_cpu_time_soft=2147483647i,rlimit_file_locks_hard=2147483647i,rlimit_file_locks_soft=2147483647i,rlimit_memory_data_hard=2147483647i,rlimit_memory_data_soft=2147483647i,rlimit_memory_locked_hard=65536i,rlimit_memory_locked_soft=65536i,rlimit_memory_rss_hard=2147483647i,rlimit_memory_rss_soft=2147483647i,rlimit_memory_stack_hard=2147483647i,rlimit_memory_stack_soft=8388608i,rlimit_memory_vms_hard=2147483647i,rlimit_memory_vms_soft=2147483647i,rlimit_nice_priority_hard=0i,rlimit_nice_priority_soft=0i,rlimit_num_fds_hard=4096i,rlimit_num_fds_soft=1024i,rlimit_realtime_priority_hard=0i,rlimit_realtime_priority_soft=0i,rlimit_signals_pending_hard=78994i,rlimit_signals_pending_soft=78994i,signals_pending=0i,voluntary_context_switches=42i,write_bytes=106496i,write_count=35i 1517620624000000000\n"), + }, } -func TestSerializeMetricString(t *testing.T) { - now := time.Now() - tags := map[string]string{ - "cpu": "cpu0", +func TestSerializer(t *testing.T) { + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + serializer := NewSerializer() + serializer.SetMaxLineBytes(tt.maxBytes) + serializer.SetFieldSortOrder(SortFields) + output, err := serializer.Serialize(tt.input) + require.Equal(t, tt.err, err) + require.Equal(t, string(tt.output), string(output)) + }) + } +} + +func BenchmarkSerializer(b *testing.B) { + for _, tt := range tests { + b.Run(tt.name, func(b *testing.B) { + serializer := NewSerializer() + serializer.SetMaxLineBytes(tt.maxBytes) + for n := 0; n < b.N; n++ { + output, err := serializer.Serialize(tt.input) + _ = err + _ = output + } + }) } - fields := map[string]interface{}{ - "usage_idle": "foobar", - } - m, err := metric.New("cpu", tags, fields, now) - assert.NoError(t, err) - - s := InfluxSerializer{} - buf, _ := s.Serialize(m) - mS := strings.Split(strings.TrimSpace(string(buf)), "\n") - assert.NoError(t, err) - - expS := []string{fmt.Sprintf("cpu,cpu=cpu0 usage_idle=\"foobar\" %d", now.UnixNano())} - assert.Equal(t, expS, mS) } diff --git a/plugins/serializers/influx/reader.go b/plugins/serializers/influx/reader.go new file mode 100644 index 000000000..590e2fafd --- /dev/null +++ b/plugins/serializers/influx/reader.go @@ -0,0 +1,58 @@ +package influx + +import ( + "bytes" + "io" + + "github.com/influxdata/telegraf" +) + +// reader is an io.Reader for line protocol. +type reader struct { + metrics []telegraf.Metric + serializer *Serializer + offset int + buf *bytes.Buffer +} + +// NewReader creates a new reader over the given metrics. +func NewReader(metrics []telegraf.Metric, serializer *Serializer) io.Reader { + return &reader{ + metrics: metrics, + serializer: serializer, + offset: 0, + buf: bytes.NewBuffer(make([]byte, 0, serializer.maxLineBytes)), + } +} + +// SetMetrics changes the metrics to be read. +func (r *reader) SetMetrics(metrics []telegraf.Metric) { + r.metrics = metrics + r.offset = 0 + r.buf.Reset() +} + +// Read reads up to len(p) bytes of the current metric into p, each call will +// only serialize at most one metric so the number of bytes read may be less +// than p. Subsequent calls to Read will read the next metric until all are +// emitted. If a metric cannot be serialized, an error will be returned, you +// may resume with the next metric by calling Read again. When all metrics +// are emitted the err is io.EOF. +func (r *reader) Read(p []byte) (int, error) { + if r.buf.Len() > 0 { + return r.buf.Read(p) + } + + if r.offset >= len(r.metrics) { + return 0, io.EOF + } + + _, err := r.serializer.Write(r.buf, r.metrics[r.offset]) + r.offset += 1 + if err != nil { + r.buf.Reset() + return 0, err + } + + return r.buf.Read(p) +} diff --git a/plugins/serializers/influx/reader_test.go b/plugins/serializers/influx/reader_test.go new file mode 100644 index 000000000..5dca21595 --- /dev/null +++ b/plugins/serializers/influx/reader_test.go @@ -0,0 +1,135 @@ +package influx + +import ( + "bytes" + "io" + "testing" + "time" + + "github.com/influxdata/telegraf" + "github.com/influxdata/telegraf/metric" + "github.com/stretchr/testify/require" +) + +func TestReader(t *testing.T) { + tests := []struct { + name string + maxLineBytes int + bufferSize int + input []telegraf.Metric + expected []byte + }{ + { + name: "minimal", + maxLineBytes: 4096, + bufferSize: 20, + input: []telegraf.Metric{ + MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ), + }, + expected: []byte("cpu value=42 0\n"), + }, + { + name: "multiple lines", + maxLineBytes: 4096, + bufferSize: 20, + input: []telegraf.Metric{ + MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ), + MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ), + }, + expected: []byte("cpu value=42 0\ncpu value=42 0\n"), + }, + { + name: "exact fit", + maxLineBytes: 4096, + bufferSize: 15, + input: []telegraf.Metric{ + MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ), + }, + expected: []byte("cpu value=42 0\n"), + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + serializer := NewSerializer() + serializer.SetMaxLineBytes(tt.maxLineBytes) + serializer.SetFieldSortOrder(SortFields) + reader := NewReader(tt.input, serializer) + + data := new(bytes.Buffer) + readbuf := make([]byte, tt.bufferSize) + + total := 0 + for { + n, err := reader.Read(readbuf) + total += n + if err == io.EOF { + break + } + + data.Write(readbuf[:n]) + require.NoError(t, err) + } + require.Equal(t, tt.expected, data.Bytes()) + require.Equal(t, len(tt.expected), total) + }) + } +} + +func TestZeroLengthBufferNoError(t *testing.T) { + m := MustMetric( + metric.New( + "cpu", + map[string]string{}, + map[string]interface{}{ + "value": 42.0, + }, + time.Unix(0, 0), + ), + ) + serializer := NewSerializer() + serializer.SetFieldSortOrder(SortFields) + reader := NewReader([]telegraf.Metric{m}, serializer) + + readbuf := make([]byte, 0) + + n, err := reader.Read(readbuf) + require.NoError(t, err) + require.Equal(t, 0, n) +} diff --git a/plugins/serializers/json/json.go b/plugins/serializers/json/json.go index 452364c95..f988bf40e 100644 --- a/plugins/serializers/json/json.go +++ b/plugins/serializers/json/json.go @@ -22,7 +22,7 @@ func (s *JsonSerializer) Serialize(metric telegraf.Metric) ([]byte, error) { m["tags"] = metric.Tags() m["fields"] = metric.Fields() m["name"] = metric.Name() - m["timestamp"] = metric.UnixNano() / units_nanoseconds + m["timestamp"] = metric.Time().UnixNano() / units_nanoseconds serialized, err := ejson.Marshal(m) if err != nil { return []byte{}, err diff --git a/plugins/serializers/registry.go b/plugins/serializers/registry.go index 368f6f449..3389ec59c 100644 --- a/plugins/serializers/registry.go +++ b/plugins/serializers/registry.go @@ -33,6 +33,13 @@ type Config struct { // Dataformat can be one of: influx, graphite, or json DataFormat string + // Maximum line length in bytes; influx format only + InfluxMaxLineBytes int + + // Sort field keys, set to true only when debugging as it less performant + // than unsorted fields; influx format only + InfluxSortFields bool + // Prefix to add to all measurements, only supports Graphite Prefix string @@ -50,7 +57,7 @@ func NewSerializer(config *Config) (Serializer, error) { var serializer Serializer switch config.DataFormat { case "influx": - serializer, err = NewInfluxSerializer() + serializer, err = NewInfluxSerializerConfig(config) case "graphite": serializer, err = NewGraphiteSerializer(config.Prefix, config.Template) case "json": @@ -65,8 +72,19 @@ func NewJsonSerializer(timestampUnits time.Duration) (Serializer, error) { return &json.JsonSerializer{TimestampUnits: timestampUnits}, nil } +func NewInfluxSerializerConfig(config *Config) (Serializer, error) { + var sort influx.FieldSortOrder + if config.InfluxSortFields { + sort = influx.SortFields + } + s := influx.NewSerializer() + s.SetMaxLineBytes(config.InfluxMaxLineBytes) + s.SetFieldSortOrder(sort) + return s, nil +} + func NewInfluxSerializer() (Serializer, error) { - return &influx.InfluxSerializer{}, nil + return influx.NewSerializer(), nil } func NewGraphiteSerializer(prefix, template string) (Serializer, error) {