当前位置:网站首页>Metrics学习笔记
Metrics学习笔记
2022-07-16 17:43:00 【几何学家】
metrics提供五种基本类型Gauges, Counters, Histograms, Meters和 Timers
Gauges
Gauges是最简单的一种单位,用来记录某个对象的一些瞬时值
Metric.Gauge()
Counter
是一个六十四位的计数器,我们可以设置两个counter分别用来统计服务的请求数和处理数
下面以服务的当前请求数为例
rivate readonly Counter concurrentRequestsCounter = Metric.Counter(“SampleMetrics.ConcurrentRequests”, Unit.Requests);
然后在处理请求的时候将该请求自增
this.concurrentRequestsCounter.Increment();
请求完成之后自减
this.concurrentRequestsCounter.Decrement();
该请求数也有其他很多的应用场景,比如统计当前有多少人正在请求该服务等场景
Histograms
histogram用来度量统计数据中的各类指标,比如平均值,最大值最小值,中位数等指标,通常可以用来评估百分之n的数据都在哪个范围内
private readonly Histogram histogramOfData = Metric.Histogram(“ResultsExample”, Unit.Items);
this.histogramOfData.Update(request.length, methodName);
Meters
Meters是一种只能增加不能减少等数据结构,通常用来测量服务出现异常等比率
需要设置两个参数,总请求量和出错量
设置总请求量
private readonly Meter meter = Metric.Meter(“Requests”, Unit.Requests,TimeUnit.Seconds);
然后在处理请求的地方
this.meter.Mark();
Histograms
Timer
timer是当前Histogram跟Meter的一个组合,比如要统计当前请求的速率和处理时间
那么收集完数据之后可以使用自带的dashboard去进行监控,但是自带的dashboard相对来讲较为简陋,我们可以将数据收集起来存放到clickhouse等引擎,然后导入到Grafana等比较好的dashboard去进行监控
边栏推荐
- Life cycle of activity
- 软件测试 - 用例篇
- [in-depth learning] experience of renting online equipment platform and the pits (non advertising)
- 报错:cannot read properties of undefined(reading ‘forEach‘)
- The first large-scale Chinese video multimodal similarity data set
- go ———数组与切片的区别
- Research on driverless dynamic obstacle avoidance strategy | robot dynamic obstacle avoidance strategy
- [AI application] detailed parameters of Intel (R) Xeon (R) silver 4216 CPU @ 2.10GHz
- feign调用传递请求头
- Convolution structure and its calculation
猜你喜欢

Go -- the difference between array and slice

机器学习|BP(Back Propagation)神经网络

OpenGL es learning (5) - Lighting

How to create and deploy erc-1155 NFT

1.解决com.mysql.jdbc.PacketTooBigException: Packet for query is too large

2022 年度杭州未来科技城数字经济人才编程大赛

MySQL 66 questions, 20000 words + 50 pictures in detail! A little six!

MySQL六十六问,两万字+五十图详解!有点六!

Realize all weekly buttons of a year

长安链tls基础研究
随机推荐
Small program development of private forum circle community
MultipartFile与base64互转
Use and principle of CAS
[machine vision] Canny edge detection matlab source code reading
[word] the inserted formula is grayed out, and the failure is solved
OpenGL es learning (5) - Lighting
Go -- the difference between array and slice
Codeforces Round #806 (Div. 4)(A.B.C.D.E.F)
【uniapp调用微信支付】uniapp开发小程序-调用微信支付
【学浪下载教程】06学浪模拟网页版登录,无需客户端和全局代理软件
[Xuelang download tutorial] 06 Xuelang simulated web version login, without client and global agent software
Kernel management of Jupiter notebook
Unity-2D像素晶格化消融
Payment process interview ideas
图论
go的命令行库--cobra使用
2022.7.4-7.10 AI industry weekly (issue 105): snails
Student management system (simple low configuration version)
报错:cannot read properties of undefined(reading ‘forEach‘)
(manual) [sqli-labs50-53] order by injection