python-grpc-prometheus拦截器

python-grpc-prometheus的Python项目详细描述


python grpc普罗米修斯

Build Status

更改日志

安装

从PYPI安装:

pip install python-grpc-prometheus

用法

检查源代码中可用的拦截器。本例使用PromServerInterceptor。 用法示例:

importgrpcfromconcurrent.futuresimportThreadPoolExecutor# Importing this whole package so that I can use prometheus_client.start_http_server()# instead of just start_http_server(), which is not too descriptive. But it's your call.importprometheus_clientfrompython_grpc_prometheus.prometheus_server_interceptorimportPromServerInterceptor# Add the required interceptor(s) where you create your grpc server, e.g.psi=PromServerInterceptor()server=grpc.server(ThreadPoolExecutor(max_workers=10),interceptors=(psi,))# Start the http server where prometheus can fetch the data from. Use whatever listen port you prefer.prometheus_client.start_http_server(8000)# ...

现在,运行应用程序时,可以在浏览器中检查http://localhost:8000。 注意:在应用程序实际接收到grpc调用之前,grpc_*度量将只显示注释(及其描述)。

待办事项

  • 添加流支持

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java使用ObjectOutput/InputStream从自定义位置读/写   Java队列数组只打印出打印方法中for循环中的最后一个元素   java如何使用searchManager搜索和筛选listview   java ValueAnimator更改背景颜色   java什么是AOSP工具链?   序列化Java/Serializable仅覆盖已更改的对象   java Android单例类仅在第二次刷新时更新   将文本追加到JTextPane时,JTextPane的java滚动条不可见   java行为和繁忙指示器   javaspring,Thymeleaf和CSS如何给错误着色   java如何在两个测试类之间共享外部资源?   java Druid longSum度量未填充   按下按钮时,java列表不会显示(+字符串参数“流派”不存在)   java在Hibernate中如何延迟加载子记录?   java为对象提供随机统计信息   java如何使用GWT编辑器框架编辑多值字段?