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. 什么是T-SQL

    T-SQL T-SQL 即 Transact-SQL,是 SQL 在 Microsoft SQL Server 上的增强版,它是用来让应用程序与 SQL Server 沟通的主要语言.T-SQL 提供 ...

  2. HDU1503Advanced Fruits

    /*给出两串,求一个最小的字符串包含这两个子串,子串在这个字符串中的顺序不变, 做法:定义两个数组,分别标记公共部分在第一个串和第二个串中的位置,在输出是判断一下,输出一个串两个公共部分之间的部分,不 ...

  3. 基于OpenCV进行图像拼接原理解析和编码实现(提纲 代码和具体内容在课件中)

    一.背景 1.1概念定义 我们这里想要实现的图像拼接,既不是如题图1和2这样的"图片艺术拼接",也不是如图3这样的"显示拼接",而是实现类似"BaiD ...

  4. Linux内核分析

    通过分析汇编代码理解计算机是如何工作的   网易云课堂<Linux内核分析>作业 实验目的: 通过反汇编一个简单的C程序,分析汇编代码理解计算机是如何工作的 实验过程: 登陆实验楼虚拟机h ...

  5. 2018-2019-1 20189215《Linux内核原理与分析》第三周作业

    <庖丁解牛>第二章书本知识总结 函数调用框架 call指令有两个作用: (1) 将CS:EIP中下一条指令的地址A保存在栈顶: (2)设置CS:EIP指向被调用程序的第一行. ret指令在 ...

  6. 20145311 《Java程序设计》第八周学习总结

    20145311 <Java程序设计>第八周学习总结 教材学习内容总结 第十四章 NIO与NIO2 高级的输入输出处理,可以使用NIO(New IO),NIO2是文件系统的API 第十五章 ...

  7. 2017-2018-1 JaWorld 团队作业--冲刺7

    2017-2018-1 JaWorld 团队作业--冲刺7 冲刺博客 冲刺1 冲刺2 冲刺3 冲刺4 冲刺5 项目完成情况 存在的问题 存在的问题是敌机只设置了一种,没能实现多种敌机的游戏设置. 界面 ...

  8. CentOS7.2 安装Tomcat

    Centos默认安装JDK 现在要删除旧版本的jdk,安装新版本jdk 查看现有jdk: [root@localhost 桌面]# rpm -qa | grep jdk java-1.8.0-open ...

  9. Maven编译代码的时候跳过单元测试

    Maven编译代码的时候跳过单元测试 <properties> <maven.test.skip>true</maven.test.skip> </prope ...

  10. webpack执行中出现 ERROR in Path must be a string. Received undefined

    执行webpack时出现错误信息 ERROR in Path must be a string. Received undefined 原因在于我的node.js版本太高了,目前node版本为6.10 ...