Merge pull request #10125 from sangyun-han/master

update UDP client example
pull/9784/merge
Jonathan A. Sternberg 2018-10-01 16:16:06 -05:00 committed by GitHub
commit 857afc1006
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 4 deletions

View File

@ -73,7 +73,7 @@ func main() {
log.Fatal(err)
}
defer c.Close()
// Create a new point batch
bp, err := client.NewBatchPoints(client.BatchPointsConfig{
Database: MyDB,
@ -101,7 +101,7 @@ func main() {
if err := c.Write(bp); err != nil {
log.Fatal(err)
}
// Close client resources
if err := c.Close(); err != nil {
log.Fatal(err)
@ -250,11 +250,12 @@ The **InfluxDB** client also supports writing over UDP.
```go
func WriteUDP() {
// Make client
c, err := client.NewUDPClient("localhost:8089")
// PayloadSize is default value(512)
c, err := client.NewUDPClient(client.UDPConfig{Addr: "localhost:8089"})
if err != nil {
panic(err.Error())
}
// Create a new point batch
bp, _ := client.NewBatchPoints(client.BatchPointsConfig{
Precision: "s",