Skip to content
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

fix: lost trace content in occasion when shutting down trace #3418

Merged
merged 5 commits into from
Mar 29, 2024

Conversation

oldme-git
Copy link
Member

Dear review:
在程序结束时要留有时间等待数据上报,不然有时候 otel 服务端会收不到,自建 jaeger 和阿里云都有这个问题。官网的示例也要改一下,不然新手会很疑惑。

@gqcn
Copy link
Member

gqcn commented Mar 25, 2024

@oldme-git @houseme 不对啊,有个defer shutdown()没起作用吗,感觉是不是看看shuwdown是不是有问题?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@oldme-git @houseme No, there is a defer shutdown() that doesn't work. Is there something wrong with shuwdown?

@houseme
Copy link
Member

houseme commented Mar 25, 2024

@oldme-git @houseme 不对啊,有个defer shutdown()没起作用吗,感觉是不是看看shuwdown是不是有问题?

刚开始直接使用完 shutdown 关闭是有这个问题,后续没有碰到这个问题。

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@oldme-git @houseme No, there is a defer shutdown() that doesn't work. Is there something wrong with shuwdown?

I had this problem when I used shutdown at the beginning, but I didn't encounter this problem later.

@gqcn
Copy link
Member

gqcn commented Mar 25, 2024

@oldme-git @houseme 不对啊,有个defer shutdown()没起作用吗,感觉是不是看看shuwdown是不是有问题?

刚开始直接使用完 shutdown 关闭是有这个问题,后续没有碰到这个问题。

这里会对使用者造成困惑,是否自己的代码中也需要加上这个sleep语句。为什么示例代码中的shutdown没起作用呢?

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@oldme-git @houseme No, there is a defer shutdown() that doesn't work. Is there something wrong with shuwdown?

There was this problem when I used shutdown directly at the beginning, but I did not encounter this problem later.

This will cause confusion for users, whether they need to add this sleep statement to their own code. Why doesn't the shutdown in the example code work?

@houseme
Copy link
Member

houseme commented Mar 26, 2024

这个地方设置了 超时时间,是不是测试环境网络问题,可以调整一下这个时间的值 @oldme-git

ctx, cancel := context.WithTimeout(ctx, time.Second)

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The timeout is set here. Is it a network problem in the test environment? You can adjust the value of this time @oldme-git

ctx, cancel := context.WithTimeout(ctx, time.Second)

@oldme-git
Copy link
Member Author

@houseme @gqcn shutdown 没有处理 tracerProvider.shutdown,导致 trace 不会上报,我不知道这些改会不会带来其他问题,反正现在我测试是可以正常上报数据的

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


@houseme @gqcn shutdown does not handle tracerProvider.shutdown, resulting in the trace not being reported. I don’t know if these changes will cause other problems. Anyway, now I can test that the data can be reported normally.

@oldme-git oldme-git changed the title improve: improve example of trace. fix: fix shutdown of trace Mar 27, 2024
@gqcn gqcn changed the title fix: fix shutdown of trace fix: missing trace content in occasion when shutting down trace Mar 29, 2024
@gqcn gqcn changed the title fix: missing trace content in occasion when shutting down trace fix: lost trace content in occasion when shutting down trace Mar 29, 2024
@gqcn gqcn merged commit 1e7d897 into gogf:master Mar 29, 2024
23 checks passed
@oldme-git oldme-git deleted the improve/trace-exmp branch March 29, 2024 02:46
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.

None yet

4 participants