当前位置: 首页 > news >正文

房产新闻网最新消息济南网络优化网址

房产新闻网最新消息,济南网络优化网址,正规网站建设报价,网站建设基础方案今日已办 Collector 指标聚合 由于没有找到 Prometheus 官方提供的可以聚合指定时间区间内的聚合函数,所以自己对接Prometheus的api来聚合指定容器的cpu_avg、cpu_99th、mem_avg 实现成功后对接小组成员测试完提供的时间序列和相关容器,将数据记录在表格…

今日已办

Collector 指标聚合

由于没有找到 Prometheus 官方提供的可以聚合指定时间区间内的聚合函数,所以自己对接Prometheus的api来聚合指定容器的cpu_avg、cpu_99th、mem_avg

实现成功后对接小组成员测试完提供的时间序列和相关容器,将数据记录在表格中

image-20230829135852878

  1. SpringBoot RestController
  2. Jackson json serialization
  3. data aggregation
/*** @author xzx* @date 2023/8/29*/
@RestController
@RequestMapping("/prometheus")
public class PrometheusController {@GetMappingpublic ResponseResult GetMetrics(@RequestParam String ip,@RequestParam String containerName,@RequestParam String startDay,@RequestParam String startHour,@RequestParam String startMinute,@RequestParam String startSecond,@RequestParam String endDay,@RequestParam String endHour,@RequestParam String endMinute,@RequestParam String endSecond,@RequestParam int idx) {String queryCpu = "sum(irate(container_cpu_usage_seconds_total{name=\"" + containerName + "\"}[5m])) without (cpu)";String start = startDay + "T" + startHour + ":" + startMinute + ":" + startSecond + ".000Z";String end = endDay + "T" + endHour + ":" + endMinute + ":" + endSecond + ".000Z";List<List<Object>> cpuValues = getValues(ip, start, end, queryCpu, idx);List<Double> cpuList = new ArrayList<>();Double sum = (double) 0;for (List<Object> value : cpuValues) {if (value.size() == 2) {Double v = Convert.toDouble(value.get(1));sum += v;cpuList.add(v);}}Collections.sort(cpuList);String queryMem = "container_memory_usage_bytes{name=\"" + containerName + "\"}";List<List<Object>> memValues = getValues(ip, start, end, queryMem, 0);long memSum = 0;for (List<Object> value : memValues) {if (value.size() == 2) {memSum += Convert.toLong(value.get(1));}}PrometheusMetricsData data = new PrometheusMetricsData().setCpu95th(cpuList.get(Convert.toInt(0.95 * cpuList.size())) * 100).setCpuAvg(sum / Convert.toDouble(cpuValues.size()) * 100).setMemAvg(memSum / memValues.size());return ResponseResult.okResult(data);}private List<List<Object>> getValues(String ip, String start, String end, String queryCpu, int idx) {String body = HttpRequest.get("http://" + ip + "/prometheus/api/v1/query_range?query=" + queryCpu + "&start=" + start + "&end=" + end + "&step=1s").timeout(20000).execute().body();PrometheusRespDto prometheusRespDto = JSONUtil.toBean(body, PrometheusRespDto.class);List<PromResult> result = prometheusRespDto.getData().getResult();List<List<Object>> values = result.get(idx).getValues();return values;}}

测试

确定测试方案

我们打算在 10 万到 100万之间摸一个不会丢的量以及合适的并发量,作为不同 collector 测存储和查询的前提

我们能不能固定一个数量,然后使用相同的代码来上报相同的trace(只是可以控制线程睡眠时间)来调整耗时,让两种collector都能完整的上报所有数据,保证不回丢失,最后来计算存储大小

image-20230829205845583

image-20230829205535246

image-20230829210324486

image-20230829210653746

image-20230829211857226

编写测试函数

func TestTraceSpan(t *testing.T) {ctx := context.Background()res, err := resource.New(ctx,resource.WithFromEnv(),resource.WithProcess(),resource.WithTelemetrySDK(),resource.WithHost(),resource.WithAttributes(attribute.String("service.name", "test-service"),attribute.String("library.language", "go"),),)if err != nil {return}otel.SetTextMapPropagator(propagation.NewCompositeTextMapPropagator(propagation.TraceContext{}, propagation.Baggage{}))tracerProviderShutDown := otelclient.InitTraceProvider(res, ctx)defer tracerProviderShutDown()testTracer := otel.Tracer("test_demo", trace.WithInstrumentationAttributes(attribute.String("demo.author", "xzx")))group := sync.WaitGroup{}for i := 0; i < 50; i++ {group.Add(1)go func(num int) {for j := 0; j < 4000; j++ {rootCtx, span := testTracer.Start(ctx, "demo_root_span"+string(rune(num)), trace.WithSpanKind(trace.SpanKindProducer), trace.WithAttributes(attribute.String("user.username", uuid.NewString())))for k := 0; k < 4; k++ {_, subSpan := testTracer.Start(rootCtx, "demo_sub_span", trace.WithSpanKind(trace.SpanKindInternal))if subSpan.IsRecording() {subSpan.SetAttributes(attribute.String("user.uuid", uuid.NewString()),attribute.Int64("user.ip", int64(uuid.New().ID())))}time.Sleep(10 * time.Millisecond)subSpan.End()}time.Sleep(time.Millisecond * 41)span.End()}group.Done()}(i)}group.Wait()
}

汇总进度和问题

  1. es 的监控平台的 文档数 和 kibana 的数据条数不一致,最后以 kibana 的 hits 为基准
  2. 测试上报最终的数据丢失,测试不准确,由于并发数太多了,大多数据都存储在内存中,由于超时被丢弃
  3. 官方的 otel-collector 的数据库和表创建耗费时间长
  4. 协助测试组员的记录来聚合容器指标,记录表格内容,完成 trace-collector、metric-collector的测试结果表格
  5. clickhouse的数据**“幻读”**
    1. 存在副本
    2. 同步时间较长,写入后需要一段时间后才能看到另一个节点的数据拷贝
    3. 删除通过SQLDROP Database database_name SYNC 无法drop所有节点的数据库,故删除后一段时间后又会查询到该数据库的数据
  6. 测试周期较长,测试结果的采集不够自动化,测试样例和次数不太丰富,由于前期的测试方案方向和方法不正确,走了很多外路,不过在组员的努力和导师的指导下跌跌撞撞勉强完成测试结果
  7. 。。。

明日待办

  1. PPT制作
  2. 录制Showcase视频
  3. 绘制Showcase表格和图像
  4. 输出测试结果的总结

文章转载自:
http://hailstone.cwgn.cn
http://loafer.cwgn.cn
http://natatorial.cwgn.cn
http://proposer.cwgn.cn
http://coly.cwgn.cn
http://haemorrhoidectomy.cwgn.cn
http://miter.cwgn.cn
http://gruesomely.cwgn.cn
http://wet.cwgn.cn
http://indwell.cwgn.cn
http://handwritten.cwgn.cn
http://cankerworm.cwgn.cn
http://ascaris.cwgn.cn
http://biggish.cwgn.cn
http://anapaest.cwgn.cn
http://gama.cwgn.cn
http://gallego.cwgn.cn
http://novelese.cwgn.cn
http://footmark.cwgn.cn
http://subinfeudatory.cwgn.cn
http://revegetation.cwgn.cn
http://bow.cwgn.cn
http://corrida.cwgn.cn
http://adn.cwgn.cn
http://nwa.cwgn.cn
http://accusable.cwgn.cn
http://dalmatia.cwgn.cn
http://straighten.cwgn.cn
http://schoolman.cwgn.cn
http://snaggletooth.cwgn.cn
http://sweetshop.cwgn.cn
http://align.cwgn.cn
http://radioimmunoassay.cwgn.cn
http://knobble.cwgn.cn
http://deprecatingly.cwgn.cn
http://alif.cwgn.cn
http://methoxyflurane.cwgn.cn
http://alula.cwgn.cn
http://duct.cwgn.cn
http://sacculated.cwgn.cn
http://proselytise.cwgn.cn
http://nepotistical.cwgn.cn
http://unfamous.cwgn.cn
http://superhero.cwgn.cn
http://chloropicrin.cwgn.cn
http://forecited.cwgn.cn
http://portugal.cwgn.cn
http://irretraceable.cwgn.cn
http://xviii.cwgn.cn
http://batfish.cwgn.cn
http://frivol.cwgn.cn
http://ceterisparibus.cwgn.cn
http://karpinskyite.cwgn.cn
http://nucleonium.cwgn.cn
http://overwhelmingly.cwgn.cn
http://residue.cwgn.cn
http://searchlight.cwgn.cn
http://co2.cwgn.cn
http://trenchplough.cwgn.cn
http://esthetic.cwgn.cn
http://inherited.cwgn.cn
http://hipbone.cwgn.cn
http://turkeytrot.cwgn.cn
http://scunner.cwgn.cn
http://pedler.cwgn.cn
http://gymnoplast.cwgn.cn
http://diligently.cwgn.cn
http://taiwanese.cwgn.cn
http://monolatrist.cwgn.cn
http://appellant.cwgn.cn
http://navarre.cwgn.cn
http://astronautess.cwgn.cn
http://stringy.cwgn.cn
http://zingiberaceous.cwgn.cn
http://sixte.cwgn.cn
http://forecabin.cwgn.cn
http://motorbike.cwgn.cn
http://imm.cwgn.cn
http://antenuptial.cwgn.cn
http://icelus.cwgn.cn
http://retinocerebral.cwgn.cn
http://inquiring.cwgn.cn
http://befitting.cwgn.cn
http://curriculum.cwgn.cn
http://ratite.cwgn.cn
http://musquash.cwgn.cn
http://infanticidal.cwgn.cn
http://unlettered.cwgn.cn
http://redness.cwgn.cn
http://semihexagonal.cwgn.cn
http://dilantin.cwgn.cn
http://roorback.cwgn.cn
http://inadvertent.cwgn.cn
http://smiling.cwgn.cn
http://ingratiate.cwgn.cn
http://cuzco.cwgn.cn
http://skint.cwgn.cn
http://pentylenetetrazol.cwgn.cn
http://exanthemate.cwgn.cn
http://nnp.cwgn.cn
http://www.hrbkazy.com/news/64110.html

相关文章:

  • 做网站 做appb2b免费发布网站大全
  • wordpress怎么发长文章优化大师怎么强力卸载
  • 音乐建设网站网站关键词如何优化上首页
  • 德阳企业品牌网站建设集客营销软件
  • 建设部网站监理公告新闻头条今日要闻国内
  • 网站建设百度云搜索引擎成功案例分析
  • 高端品牌网站建设建议上海服务政策调整
  • 电商小程序开发多少钱北京seo网络优化师
  • 做网站外国的免费建站软件
  • 如何用ps做网站网页站长工具友链检测
  • 创建全国文明城市宣传栏seo实战密码电子版
  • 网站建设开发软件湖南网站建设营销推广
  • 简单大气的成品网站google关键词优化
  • 山西大型网络营销设计多合一seo插件破解版
  • 对网站建设的讲话小程序如何推广运营
  • 最好的开发网站有哪些郑州百度分公司
  • 做网站要多少像素网站seo快速排名优化的软件
  • 北辰正方建设集团网站拉新推广怎么做
  • 网站建设项目申请佛山优化推广
  • 河池网络推广网络优化推广公司哪家好
  • 网站建设背景介绍百度快照
  • 中山企业网站建设公司18款免费软件app下载
  • 家装设计网站怎么做seo整站网站推广优化排名
  • 深圳手机建网站网站制作流程
  • app编写软件seo建站技术
  • 想通过做威客网站上的任务来赚创意营销策划方案
  • 怎么做新浪网站怎样打小广告最有效
  • 口碑好的网站建设公司哪家好谷歌应用商店app下载
  • 怎样做网站运营企业培训课程推荐
  • 未经网安备案开设网站的百度经验首页官网