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

[RFC] 指标输出 API #166

Open
legendecas opened this issue Apr 18, 2022 · 2 comments
Open

[RFC] 指标输出 API #166

legendecas opened this issue Apr 18, 2022 · 2 comments
Assignees

Comments

@legendecas
Copy link
Member

目前 xprofiler 中的指标是在 logbypass 线程中通过 logger 输出为日志文本格式,然后被 xtransit 消费并上传服务端。但是对于部分现存场景中,用户可能已经有成熟的指标时许存储后端用于处理特化的指标数据,如 Prometheus、TSDB 等等,此时 xprofiler 还无法提供一个 JS API 可供用户自行导出指标数据。

如果 xprofiler 可以提供一个 JS API,可供如 OpenTelemetry、prom-client 等社区指标库消费并导出,则可满足这种用户场景。

对于目前的 xprofiler 来说,数据链路基本可以保持不变,需要在 JS 层增加一个 JS API 用于访问 EnvironmentData 上存储的指标数据,以供 OpenTelemetry 等指标库以 Observer 形式定期、按需访问。

@hyj1991
Copy link
Member

hyj1991 commented Apr 18, 2022

JS API 可能还是需要 logger.cc 的驱动,可以考虑在 Info 的时候 async send 通知一下 main thread,然后在 main thread 上触发调用这个 JS 函数

@hyj1991
Copy link
Member

hyj1991 commented Apr 18, 2022

这种场景下就丢弃了 js 工作线程死循环的日志了,因此不需要考虑 RequestInterrupt,uv_async_send 应该可以满足场景需求

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

No branches or pull requests

2 participants