Skip to content

获取 read parse transform send 历史错误信息,默人历史错误条数最大为100条 - #610

Merged
wonderflow merged 2 commits into
qiniu:masterfrom
redHJ:pdr-6810
Jul 26, 2018
Merged

wonderflow merged 2 commits into
qiniu:masterfrom
redHJ:pdr-6810

Conversation

@redHJ

@redHJ redHJ commented Jul 17, 2018 •

Copy link
Copy Markdown
Collaborator

获取 read parse transform send 历史错误信息,默人历史错误条数最大为100条

@redHJ
redHJ requested review from unknwon and wonderflow July 17, 2018 14:23
Comment thread mgr/rest_test.go Outdated
//"runnerDataIntegrityTest": runnerDataIntegrityTest,
//"getErrorCodeTest": getErrorCodeTest,
//"getRunnersTest": getRunnersTest,
//"senderRouterTest": senderRouterTest,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的注释是不是忘记改回来了。。

Comment thread mgr/runner.go Outdated
}
if err != nil {
info.LastError = err.Error()
r.errorsMutex.Lock()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

既然不同步骤的 error 是单独的 queue,为什么不直接把锁封装在 queue 的 put 操作里?

Comment thread utils/models/models.go Outdated
}

func NewErrorQueue() *ErrorQueue {
errorQueue := &ErrorQueue{}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里完全可以

return &ErrorQueue{
  xxx
  xxx
}

Comment thread utils/models/utils_test.go Outdated
assert.NotEqual(t, exp, pick)
}

func TestErrorQueue(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么定义是在 models.go 里,test 却是在 utils_test.go?

@redHJ
redHJ force-pushed the pdr-6810 branch 5 times, most recently from 638649a to 9a99846 Compare July 18, 2018 01:52
@redHJ redHJ changed the title [WIP] add get errors add get errors Jul 18, 2018
Comment thread mgr/api.md
请求

```
GET /logkit/errors

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

再加个针对单个runner的接口

Comment thread mgr/api.md Outdated
"send_errors": {
{
"error":"<send error info>"",
"unix_nano_time":<unix nano time>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个就叫timestamp就好了

Comment thread mgr/api.md
* "parse_errors": parse 历史错误数据
* "transform_errors": transform 历史错误数据
* "send_errors": send 历史错误数据
* "error": 具体错误信息

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这个接口就是errors,不用到处加errors后缀,就叫 read,parse,transfoerm,send就好了。

Comment thread mgr/models.go Outdated
MaxBatchSize int `json:"batch_size,omitempty"` // 每个read batch的字节数
MaxBatchInterval int `json:"batch_interval,omitempty"` // 最大发送时间间隔
MaxBatchTryTimes int `json:"batch_try_times,omitempty"` // 最大发送次数,小于等于0代表无限重试
MaxErrorsSize int `json:"errors_size"` // 记录错误信息的最大条数

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

errors_list_cap

Comment thread utils/models/models.go Outdated

DefaultMaxBatchSize = 2 * 1024 * 1024

DefaultErrorQueueSize = 50

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认100

@redHJ
redHJ force-pushed the pdr-6810 branch 11 times, most recently from 62ff6aa to 14dc801 Compare July 23, 2018 09:31
@redHJ redHJ changed the title add get errors [WIP] add get errors Jul 23, 2018
@redHJ
redHJ force-pushed the pdr-6810 branch 4 times, most recently from 7989484 to ab440ca Compare July 23, 2018 12:06
@redHJ
redHJ force-pushed the pdr-6810 branch 3 times, most recently from 2202e1c to bdb52cc Compare July 25, 2018 08:18
@redHJ redHJ changed the title [WIP] add get errors add get errors Jul 25, 2018
@redHJ redHJ changed the title add get errors 获取 read parse transform send 历史错误信息,默人历史错误条数最大为100条 Jul 25, 2018
@redHJ
redHJ force-pushed the pdr-6810 branch 7 times, most recently from f5580e6 to 8e818cb Compare July 26, 2018 02:03
Comment thread mgr/models.go Outdated
entry.SendErrors = nil
}

//Clone 复制出一个顺序的 Errors

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释不对吧

Comment thread mgr/models.go Outdated
return dst
}

//Clone 复制出一个顺序的 Errors

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释不对吧

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

改过了

@redHJ
redHJ force-pushed the pdr-6810 branch 2 times, most recently from c5ce966 to ed7b546 Compare July 26, 2018 07:58
Comment thread mgr/models.go Outdated
if change {
return &dst
}
return nil

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

叫change是不是不太准确?isEmpty?

@wonderflow

Copy link
Copy Markdown
Contributor

LGTM

@wonderflow
wonderflow merged commit 78ac4e6 into qiniu:master Jul 26, 2018
@redHJ
redHJ deleted the pdr-6810 branch January 24, 2019 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants