-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Categraf采集Mysql指标信息偶现长时间挂起/无响应现象 #646
Comments
重新设置
|
建议后续能够优化下日志打印,记录错误日志能够记录采集对象的地址等身份识别信息,方便回溯是哪个实例采集失败? |
按照这个修改生效了 对吧? 日志优化 建议挺好的, 这个后面加一下。 |
日志优化 #657 |
Relevant config.toml
Logs from categraf
System info
categraf-0.3.20 linux
Docker
NA
Steps to reproduce
1.正常配置配置mysql配置进行指标采集
2.大部分时间能够在1s左右完成指标采集,但偶现出现长时间挂起的现象,如上日志,一次采集耗时56分钟。
Expected behavior
期望能够稳定的实现指标采集,如果连接失败/超时应该按照设定的时间结束,不影响后续采集
Actual behavior
实际上可能存在长时间不超时的现象,经过跟踪代码,初步怀疑和未设置go-sql-driver/mysql中ReadTimeout有关系,还在验证中。
1、go-sql-driver/mysql/dsn.go中Config参数有3个和超时有关的定义:Timeout、ReadTimeout、WriteTimeout,分别表示连接超时时间、读超时时间以及写超时时间。
2、如果只设置了Timeout,那么在连接成功之后数据库读写出现异常,会不会可能出现长时间等待的情况?
以下是categraf inputs/mysql/mysql.go Init()代码:
ins.dsn = fmt.Sprintf("%s:%s@%s(%s)/?%s", ins.Username, ins.Password, net, ins.Address, ins.Parameters)
conf, err := mysql.ParseDSN(ins.dsn)
if err != nil {
return err
}
if conf.Timeout == 0 {
if ins.TimeoutSeconds == 0 {
ins.TimeoutSeconds = 3
}
conf.Timeout = time.Second * time.Duration(ins.TimeoutSeconds)
}
Additional info
No response
The text was updated successfully, but these errors were encountered: