()
| 10 | ) |
| 11 | |
| 12 | func ExampleCounter() { |
| 13 | in := New(map[string]string{"a": "b"}, influxdb.BatchPointsConfig{}, log.NewNopLogger()) |
| 14 | counter := in.NewCounter("influx_counter") |
| 15 | counter.Add(10) |
| 16 | counter.With("error", "true").Add(1) |
| 17 | counter.With("error", "false").Add(2) |
| 18 | counter.Add(50) |
| 19 | |
| 20 | client := &bufWriter{} |
| 21 | in.WriteTo(client) |
| 22 | |
| 23 | expectedLines := []string{ |
| 24 | `(influx_counter,a=b count=60) [0-9]{19}`, |
| 25 | `(influx_counter,a=b,error=true count=1) [0-9]{19}`, |
| 26 | `(influx_counter,a=b,error=false count=2) [0-9]{19}`, |
| 27 | } |
| 28 | |
| 29 | if err := extractAndPrintMessage(expectedLines, client.buf.String()); err != nil { |
| 30 | fmt.Println(err.Error()) |
| 31 | } |
| 32 | |
| 33 | // Output: |
| 34 | // influx_counter,a=b count=60 |
| 35 | // influx_counter,a=b,error=true count=1 |
| 36 | // influx_counter,a=b,error=false count=2 |
| 37 | } |
| 38 | |
| 39 | func ExampleGauge() { |
| 40 | in := New(map[string]string{"a": "b"}, influxdb.BatchPointsConfig{}, log.NewNopLogger()) |
nothing calls this directly
no test coverage detected
searching dependent graphs…