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 ...
随机推荐
- HTML5实现手机QQ表情功能
主要素材和JS来自QQ空间触屏版( http://m.qzone.com ),我只是代码的搬运工.代码下载. 预览请使用较新版的Chrome,然后启用开发者工具,设备模式.详见:(http://www ...
- SQL学习笔记三(补充-3)之MySQL完整性约束
阅读目录 一 介绍 二 not null与default 三 unique 四 primary key 五 auto_increment 六 foreign key 七 作业 一 介绍 约束条件与数据 ...
- 一个Golang例子:for + goroutine + channel
Rob Pike 在 Google I/O 2012 - Go Concurrency Patterns 里演示了一个例子(daisy chain). 视频地址:https://www.youtube ...
- 20145312《网络对抗》Exp4 恶意代码分析
20145312<网络对抗>Exp4 恶意代码分析 问题回答 1.总结一下监控一个系统通常需要监控什么.用什么来监控. 监控一个系统通常需要监控这个系统的注册表,进程,开放端口,程序服务还 ...
- POJ 3436 ACM Computer Factory(最大流+路径输出)
http://poj.org/problem?id=3436 题意: 每台计算机包含P个部件,当所有这些部件都准备齐全后,计算机就组装完成了.计算机的生产过程通过N台不同的机器来完成,每台机器用它的性 ...
- ng-disabled 指令
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script sr ...
- Solaris11 Vsphere client tool 的鼠标问题
Mouse does not function on a Solaris 11 virtual machine (2040498) http://kb.vmware.com/selfservice/m ...
- LINUX QQ
查询龙井QQ http://www.longene.org/forum/viewtopic.php?f=6&t=4700
- 创建对象并生成结果的3个步骤-Chapter 3 P38
必须完成3个步骤才能创建对象并生成结果: 1 创建对象 namespace LanguageFeatures { public class Product { public int Product ...
- 297. Serialize and Deserialize Binary Tree *HARD*
Serialization is the process of converting a data structure or object into a sequence of bits so tha ...