ballerina 学习二十四 监控ballerina
ballerina 服务的监控还是比较方便的,以及集成了Prometheus Grafana Jaeger Elastic Stack
监控服务监控的集成
- 主要包含以下几个步骤
a. 安装docker Prometheus Grafana Jaeger Elastic Stack
b. 创建简单ballerian 服务
c. 监控ballerina 服务(--observe 选项,启动之后,默认会使用使用http endpoint 发送监控指标,同时也可以使用配置文件 ballerian.conf 配置
ballerina run --config <path-to-conf>/ballerina.conf ballerinaservice
d. 发送一些请求 http://localhost:9090/hello/sayHello
e. 通过dashboard 查看指标信息
Jaeger via http://localhost:16686/
Grafana dashboard on http://localhost:3000/
Kibana via http://localhost:5601
- 参考代码
import ballerina/http;
import ballerina/log;
service<http:Service> hello bind { port:9090 } {
sayHello (endpoint caller, http:Request req) {
log:printInfo("This is a test Info log");
log:printError("This is a test Error log");
log:printWarn("This is a test Warn log");
http:Response res = new;
res.setPayload("Hello, World!");
_ = caller -> respond(res);
}
}
修改默认配置参考文档
| Configuration Key | Description | Default Value | Possible Values |
|---|---|---|---|
| b7a.observability.metrics. enabled | Whether metrics monitoring is enabled (true) or disabled (false) | false | true or false |
| b7a.observability.metrics. provider | Provider name which implements Metrics interface. This is only required to be modified if a custom provider is implemented and needs to be used. | micrometer | micrometer or if any custom implementation, then name of the provider. |
| b7a.observability.metrics. micrometer.registry.name | Name of the registry used in micrometer | prometheus | prometheus |
| b7a.observability.metrics. prometheus.port | The value of the port in which the service '/metrics' will be bind to. This service will be used by Prometheus to scrape the information of the Ballerina service. | 9797 | Any suitable value for port 0 - 0 - 65535. However, within that range, ports 0 - 1023 are generally reserved for specific purposes, therefore it is advisable to select a port without that range. |
| b7a.observability.metrics. prometheus.hostname | The hostname in which the service '/metrics' will be bind to. This service will be used by Prometheus to scrape the information of the Ballerina service. | 0.0.0.0 | IP or Hostname or 0.0.0.0 of the node in which the Ballerina service is running. |
| b7a.observability.metrics. prometheus.descriptions | This flag indicates whether meter descriptions should be sent to Prometheus. Turn this off to minimize the amount of data sent on each scrape. | false | true or false |
| b7a.observability.metrics. prometheus.step | The step size to use in computing windowed statistics like max. To get the most out of these statistics, align the step interval to be close to your scrape interval. | PT1M (1 minute) | The formats accepted are based on the ISO-8601 duration format PnDTnHnMn.nS with days considered to be exactly 24 hours. |
参考文档
https://ballerina.io/learn/how-to-observe-ballerina-code/
ballerina 学习二十四 监控ballerina的更多相关文章
- ballerina 学习二十六 项目docker 部署&& 运行(二)
ballerina 从发布,到现在官方文档的更新也是很给力的,同时也有好多改进,越来越好用了 可以参考官方文档 https://ballerina.io/learn/by-guide/restful- ...
- ballerina 学习二十五 项目docker 部署&& 运行
ballerina 官方提供了docker 的runtime,还是比较方便的 基本项目创建 使用cli创建项目 按照提示操作就行 ballerina init -i 项目结构 添加了dockerfil ...
- Java开发学习(二十四)----SpringMVC设置请求映射路径
一.环境准备 创建一个Web的Maven项目 参考Java开发学习(二十三)----SpringMVC入门案例.工作流程解析及设置bean加载控制中环境准备 pom.xml添加Spring依赖 < ...
- ballerina 学习二十九 数据库操作
ballerina 数据操作也是比较方便的,官方也我们提供了数据操作的抽象,但是我们还是依赖数据库驱动的. 数据库驱动还是jdbc模式的 项目准备 项目结构 ├── mysql_demo │ ├── ...
- ballerina 学习二十八 快速grpc 服务开发
ballerina 的grpc 开发模型,对于开发者来说简单了好多,不是schema first 的方式,而是我们 只要编写简单的ballerina service 就可以了,proto 文件是自动帮 ...
- ballerina 学习二十二 弹性服务
主要包含断路器模式,负载均衡模式,故障转移,重试 Circuit Breaker 参考代码 import ballerina/http; import ballerina/log; import ba ...
- ballerina 学习二十 http/https
提供http && https server && client 访问功能 client endpoint 说白了就是http client 参考代码 import b ...
- Python3.5 学习二十四
本节课程大纲: -------------------------------------------------------------------------------------------- ...
- JavaWeb学习 (二十四)————Filter(过滤器)常见应用
一.统一全站字符编码 通过配置参数charset指明使用何种字符编码,以处理Html Form请求参数的中文问题 1 package me.gacl.web.filter; 2 3 import ja ...
随机推荐
- 史上最强网推案例,没有之一【ZW团队实战经典】
ZW团队认为,互联网本质只有两个字:颠覆. ZW网络推广团队,是国内首个教父级网络营销团队,自1997年以来,先后参与操盘多个重大互联网项目,服务过超过150家国际500强客户,是微软公司首家官方认证 ...
- hdu5102 枚举每条边的长度
题意 给了 一颗 有 100000 个节点的树, 他们构成的边有 n*(n-1)/2 种. 每条边有一个长度,长度排序后 取前K条的 和, 枚举每条长度为1 的边 放进队列,然后通过成都为1 的表去 ...
- linux下高并发网络应用注意事项
本文转自:http://www.blogjava.net/bacoo/archive/2012/06/11/380500.html linux下高并发网络应用注意事项 vi /etc/sysctl.c ...
- 2018 eclipse安装反编译插件
1.在eclipse的help—>Install New Software...中添加新软件开发,添加它的源: name:jd-eclipse_update_site address:h ...
- 使用MongoVUE无法添加Collection
说明: 问题MongoDB版本为3.2,MongoVUE 1.6.9 问题: 在数据库中添加集合不可用. 解决方法: MongoDB版本换成2 或者 切换存储引擎: 从MongoDB 3.2 版本开始 ...
- 20155201 2016-2017-2 《Java程序设计》第十周学习总结
20155201 2016-2017-2 <Java程序设计>第十周学习总结 教材学习内容总结 Java密码技术 安全的三个属性 机密性 完整性 可用性 密码学: 主要是研究保密通信和信息 ...
- imx6------watchdog导致不进系统
刚上板子,把大部分驱动都停了,不过watchdog的驱动没停,当时想没应用程序所以watchdog不用管,没想到 就是watchdog卡住了,有程序open了watchdog但是没有write,结果t ...
- Python学习札记(三十二) 面向对象编程 Object Oriented Program 3
参考:访问限制 NOTE 1.eg. #!/usr/bin/env python3 class Student(object): """docstring for Stu ...
- PHP中__autoload()与spl_autoload_register()函数的用法与区别
_autoload() 函数在PHP文档中的解释是试图使用尚未被定义的类时自动调用.通过调用此函数,脚本引擎在 PHP 出错失败前有了最后一个机会加载所需的类. 如何理解这句话,我们首先看下面一个简单 ...
- 大白菜的装机U盘真不错
今天用大白菜制作了个启动U盘,然后在里面,把[电脑公司]的ghost文件拷贝进去. 重新安装WinXP成功. 注意: 1)直接用[电脑公司]的ISO文件,用Win32DiskImage写到U盘,不知为 ...