Skip to content

Commit 86d2906

Browse files
committed
ci: release v1.10.0
1 parent ac78fa0 commit 86d2906

File tree

7 files changed

+83
-97
lines changed

7 files changed

+83
-97
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22
*CURRENT*
33
---
44

5+
- 2019-08-20 (Laisky) ci: upgrade go-utils
6+
- 2019-08-20 (Laisky) ci: upgrade go-utils
7+
- 2019-08-19 (Laisky) docs: update quickstart
8+
- 2019-08-19 (Laisky) feat: enable gz in journal
9+
- 2019-08-19 (Laisky) style: more log
10+
11+
*v1.9.3*
12+
---
13+
14+
- 2019-08-15 (Laisky) build: upgrade go-utils to v1.5.4
15+
- 2019-08-15 (Laisky) fix: double default postfilter
16+
- 2019-08-14 (Laisky) docs: update changelog
517
- 2019-08-14 (Laisky) feat: support `@RANDOM_STRING`
618
- 2019-08-14 (Laisky) build: upgrade to go 1.12.7
719
- 2019-08-14 (Laisky) feat(paas-390): add wuling mapping

docs/quickstart.md

Lines changed: 47 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@
22

33
Running a minimal example with app, go-fluentd and fluentd.
44

5-
App ---> Go-Fluentd ---> Fluentd
5+
App ---> Go-Fluentd(with stdout sender plugin)
66

77
- App: generate and emit logs
88
- Go-Fluentd: collect and parse log
9-
- Fluentd: just a example for backend, it also could be ElasticSearch or something else
10-
119

1210

1311
## Prepare
@@ -37,7 +35,6 @@ $ sudo docker-compose ps
3735

3836
Name Command State Ports
3937
-----------------------------------------------------------------------------------------------------------------------
40-
example_fluentd_1 /bin/entrypoint.sh /bin/sh ... Up 24224/tcp, 5140/tcp
4138
example_go-fluentd_1 ./go-fluentd --config=/etc ... Up 127.0.0.1:24225->24225/tcp, 127.0.0.1:8080->8080/tcp
4239
example_log-generator_1 python /app.py Up
4340
```
@@ -53,12 +50,6 @@ You can check the logs that parserd by go-fluentd:
5350
```sh
5451
$ sudo docker logs example_fluentd_1
5552

