zoukankan      html  css  js  c++  java
  • skywalking中表字段的信息

    https://skyapm.github.io/document-cn-translation-of-skywalking/zh/6.2.0/concepts-and-designs/scope-definitions.html

     

     

     

     

     

     

     

     

     

     定义了上面的字段之后,为了计算数据,skywalking定义了一种OAL脚本来进行聚合运算

     https://skyapm.github.io/document-cn-translation-of-skywalking/zh/6.2.0/concepts-and-designs/oal.html

     

     

     

     skywalking的所有的oal定义在文件official_analysis.oal中

     文件的内容如下

    // All scope metrics
    all_p99 = from(All.latency).p99(10);
    all_p95 = from(All.latency).p95(10);
    all_p90 = from(All.latency).p90(10);
    all_p75 = from(All.latency).p75(10);
    all_p50 = from(All.latency).p50(10);
    all_heatmap = from(All.latency).thermodynamic(100, 20);
    
    // Service scope metrics
    service_resp_time = from(Service.latency).longAvg();
    service_sla = from(Service.*).percent(status == true);
    service_cpm = from(Service.*).cpm();
    service_p99 = from(Service.latency).p99(10);
    service_p95 = from(Service.latency).p95(10);
    service_p90 = from(Service.latency).p90(10);
    service_p75 = from(Service.latency).p75(10);
    service_p50 = from(Service.latency).p50(10);
    
    // Service relation scope metrics for topology
    service_relation_client_cpm = from(ServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).cpm();
    service_relation_server_cpm = from(ServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).cpm();
    service_relation_client_call_sla = from(ServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).percent(status == true);
    service_relation_server_call_sla = from(ServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).percent(status == true);
    service_relation_client_resp_time = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).longAvg();
    service_relation_server_resp_time = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).longAvg();
    service_relation_client_p99 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p99(10);
    service_relation_server_p99 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p99(10);
    service_relation_client_p95 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p95(10);
    service_relation_server_p95 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p95(10);
    service_relation_client_p90 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p90(10);
    service_relation_server_p90 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p90(10);
    service_relation_client_p75 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p75(10);
    service_relation_server_p75 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p75(10);
    service_relation_client_p50 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p50(10);
    service_relation_server_p50 = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p50(10);
    
    // Service Instance Scope metrics
    service_instance_sla = from(ServiceInstance.*).percent(status == true);
    service_instance_resp_time= from(ServiceInstance.latency).longAvg();
    service_instance_cpm = from(ServiceInstance.*).cpm();
    
    // Endpoint scope metrics
    endpoint_cpm = from(Endpoint.*).cpm();
    endpoint_avg = from(Endpoint.latency).longAvg();
    endpoint_sla = from(Endpoint.*).percent(status == true);
    endpoint_p99 = from(Endpoint.latency).p99(10);
    endpoint_p95 = from(Endpoint.latency).p95(10);
    endpoint_p90 = from(Endpoint.latency).p90(10);
    endpoint_p75 = from(Endpoint.latency).p75(10);
    endpoint_p50 = from(Endpoint.latency).p50(10);
    
    // Endpoint relation scope metrics
    endpoint_relation_cpm = from(EndpointRelation.*).filter(detectPoint == DetectPoint.SERVER).cpm();
    endpoint_relation_resp_time = from(EndpointRelation.rpcLatency).filter(detectPoint == DetectPoint.SERVER).longAvg();
    
    // JVM instance metrics
    instance_jvm_cpu = from(ServiceInstanceJVMCPU.usePercent).doubleAvg();
    instance_jvm_memory_heap = from(ServiceInstanceJVMMemory.used).filter(heapStatus == true).longAvg();
    instance_jvm_memory_noheap = from(ServiceInstanceJVMMemory.used).filter(heapStatus == false).longAvg();
    instance_jvm_memory_heap_max = from(ServiceInstanceJVMMemory.max).filter(heapStatus == true).longAvg();
    instance_jvm_memory_noheap_max = from(ServiceInstanceJVMMemory.max).filter(heapStatus == false).longAvg();
    instance_jvm_young_gc_time = from(ServiceInstanceJVMGC.time).filter(phrase == GCPhrase.NEW).sum();
    instance_jvm_old_gc_time = from(ServiceInstanceJVMGC.time).filter(phrase == GCPhrase.OLD).sum();
    instance_jvm_young_gc_count = from(ServiceInstanceJVMGC.count).filter(phrase == GCPhrase.NEW).sum();
    instance_jvm_old_gc_count = from(ServiceInstanceJVMGC.count).filter(phrase == GCPhrase.OLD).sum();
    
    database_access_resp_time = from(DatabaseAccess.latency).longAvg();
    database_access_sla = from(DatabaseAccess.*).percent(status == true);
    database_access_cpm = from(DatabaseAccess.*).cpm();
    database_access_p99 = from(DatabaseAccess.latency).p99(10);
    database_access_p95 = from(DatabaseAccess.latency).p95(10);
    database_access_p90 = from(DatabaseAccess.latency).p90(10);
    database_access_p75 = from(DatabaseAccess.latency).p75(10);
    database_access_p50 = from(DatabaseAccess.latency).p50(10);
    
    // CLR instance metrics
    instance_clr_cpu = from(ServiceInstanceCLRCPU.usePercent).doubleAvg();
    instance_clr_gen0_collect_count = from(ServiceInstanceCLRGC.gen0CollectCount).sum();
    instance_clr_gen1_collect_count = from(ServiceInstanceCLRGC.gen1CollectCount).sum();
    instance_clr_gen2_collect_count = from(ServiceInstanceCLRGC.gen2CollectCount).sum();
    instance_clr_heap_memory = from(ServiceInstanceCLRGC.heapMemory).longAvg();
    instance_clr_available_completion_port_threads = from(ServiceInstanceCLRThread.availableCompletionPortThreads).max();
    instance_clr_available_worker_threads = from(ServiceInstanceCLRThread.availableWorkerThreads).max();
    instance_clr_max_completion_port_threads = from(ServiceInstanceCLRThread.maxCompletionPortThreads).max();
    instance_clr_max_worker_threads = from(ServiceInstanceCLRThread.maxWorkerThreads).max();
    
    // Envoy instance metrics
    envoy_heap_memory_max_used = from(EnvoyInstanceMetric.value).filter(metricName == "server.memory_heap_size").maxDouble();
    envoy_total_connections_used = from(EnvoyInstanceMetric.value).filter(metricName == "server.total_connections").maxDouble();
    envoy_parent_connections_used = from(EnvoyInstanceMetric.value).filter(metricName == "server.parent_connections").maxDouble();
    
    // Disable unnecessary hard core sources
    /////////
    // disable(segment);
    // disable(endpoint_relation_server_side);
    // disable(top_n_database_statement);
    // disable(zipkin_span);
    // disable(jaeger_span);

    定义的指标值如下

    全局指标
    
    all_p99, 所有服务响应时间的 p99 值
    all_p95
    all_p90
    all_p75
    all_p70
    all_heatmap, 所有服务响应时间的热点图
    服务指标
    
    service_resp_time, 服务的平均响应时间
    service_sla, 服务的成功率
    service_cpm, 服务每分钟调用次数
    service_p99, 服务响应时间的 p99 值
    service_p95
    service_p90
    service_p75
    service_p50
    服务实例指标
    
    service_instance_sla, 服务实例的成功率
    service_instance_resp_time, 服务实例的平均响应时间
    service_instance_cpm, 服务实例每分钟调用次数
    端点指标
    
    endpoint_cpm, 端点每分钟调用次数
    endpoint_avg, 端点平均响应时间
    endpoint_sla, 端点成功率
    endpoint_p99, 端点响应时间的 p99 值
    endpoint_p95
    endpoint_p90
    endpoint_p75
    endpoint_p50
    JVM 指标, JVM 相关的指标, 只有当 javaagent 启用时才有效
    
    instance_jvm_cpu
    instance_jvm_memory_heap
    instance_jvm_memory_noheap
    instance_jvm_memory_heap_max
    instance_jvm_memory_noheap_max
    instance_jvm_young_gc_time
    instance_jvm_old_gc_time
    instance_jvm_young_gc_count
    instance_jvm_old_gc_count
    服务关系指标, 代表服务之间调用的指标 指标的 ID 只能在拓扑图查询中获取
    
    service_relation_client_cpm, 在客户端每分钟检测到的调用次数
    service_relation_server_cpm, 在服务端每分钟检测到的调用次数
    service_relation_client_call_sla, 在客户端检测到的成功率
    service_relation_server_call_sla, 在服务端检测到的成功率
    service_relation_client_resp_time, 在客户端检测到的平均响应时间
    service_relation_server_resp_time, 在服务端检测到的平均响应时间
    端点关系指标, 代表相互依赖的端点之间的指标. 只有在追踪代理启用时有效. 指标 ID 只能在拓扑查询中获得.
    
    endpoint_relation_cpm
    endpoint_relation_resp_time

     我们来看看skywalking中页面框图的意思

     上面对于的计算指标是

     

     首先看latency表示的意思是服务下每个请求的耗时

     all_p99 = from(All.latency).p99(10);all表示所有的服务,服务就是应用的意思当前系统下面有三个应用,三个应用下面一共存在1000次请求,这里指的就是所有1000次请求中99%的请求响应时间都是在某个范围内

     global Top Throughput中表示当前所有的应用中的方法中,那个请求的数量最多

    global Top slow Endpoint表示当前所有应用下面的那个请求最耗时

     这里的Global  heatmap实际上调用的是

     当前的请求在热力图上的分布情况,每一次请求在热力图上面对应一个点

     表示当前应用下的全部请求耗时在20毫秒和100毫秒

    https://skyapm.github.io/document-cn-translation-of-skywalking/zh/6.2.0/concepts-and-designs/oal.html

    https://skyapm.github.io/document-cn-translation-of-skywalking/zh/6.2.0/concepts-and-designs/scope-definitions.html

     service_resp_time = from(Service.latency).longAvg();

     表示当前应用下每个请求的耗时的平均值,所以存在不准的情况,应该不应该把当前应用向注册中心那个请求时间算在内,这里要注意

    service_sla = from(Service.*).percent(status == true);

     表示当前应用下sla:请求的成功率是多少

     上面表表示应用spring-user在20点34分到21点04分这半个小时内,应用这段时间内每分钟的请求数目是1.33次,这个1.33次是如何算出来的了

         

     应用在20点43分,发送了一次请求,在20点44分发送了一次请求,在20点45分发生了2次请求,所有20点43 20点44分 20点45分,三分钟之内发送了4请请求,每一分钟的平均请求时间为4除以3等于1.33.,这里要注意虽然选择的查询时间从20点11到21点11一共30分钟,这里面大部分时间没有请求产生,平均请求次数不能是4/30,而是统计真正发送请求的时间

    对于的信息在数据库的表service_cpm中可以看到,entity_id表示当前应用的编号,3对于的就是spring-user应用,service_cpm记录的是当前一个小时之内应用的访问数据

     如果当前应用选择查询的时间超过一个小时,选择最近一天,如下图所示,我们看到cpm为0,因为查询的是

     

    我们可以看到选择最近一天查询的时间间隔是小时,查询的是service_cpm_hour这张表

     从上面分析我们已经知道应用在20点43分,发送了一次请求,在20点44分发送了一次请求,在20点45分发生了2次请求,所有20点43 20点44分 20点45分,所以在20 内发送了4次请求,所有表中service_cpm_hour对于的2020010420这个时间点的值是4,页面上从1月3号21点到1月4号21点内没有任何请求,所以cpm为0

    同理,选择最近一周,查询的是service_cpm_day这张表

     

    在表service_cpm_day中时间是按照天进行统计的,在20200104 在1月4号这天发生了4次请求

     同理应用的平均响应时间类似,这里为啥是74264.67ms了

    应用在20点43分的这一分钟内发送了请求应用的平均响应时间123851,在20点44分应用在这一分钟内发生了请求对于的平均响应时间是76455,在20点45分发生了请求对于的平均响应时间是22488,所以在20点00到21点这段时间内,只有3分钟内发送了请求,其余时间没有发送请求,平均响应时间为(123851+76455+22488)/3=74264.67ms

    应用的平均响应时间,是依据应用下的每个应用的实例响应时间计算出来的,查询的表如下

     应用下面的p99 p50如下,查询的是service_p50相关的表

     

    表示当前应用下面那个请求最慢,当前应用存在哪些实例

    对于方法的操作

     首先要选择那个应用,然后选择该应用下对于的端点

    调用的统计信息为

    // Endpoint scope metrics
    endpoint_cpm = from(Endpoint.*).cpm();
    endpoint_avg = from(Endpoint.latency).longAvg();
    endpoint_sla = from(Endpoint.*).percent(status == true);
    endpoint_p99 = from(Endpoint.latency).p99(10);
    endpoint_p95 = from(Endpoint.latency).p95(10);
    endpoint_p90 = from(Endpoint.latency).p90(10);
    endpoint_p75 = from(Endpoint.latency).p75(10);
    endpoint_p50 = from(Endpoint.latency).p50(10);

    表示该端点对于的平均响应时间,平均请求信息,平均每分钟的请求数目灯

     表示应用spring-user的方法/user/5在20点45分,这一分钟内的平均响应时间是25577毫秒

     这里表示的是应用spring-user的方法/user/5在20点32分到21点02分内,方法的平均响应时间是74714毫秒

  • 相关阅读:
    11 数值的整数次方
    10 二进制中1的个数
    6 重建二叉树
    5 从尾到头打印链表
    计算机网络面试题
    Http和Https的区别
    UVALive 7749 Convex Contour (计算几何)
    Gym 101190H Hard Refactoring (模拟坑题)
    UVa 11324 The Largest Clique (强连通分量+DP)
    HDU 6006 Engineer Assignment (状压DP)
  • 原文地址:https://www.cnblogs.com/kebibuluan/p/12150158.html
Copyright © 2011-2022 走看看