| /* |
| * Licensed to the Apache Software Foundation (ASF) under one or more |
| * contributor license agreements. See the NOTICE file distributed with |
| * this work for additional information regarding copyright ownership. |
| * The ASF licenses this file to You under the Apache License, Version 2.0 |
| * (the "License"); you may not use this file except in compliance with |
| * the License. You may obtain a copy of the License at |
| * |
| * http://www.apache.org/licenses/LICENSE-2.0 |
| * |
| * Unless required by applicable law or agreed to in writing, software |
| * distributed under the License is distributed on an "AS IS" BASIS, |
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| * See the License for the specific language governing permissions and |
| * limitations under the License. |
| * |
| */ |
| |
| // 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_apdex = from(Service.latency).apdex(name, status); |
| |
| // 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 relation scope metrics for topology |
| service_instance_relation_client_cpm = from(ServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).cpm(); |
| service_instance_relation_server_cpm = from(ServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).cpm(); |
| service_instance_relation_client_call_sla = from(ServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).percent(status == true); |
| service_instance_relation_server_call_sla = from(ServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).percent(status == true); |
| service_instance_relation_client_resp_time = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).longAvg(); |
| service_instance_relation_server_resp_time = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.SERVER).longAvg(); |
| service_instance_relation_client_p99 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p99(10); |
| service_instance_relation_server_p99 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p99(10); |
| service_instance_relation_client_p95 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p95(10); |
| service_instance_relation_server_p95 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p95(10); |
| service_instance_relation_client_p90 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p90(10); |
| service_instance_relation_server_p90 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p90(10); |
| service_instance_relation_client_p75 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p75(10); |
| service_instance_relation_server_p75 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.SERVER).p75(10); |
| service_instance_relation_client_p50 = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).p50(10); |
| service_instance_relation_server_p50 = from(ServiceInstanceRelation.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); |