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的更多相关文章

  1. ballerina 学习二十六 项目docker 部署&& 运行(二)

    ballerina 从发布,到现在官方文档的更新也是很给力的,同时也有好多改进,越来越好用了 可以参考官方文档 https://ballerina.io/learn/by-guide/restful- ...

  2. ballerina 学习二十五 项目docker 部署&& 运行

    ballerina 官方提供了docker 的runtime,还是比较方便的 基本项目创建 使用cli创建项目 按照提示操作就行 ballerina init -i 项目结构 添加了dockerfil ...

  3. Java开发学习(二十四)----SpringMVC设置请求映射路径

    一.环境准备 创建一个Web的Maven项目 参考Java开发学习(二十三)----SpringMVC入门案例.工作流程解析及设置bean加载控制中环境准备 pom.xml添加Spring依赖 < ...

  4. ballerina 学习二十九 数据库操作

    ballerina 数据操作也是比较方便的,官方也我们提供了数据操作的抽象,但是我们还是依赖数据库驱动的. 数据库驱动还是jdbc模式的 项目准备 项目结构 ├── mysql_demo │ ├── ...

  5. ballerina 学习二十八 快速grpc 服务开发

    ballerina 的grpc 开发模型,对于开发者来说简单了好多,不是schema first 的方式,而是我们 只要编写简单的ballerina service 就可以了,proto 文件是自动帮 ...

  6. ballerina 学习二十二 弹性服务

    主要包含断路器模式,负载均衡模式,故障转移,重试 Circuit Breaker 参考代码 import ballerina/http; import ballerina/log; import ba ...

  7. ballerina 学习二十 http/https

    提供http && https server && client 访问功能 client endpoint 说白了就是http client 参考代码 import b ...

  8. Python3.5 学习二十四

    本节课程大纲: -------------------------------------------------------------------------------------------- ...

  9. JavaWeb学习 (二十四)————Filter(过滤器)常见应用

    一.统一全站字符编码 通过配置参数charset指明使用何种字符编码,以处理Html Form请求参数的中文问题 1 package me.gacl.web.filter; 2 3 import ja ...

随机推荐

  1. 2016ACM/ICPC亚洲区沈阳站 Solution

    A - Thickest Burger 水. #include <bits/stdc++.h> using namespace std; int t; int a, b; int main ...

  2. poj1981 Circle and Points

    地址:http://poj.org/problem?id=1981 题目: Circle and Points Time Limit: 5000MS   Memory Limit: 30000K To ...

  3. Jedis连接池

    jedis是官方首选的java客户端开发包 Redis不仅是使用命令来操作,现在基本上主流的语言都有客户端支持,比如java.C.C#.C++.php.Node.js.Go等. 在官方网站里列一些Ja ...

  4. 微信小程序:本地资源图片无法通过 WXSS 获取,可以使用网络图片或者 base64或者使用image标签

    微信小程序:本地资源图片无法通过 WXSS 获取,可以使用网络图片或者 base64或者使用image标签 一.问题 报错信息: VM696:2 pages/user/user.wxss 中的本地资源 ...

  5. Git合并分支或者冲突

     假设冲突文件是 test/TestCase.php  下面分5种情况讨论. 1.本地不变.   然后远程别人有更新.   git pull   这种最简单,没有冲突,本地工作区直接更新   2.我本 ...

  6. 【软件位置】Linux查看软件安装的位置

    如果我们在Linux 系统上安装了某个软件,我们可以通过如下的三种方式来确定. 一.        Which 命令 Shell 的which 命令可以找出相关命令是否已经在搜索路径中. 如: [ro ...

  7. spark udf 初识初用

    直接上代码,详见注释 import org.apache.spark.sql.hive.HiveContext import org.apache.spark.{SparkContext, Spark ...

  8. SQL Server 查询优化 索引的结构与分类

    一.索引的结构 关系型数据库中以二维表来表达关系模型,表中的数据以页的形式存储在磁盘上,在SQL SERVER中,数据页是磁盘上8k的连续空间,那么,一个表的所有数据页在磁盘上是如何组织的呢?分两种情 ...

  9. thinkphp5中的配置如何使用

    thinkphp5中的配置如何使用 一.总结 一句话总结:先加载配置,然后读取配置即可 加载配置 读取配置 Config::load(APP_PATH.'fry_config.php');\\加载配置 ...

  10. 2018-2019-2 网络对抗技术 20165332 Exp2 后门原理与实践

    2018-2019-2 网络对抗技术 20165332 Exp2 后门原理与实践 - 实验内容 任务一:使用netcat获取主机操作Shell,cron启动 任务二:使用socat获取主机操作Shel ...