gpt4 book ai didi

java - Dropwizard:使用 dhatim/dropwizard-sentry 时如何设置 Sentry 用户上下文 [已修复]

转载 作者:行者123 更新时间:2023-11-30 05:22:02 24 4
gpt4 key购买 nike

我正在使用https://github.com/dhatim/dropwizard-sentry用于将错误记录到我的 Dropwizard Java Web 服务中的 Sentry。

如何设置 Sentry user context当使用 dropwizard-sentry 的 AppenderFactory 集成时?

通过将 userId/userEmail 添加到 MDC 并将“mdcTags:”选项添加到应用程序 YAML 配置 ( as per the configuration guidelines ) 中的 Sentry 附加程序,我可以成功将 userId/userEmail 作为标签发送到 Sentry,但这不会设置用户上下文。

我尝试过使用Sentry static API for Java ,但没有任何运气:

        // Set the current user in the context.
Sentry.getContext().setUser(
new UserBuilder().setUsername("user1").build()
);

编辑:

作者已在 https://github.com/dhatim/dropwizard-sentry/releases/tag/2.0.0-4 中修复了此问题

最佳答案

我是 https://github.com/dhatim/dropwizard-sentry 的维护者。目前无法在 Sentry 上下文中设置用户信息。在 Dropwizard Sentry 插件中,只能配置静态标签和基于日志记录 MDC 的标签。这将是一个有趣的补充,所以请随意在项目上提出问题。

关于java - Dropwizard:使用 dhatim/dropwizard-sentry 时如何设置 Sentry 用户上下文 [已修复],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59393783/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com