Skip to content

Commit

Permalink
use fasthttp, begin flatbuffer
Browse files Browse the repository at this point in the history
  • Loading branch information
blind-oracle committed Sep 29, 2019
1 parent 28694a0 commit 142184a
Show file tree
Hide file tree
Showing 6 changed files with 360 additions and 21 deletions.
23 changes: 23 additions & 0 deletions flatm.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace flatm;

table Attr {
name: string;
value: string;
}

table Metric {
host: string;
service: string;
state: string;
description: string;
time: int64;
value: float64;
tags: [string];
attrs: [Attr];
}

table Batch {
metrics: [Metric];
}

root_type Batch;
56 changes: 56 additions & 0 deletions flatm/Attr.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions flatm/Batch.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

157 changes: 157 additions & 0 deletions flatm/Metric.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions outputTgt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
fmt "fmt"
"net"
"net/http"
fh "github.com/valyala/fasthttp"
"net/url"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -89,8 +89,12 @@ func newOutputTgt(h string, cf *outputCfg, o *output) (*target, error) {

c.alive = true
c.writeBatch = c.writeBatchClickhouse
c.httpCli = &http.Client{
Timeout: c.timeoutWrite,
// c.httpCli = &http.Client{
// Timeout: c.timeoutWrite,
// }

c.httpCli = &fh.Client{
WriteTimeout: c.timeoutWrite,
}

u, err := url.Parse(h)
Expand Down

0 comments on commit 142184a

Please sign in to comment.