56-
2019-02-28 08:41:21.534852412 +0000 test.sit: {"tag":"test.sit","app":"app","thread":"thread","class":"class","message":"0.8336017742577866\n0.059360002847527626\n0.9471091772460405","msgid":1377,"container_name":"/example_log-generator_1","source":"stdout","level":"INFO","line":"64","datasource":"test","@timestamp":"2019-02-21T07:41:17.871000Z","container_id":"24d6069f241ad94719ac1eee15dce43e29a3a32af67c478ded9c474066389260"}
57-
2019-02-28 08:41:21.539087614 +0000 test.sit: {"container_name":"/example_log-generator_1","msgid":1026,"line":"64","message":"0.7159115118036709","datasource":"test","level":"INFO","thread":"thread","class":"class","@timestamp":"2019-02-03T17:41:13.813000Z","container_id":"24d6069f241ad94719ac1eee15dce43e29a3a32af67c478ded9c474066389260","source":"stdout","tag":"test.sit","app":"app"}
58-
```
59-
60-
With format:
61-
6253
```js
6354
{
6455
"tag": "test.sit",
@@ -106,49 +97,52 @@ You can load monitor metrics by <http://localhost:8080/monitor>
10697
// http://localhost:8080/monitor
10798
10899
{
109-
"acceptorPipeline": {
110-
"msgPerSec": 81.1
111-
},
112-
"controllor": {
113-
"goroutine": 37,
114-
"skipDumpChanCap": 150000,
115-
"skipDumpChanLen": 0,
116-
"waitAccepPipelineAsyncChanCap": 100000,
117-
"waitAccepPipelineAsyncChanLen": 0,
118-
"waitAccepPipelineSyncChanCap": 10000,
119-
"waitAccepPipelineSyncChanLen": 0,
120-
"waitCommitChanCap": 500000,
121-
"waitCommitChanLen": 0,
122-
"waitDispatchChanCap": 100000,
123-
"waitDispatchChanLen": 0,
124-
"waitDumpChanCap": 150000,
125-
"waitDumpChanLen": 0,
126-
"waitPostPipelineChanCap": 10000,
127-
"waitPostPipelineChanLen": 0,
128-
"waitProduceChanCap": 10000,
129-
"waitProduceChanLen": 0
130-
},
131-
"dispatcher": {
132-
"msgPerSec": 81.1,
133-
"test.sit.ChanCap": 10000,
134-
"test.sit.ChanLen": 0,
135-
"test.sit.MsgPerSec": 81.1
136-
},
137-
"producer": {
138-
"discardChanCap": 50000,
139-
"discardChanLen": 0,
140-
"msgPerSec": 36.7,
141-
"test.sit.fluentd.ChanCap": 50000,
142-
"test.sit.fluentd.ChanLen": 0,
143-
"waitToDiscardMsgNum": 0
144-
},
145-
"tagpipeline": {
146-
"test.sit.concator_tagfilter.ChanCap": 10000,
147-
"test.sit.concator_tagfilter.ChanLen": 0,
148-
"test.sit.spring.ChanCap": 10000,
149-
"test.sit.spring.ChanLen": 0
150-
},
151-
"ts": "2019-02-28T08:32:21.560776792Z"
100+
"acceptorPipeline": {
101+
"msgPerSec": 252160.4
102+
},
103+
"controllor": {
104+
"goroutine": 64,
105+
"skipDumpChanCap": 150000,
106+
"skipDumpChanLen": 5299,
107+
"waitAccepPipelineAsyncChanCap": 100000,
108+
"waitAccepPipelineAsyncChanLen": 17174,
109+
"waitAccepPipelineSyncChanCap": 10000,
110+
"waitAccepPipelineSyncChanLen": 0,
111+
"waitCommitChanCap": 500000,
112+
"waitCommitChanLen": 500000,
113+
"waitDispatchChanCap": 100000,
114+
"waitDispatchChanLen": 99,
115+
"waitDumpChanCap": 150000,
116+
"waitDumpChanLen": 150000,
117+
"waitPostPipelineChanCap": 10000,
118+
"waitPostPipelineChanLen": 9777,
119+
"waitProduceChanCap": 50000,
120+
"waitProduceChanLen": 49946
121+
},
122+
"dispatcher": {
123+
"app.spring.perf.ChanCap": 10000,
124+
"app.spring.perf.ChanLen": 0,
125+
"app.spring.perf.MsgPerSec": 123304.8,
126+
"msgPerSec": 123306.7
127+
},
128+
"journal": {
129+
"idsSetLen": 644303
130+
},
131+
"producer": {
132+
"app.spring.perf.localtest.ChanCap": 50000,
133+
"app.spring.perf.localtest.ChanLen": 50000,
134+
"discardChanCap": 50000,
135+
"discardChanLen": 50000,
136+
"msgPerSec": 19111.5,
137+
"waitToDiscardMsgNum": 0
138+
},
139+
"tagpipeline": {
140+
"app.spring.perf.concator.ChanCap": 10000,
141+
"app.spring.perf.concator.ChanLen": 0,
142+
"app.spring.perf.spring-parser.ChanCap": 10000,
143+
"app.spring.perf.spring-parser.ChanLen": 4364
144+
},
145+
"ts": "2019-08-20T01:06:43.934658174Z"
152146
}
153147
```
154148
</p>

example/docker-compose.yml

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ services:
2121
command: python /app.py
2222

2323
go-fluentd:
24-
image: ppcelery/go-fluentd:1.7.2
24+
image: ppcelery/go-fluentd:1.9.3
2525
restart: "on-failure"
2626
networks:
2727
- fluentd-test
@@ -40,18 +40,6 @@ services:
4040
- ./go-fluentd/settings.yml:/etc/go-fluentd/settings.yml:ro
4141
command: ./go-fluentd --config=/etc/go-fluentd --env=sit --addr=0.0.0.0:8080 --log-level=info
4242

43-
fluentd:
44-
image: fluent/fluentd:v1.1.0
45-
restart: "on-failure"
46-
networks:
47-
- fluentd-test
48-
logging:
49-
driver: "json-file"
50-
options:
51-
max-size: 100m
52-
volumes:
53-
- ./fluentd/fluent.conf:/fluentd/etc/fluent.conf:ro
54-
5543

5644
networks:
5745
fluentd-test:

example/go-fluentd/settings.yml

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,14 @@ settings:
2525
discard_chan_size: 50000
2626
sender_inchan_size: 50000
2727
plugins:
28-
fluentd:
29-
type: fluentd
30-
active_env:
31-
- sit
32-
tags:
33-
- test.sit
34-
forks: 3
35-
addr: fluentd:24225
36-
msg_batch_size: 10000
37-
max_wait_sec: 5
38-
retry_chan_len: 50000
39-
is_discard_when_blocked: true
28+
localtest:
29+
active_env: *all-env
30+
tags: *all-tags
31+
type: "null"
32+
forks: 5
33+
log_level: info
34+
is_commit: true
35+
is_discard_when_blocked: false
4036
journal:
4137
buf_dir_path: /data/log/fluentd/go-concator
4238
buf_file_bytes: 209315200 # 200 MB

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.12
55
require (
66
github.com/Depado/ginprom v1.1.2
77
github.com/Laisky/go-syslog v2.3.3+incompatible
8-
github.com/Laisky/go-utils v1.5.4
8+
github.com/Laisky/go-utils v1.6.1
99
github.com/Laisky/zap v1.9.2
1010
github.com/OneOfOne/xxhash v1.2.5 // indirect
1111
github.com/Shopify/sarama v1.22.1

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ github.com/Laisky/go-chaining v0.0.0-20180507092046-43dcdc5a21be h1:7Rxhm6IjOtDA
1616
github.com/Laisky/go-chaining v0.0.0-20180507092046-43dcdc5a21be/go.mod h1:1mdzaETo0kjvCQICPSePsoaatJN4l7JvEA1200lyevo=
1717
github.com/Laisky/go-syslog v2.3.3+incompatible h1:TSHhP3iadAPDzC5efyYLPnGkv2pvUtuUInm7poVRkFA=
1818
github.com/Laisky/go-syslog v2.3.3+incompatible/go.mod h1:PPmESkLU3DEbJ3fRXam2hqJTNQVFMggsDXBnOtu2ITk=
19-
github.com/Laisky/go-utils v1.5.4 h1:A8AF990tuyT29QW+l5rj4omZBju+uihrDdqH+X/qv9s=
20-
github.com/Laisky/go-utils v1.5.4/go.mod h1:MpydOPP7RWH/cINQIgI1exzT8/9wumQ49iw91Y/lDOk=
19+
github.com/Laisky/go-utils v1.6.1 h1:wfzkGpiFqBDX4TNtPFerElxO9kamc7qk5r74bcz88zo=
20+
github.com/Laisky/go-utils v1.6.1/go.mod h1:MpydOPP7RWH/cINQIgI1exzT8/9wumQ49iw91Y/lDOk=
2121
github.com/Laisky/zap v1.9.2 h1:7dTtABboHk8DnT0d6Dc8A9Opu2cyIEaMlL9JO11zvag=
2222
github.com/Laisky/zap v1.9.2/go.mod h1:CQdLb2wEfqBvoNLmfOp7wnKTOMvhc4DQRc3xfshL4EQ=
2323
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=

senders/elasticsearch.go

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ func (s *ElasticSearchSender) SendBulkMsgs(ctx *bulkOpCtx, msgs []*libs.FluentMs
119119
return errors.Wrap(err, "try to compress messages got error")
120120
}
121121

122-
ctx.gzWriter.Flush()
122+
ctx.gzWriter.Close()
123123
req, err := http.NewRequest("POST", s.Addr, ctx.buf)
124124
if err != nil {
125125
return errors.Wrap(err, "try to init es request got error")
@@ -141,8 +141,8 @@ func (s *ElasticSearchSender) SendBulkMsgs(ctx *bulkOpCtx, msgs []*libs.FluentMs
141141
}
142142

143143
type ESResp struct {
144-
Errors bool `json:"errors"`
145-
Items []*ESOpResp `json:"items"`
144+
Errors bool `json:"errors"`
145+
// Items []*ESOpResp `json:"items"`
146146
}
147147

148148
type ESOpResp struct {
@@ -161,15 +161,18 @@ func isStatusCodeOk(s int) bool {
161161

162162
func (s *ElasticSearchSender) checkResp(resp *http.Response) (err error) {
163163
if !isStatusCodeOk(resp.StatusCode) {
164-
return fmt.Errorf("server return error code %v", resp.StatusCode)
164+
err = fmt.Errorf("server return error code %v", resp.StatusCode)
165165
}
166166

167167
ret := &ESResp{}
168-
bb, err := ioutil.ReadAll(resp.Body)
168+
bb, err2 := ioutil.ReadAll(resp.Body)
169+
if err2 != nil {
170+
utils.Logger.Error("try to read es resp body got error", zap.Error(err2))
171+
}
169172
if err != nil {
170-
utils.Logger.Error("try to read es resp body got error", zap.Error(err))
171-
return nil
173+
return errors.Wrap(err, string(bb))
172174
}
175+
utils.Logger.Debug("got es response", zap.ByteString("resp", bb))
173176

174177
if err = json.Unmarshal(bb, ret); err != nil {
175178
utils.Logger.Error("try to unmarshal body got error, body",
@@ -178,15 +181,8 @@ func (s *ElasticSearchSender) checkResp(resp *http.Response) (err error) {
178181
return nil
179182
}
180183

181-
for _, v := range ret.Items {
182-
if !isStatusCodeOk(resp.StatusCode) {
183-
// do not retry if there is part of msgs got error
184-
utils.Logger.Warn("bulk got error for idx",
185-
zap.ByteString("body", bb),
186-
zap.String("idx", v.Index.Index),
187-
zap.Int("status", v.Index.Status))
188-
return nil
189-
}
184+
if ret.Errors {
185+
utils.Logger.Error("es return error", zap.ByteString("resp", bb))
190186
}
191187

192188
return nil

0 commit comments

Comments
 (0)