This is an automated email from the ASF dual-hosted git repository. wusheng pushed a commit to branch oal-v2 in repository https://gitbox.apache.org/repos/asf/skywalking.git
commit 01ae4e07aee06e640655c1d0194667b4578e265f Author: Wu Sheng <[email protected]> AuthorDate: Tue Feb 10 08:56:32 2026 +0800 Fix type casting and add production OAL parsing tests MetricDefinitionEnricher fixes: - Use ClassMethodUtil.toGetMethod(List<String>) for nested attributes like sideCar.internalRequestLatencyNanos and map access tag["key"] - Add proper type casting for int parameters (was missing, causing PercentileMetrics2.combine(long,int) not found errors) - Explicit cast type (from OAL syntax) takes precedence over automatic Add ProductionOALScriptsTest to verify all production OAL files from server-starter can be parsed by V2 parser: - Parameterized test for core.oal, java-agent.oal, dotnet-agent.oal, browser.oal, tcp.oal, mesh.oal, ebpf.oal, cilium.oal - Verify parsing succeeds and metrics have required fields - Test specific syntax features: nested access, map access, cast types - Copy production OAL files to test resources to avoid dependencies Co-Authored-By: Claude Opus 4.5 <[email protected]> --- .../oal/v2/generator/MetricDefinitionEnricher.java | 19 +- .../oal/v2/generator/ProductionOALScriptsTest.java | 173 ++++++++++ .../oal-rt/src/test/resources/oal/browser.oal | 75 +++++ .../oal-rt/src/test/resources/oal/cilium.oal | 200 ++++++++++++ oap-server/oal-rt/src/test/resources/oal/core.oal | 98 ++++++ .../oal-rt/src/test/resources/oal/disable.oal | 31 ++ .../oal-rt/src/test/resources/oal/dotnet-agent.oal | 28 ++ oap-server/oal-rt/src/test/resources/oal/ebpf.oal | 356 +++++++++++++++++++++ .../oal-rt/src/test/resources/oal/java-agent.oal | 51 +++ oap-server/oal-rt/src/test/resources/oal/mesh.oal | 36 +++ oap-server/oal-rt/src/test/resources/oal/tcp.oal | 32 ++ 11 files changed, 1091 insertions(+), 8 deletions(-) diff --git a/oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/MetricDefinitionEnricher.java b/oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/MetricDefinitionEnricher.java index ee7f17af79..8a01871113 100644 --- a/oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/MetricDefinitionEnricher.java +++ b/oap-server/oal-rt/src/main/java/org/apache/skywalking/oal/v2/generator/MetricDefinitionEnricher.java @@ -184,18 +184,21 @@ public class MetricDefinitionEnricher { if (annotation instanceof SourceFrom) { // Source attribute from OAL script - String sourceAttribute = metric.getSource().getAttributes().isEmpty() - ? "" - : metric.getSource().getAttributes().get(0); + // Handle nested attributes and map expressions + List<String> attributes = metric.getSource().getAttributes(); + String expression = attributes.isEmpty() + ? "source" + : "source." + ClassMethodUtil.toGetMethod(attributes); String castType = metric.getSource().getCastType().orElse(null); - String expression = "source." + ClassMethodUtil.toGetMethod(sourceAttribute) + "()"; // Cast to match parameter type if needed - if (castType == null && parameterType.equals(long.class)) { + if (castType != null) { + expression = TypeCastUtil.withCast(castType, expression); + } else if (parameterType.equals(int.class)) { + expression = "(int)(" + expression + ")"; + } else if (parameterType.equals(long.class)) { expression = "(long)(" + expression + ")"; - } else if (castType == null && parameterType.equals(double.class)) { + } else if (parameterType.equals(double.class)) { expression = "(double)(" + expression + ")"; - } else { - expression = TypeCastUtil.withCast(castType, expression); } argsExpressions.add(expression); argTypes.add(2); // ATTRIBUTE_EXP_TYPE diff --git a/oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/v2/generator/ProductionOALScriptsTest.java b/oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/v2/generator/ProductionOALScriptsTest.java new file mode 100644 index 0000000000..2b479ab2c1 --- /dev/null +++ b/oap-server/oal-rt/src/test/java/org/apache/skywalking/oal/v2/generator/ProductionOALScriptsTest.java @@ -0,0 +1,173 @@ +/* + * 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. + * + */ + +package org.apache.skywalking.oal.v2.generator; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.StandardCharsets; +import java.util.List; +import org.apache.commons.io.IOUtils; +import org.apache.skywalking.oal.v2.model.MetricDefinition; +import org.apache.skywalking.oal.v2.parser.OALScriptParserV2; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.ValueSource; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; + +/** + * Tests that verify all production OAL scripts can be parsed by the V2 parser. + * + * These OAL files are copied from server-starter/src/main/resources/oal/ to avoid + * circular dependency issues. + * + * This test focuses on parsing validation. Full code generation integration testing + * is handled by OALClassGeneratorV2Test and the E2E tests at runtime. + */ +public class ProductionOALScriptsTest { + + /** + * Test that each production OAL file can be parsed correctly. + */ + @ParameterizedTest + @ValueSource(strings = { + "core.oal", + "java-agent.oal", + "dotnet-agent.oal", + "browser.oal", + "tcp.oal", + "mesh.oal", + "ebpf.oal", + "cilium.oal" + }) + public void testProductionOALScriptParsing(String oalFileName) throws Exception { + String oalContent = readOALFile(oalFileName); + assertNotNull(oalContent, "OAL file should be readable: " + oalFileName); + assertFalse(oalContent.isEmpty(), "OAL file should not be empty: " + oalFileName); + + try { + // Parse the OAL script + OALScriptParserV2 parser = OALScriptParserV2.parse(oalContent); + List<MetricDefinition> metrics = parser.getMetrics(); + + assertFalse(metrics.isEmpty(), "OAL file should define at least one metric: " + oalFileName); + + // Verify each metric has required fields + for (MetricDefinition metric : metrics) { + assertNotNull(metric.getName(), "Metric name should not be null in " + oalFileName); + assertNotNull(metric.getSource(), "Metric source should not be null in " + oalFileName); + assertNotNull(metric.getAggregationFunction(), + "Metric aggregation function should not be null in " + oalFileName); + } + } catch (Exception e) { + fail("Failed to parse " + oalFileName + ": " + e.getMessage()); + } + } + + /** + * Test disable.oal can be parsed (all disable statements are currently commented out). + */ + @Test + public void testDisableOAL() throws Exception { + String oalContent = readOALFile("disable.oal"); + assertNotNull(oalContent, "disable.oal should be readable"); + + // Should parse without errors even with all statements commented out + OALScriptParserV2 parser = OALScriptParserV2.parse(oalContent); + // Currently all disable statements are commented out in disable.oal + // so we just verify parsing succeeds + assertNotNull(parser.getDisabledSources()); + } + + /** + * Verify total metrics count across all OAL files. + */ + @Test + public void testTotalMetricsCount() throws Exception { + String[] allFiles = {"core.oal", "java-agent.oal", "dotnet-agent.oal", "browser.oal", + "tcp.oal", "mesh.oal", "ebpf.oal", "cilium.oal"}; + + int totalMetrics = 0; + for (String oalFileName : allFiles) { + String oalContent = readOALFile(oalFileName); + if (oalContent == null || oalContent.isEmpty()) { + continue; + } + + OALScriptParserV2 parser = OALScriptParserV2.parse(oalContent); + totalMetrics += parser.getMetrics().size(); + } + + assertTrue(totalMetrics > 100, + "Should have significant number of metrics across all OAL files, got: " + totalMetrics); + } + + /** + * Verify specific OAL syntax features are parsed correctly. + */ + @Test + public void testOALSyntaxFeatures() throws Exception { + // Test nested property access (sideCar.internalRequestLatencyNanos) + String meshContent = readOALFile("mesh.oal"); + if (meshContent != null) { + OALScriptParserV2 parser = OALScriptParserV2.parse(meshContent); + List<MetricDefinition> metrics = parser.getMetrics(); + + boolean foundNestedAccess = metrics.stream() + .anyMatch(m -> m.getSource().getAttributes().size() > 1 || + m.getSource().getAttributes().stream() + .anyMatch(attr -> attr.contains("."))); + assertTrue(foundNestedAccess, "mesh.oal should contain nested property access"); + } + + // Test map access (tag["key"]) + String coreContent = readOALFile("core.oal"); + if (coreContent != null) { + OALScriptParserV2 parser = OALScriptParserV2.parse(coreContent); + List<MetricDefinition> metrics = parser.getMetrics(); + + boolean foundMapAccess = metrics.stream() + .anyMatch(m -> m.getSource().getAttributes().stream() + .anyMatch(attr -> attr.contains("["))); + assertTrue(foundMapAccess, "core.oal should contain map access syntax"); + } + + // Test cast type (str->long) + if (coreContent != null) { + OALScriptParserV2 parser = OALScriptParserV2.parse(coreContent); + List<MetricDefinition> metrics = parser.getMetrics(); + + boolean foundCastType = metrics.stream() + .anyMatch(m -> m.getSource().getCastType().isPresent()); + assertTrue(foundCastType, "core.oal should contain cast type syntax"); + } + } + + private String readOALFile(String fileName) throws IOException { + try (InputStream is = getClass().getClassLoader().getResourceAsStream("oal/" + fileName)) { + if (is == null) { + return null; + } + return IOUtils.toString(is, StandardCharsets.UTF_8); + } + } +} diff --git a/oap-server/oal-rt/src/test/resources/oal/browser.oal b/oap-server/oal-rt/src/test/resources/oal/browser.oal new file mode 100644 index 0000000000..995dcf09b0 --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/browser.oal @@ -0,0 +1,75 @@ +/* +* 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. +* +*/ +// browser app +browser_app_pv = from(BrowserAppTraffic.count).filter(trafficCategory == BrowserAppTrafficCategory.NORMAL).sum(); +browser_app_error_rate = from(BrowserAppTraffic.*).rate(trafficCategory == BrowserAppTrafficCategory.FIRST_ERROR,trafficCategory == BrowserAppTrafficCategory.NORMAL); +browser_app_error_sum = from(BrowserAppTraffic.count).filter(trafficCategory != BrowserAppTrafficCategory.NORMAL).sum(); + +// browser app single version +browser_app_single_version_pv = from(BrowserAppSingleVersionTraffic.count).filter(trafficCategory == BrowserAppTrafficCategory.NORMAL).sum(); +browser_app_single_version_error_rate = from(BrowserAppSingleVersionTraffic.trafficCategory).rate(trafficCategory == BrowserAppTrafficCategory.FIRST_ERROR,trafficCategory == BrowserAppTrafficCategory.NORMAL); +browser_app_single_version_error_sum = from(BrowserAppSingleVersionTraffic.count).filter(trafficCategory != BrowserAppTrafficCategory.NORMAL).sum(); + +// browser app page +browser_app_page_pv = from(BrowserAppPageTraffic.count).filter(trafficCategory == BrowserAppTrafficCategory.NORMAL).sum(); +browser_app_page_error_rate = from(BrowserAppPageTraffic.*).rate(trafficCategory == BrowserAppTrafficCategory.FIRST_ERROR,trafficCategory == BrowserAppTrafficCategory.NORMAL); +browser_app_page_error_sum = from(BrowserAppPageTraffic.count).filter(trafficCategory != BrowserAppTrafficCategory.NORMAL).sum(); + +browser_app_page_ajax_error_sum = from(BrowserAppPageTraffic.count).filter(trafficCategory != BrowserAppTrafficCategory.NORMAL).filter(errorCategory == BrowserErrorCategory.AJAX).sum(); +browser_app_page_resource_error_sum = from(BrowserAppPageTraffic.count).filter(trafficCategory != BrowserAppTrafficCategory.NORMAL).filter(errorCategory == BrowserErrorCategory.RESOURCE).sum(); +browser_app_page_js_error_sum = from(BrowserAppPageTraffic.count).filter(trafficCategory != BrowserAppTrafficCategory.NORMAL).filter(errorCategory in [BrowserErrorCategory.JS,BrowserErrorCategory.VUE,BrowserErrorCategory.PROMISE]).sum(); +browser_app_page_unknown_error_sum = from(BrowserAppPageTraffic.count).filter(trafficCategory != BrowserAppTrafficCategory.NORMAL).filter(errorCategory == BrowserErrorCategory.UNKNOWN).sum(); + +// browser performance metrics +browser_app_page_redirect_avg = from(BrowserAppPagePerf.redirectTime).longAvg(); +browser_app_page_dns_avg = from(BrowserAppPagePerf.dnsTime).longAvg(); +browser_app_page_ttfb_avg = from(BrowserAppPagePerf.ttfbTime).longAvg(); +browser_app_page_tcp_avg = from(BrowserAppPagePerf.tcpTime).longAvg(); +browser_app_page_trans_avg = from(BrowserAppPagePerf.transTime).longAvg(); +browser_app_page_dom_analysis_avg = from(BrowserAppPagePerf.domAnalysisTime).longAvg(); +browser_app_page_fpt_avg = from(BrowserAppPagePerf.fptTime).longAvg(); +browser_app_page_dom_ready_avg = from(BrowserAppPagePerf.domReadyTime).longAvg(); +browser_app_page_load_page_avg = from(BrowserAppPagePerf.loadPageTime).longAvg(); +browser_app_page_res_avg = from(BrowserAppPagePerf.resTime).longAvg(); +browser_app_page_ssl_avg = from(BrowserAppPagePerf.sslTime).longAvg(); +browser_app_page_ttl_avg = from(BrowserAppPagePerf.ttlTime).longAvg(); +browser_app_page_first_pack_avg = from(BrowserAppPagePerf.firstPackTime).longAvg(); +browser_app_page_fmp_avg = from(BrowserAppPagePerf.fmpTime).longAvg(); + +browser_app_page_fpt_percentile = from(BrowserAppPagePerf.fptTime).percentile2(10); +browser_app_page_ttl_percentile = from(BrowserAppPagePerf.ttlTime).percentile2(10); +browser_app_page_dom_ready_percentile = from(BrowserAppPagePerf.domReadyTime).percentile2(10); +browser_app_page_load_page_percentile = from(BrowserAppPagePerf.loadPageTime).percentile2(10); +browser_app_page_first_pack_percentile = from(BrowserAppPagePerf.firstPackTime).percentile2(10); +browser_app_page_fmp_percentile = from(BrowserAppPagePerf.fmpTime).percentile2(10); + +// Since the web vitals and resource can be load from cache or cross-origin, so the metrics should ignore when the value is 0 +browser_app_resource_duration_avg = from(BrowserAppResourcePerf.*).labelAvg(name, duration); +browser_app_resource_size_avg = from(BrowserAppResourcePerf.*).labelAvg(name, size); +browser_app_resource_protocol_count = from(BrowserAppResourcePerf.*).labelCount(protocol); +browser_app_resource_type_count = from(BrowserAppResourcePerf.*).labelCount(type); + +browser_app_web_vitals_fmp_avg = from(BrowserAppWebVitalsPerf.fmpTime).filter(fmpTime >= 0).longAvg(); +browser_app_web_vitals_cls_avg = from(BrowserAppWebVitalsPerf.cls).filter(cls >= 0).longAvg(); +browser_app_web_vitals_lcp_avg = from(BrowserAppWebVitalsPerf.lcpTime).filter(lcpTime >= 0).longAvg(); + +browser_app_web_interaction_inp_percentile = from(BrowserAppWebInteractionPerf.inpTime).filter(inpTime >= 0).percentile2(10); + +// Disable unnecessary hard core stream, targeting @Stream#name +///////// +//disable(browser_error_log); diff --git a/oap-server/oal-rt/src/test/resources/oal/cilium.oal b/oap-server/oal-rt/src/test/resources/oal/cilium.oal new file mode 100644 index 0000000000..b3c28ae853 --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/cilium.oal @@ -0,0 +1,200 @@ +/* + * 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. + * + */ + +// Cilium Service +cilium_service_l4_read_pkg_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "tcp").filter(direction == "ingress").cpm(); +cilium_service_l4_write_pkg_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "tcp").filter(direction == "egress").cpm(); +cilium_service_l4_read_pkg_drop_cpm = from(CiliumService.*).filter(verdict == "dropped").filter(type == "tcp").filter(direction == "ingress").cpm(); +cilium_service_l4_write_pkg_drop_cpm = from(CiliumService.*).filter(verdict == "dropped").filter(type == "tcp").filter(direction == "egress").cpm(); +cilium_service_l4_drop_reason_count = from(CiliumService.*).filter(verdict == "dropped").filter(type == "tcp").labelCount(dropReason); +// Protocols of Service(Summary) +cilium_service_protocol_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_protocol_call_duration = from(CiliumService.duration).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_protocol_call_success_count = from(CiliumService.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +// Protocols of Service(HTTP) +cilium_service_protocol_http_call_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_protocol_http_call_duration = from(CiliumService.duration).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_protocol_http_call_success_count = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_protocol_http_status_1xx_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 100).filter(http.code < 200).cpm(); +cilium_service_protocol_http_status_2xx_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 200).filter(http.code < 300).cpm(); +cilium_service_protocol_http_status_3xx_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 300).filter(http.code < 400).cpm(); +cilium_service_protocol_http_status_4xx_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 400).filter(http.code < 500).cpm(); +cilium_service_protocol_http_status_5xx_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 500).filter(http.code < 600).cpm(); +// Protocols of Service(DNS) +cilium_service_protocol_dns_call_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_protocol_dns_call_duration = from(CiliumService.duration).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_protocol_dns_call_success_count = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_protocol_dns_error_count = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).filter(success == false).labelCount(dns.rcodeString); +// Protocols of Service(Kafka) +cilium_service_protocol_kafka_call_cpm = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_protocol_kafka_call_duration = from(CiliumService.duration).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_protocol_kafka_call_success_count = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_protocol_kafka_call_error_count = from(CiliumService.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).filter(success == false).labelCount(kafka.errorCodeString); + +// Cilium Service Instance +cilium_service_instance_l4_read_pkg_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "tcp").filter(direction == "ingress").cpm(); +cilium_service_instance_l4_write_pkg_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "tcp").filter(direction == "egress").cpm(); +cilium_service_instance_l4_read_pkg_drop_cpm = from(CiliumServiceInstance.*).filter(verdict == "dropped").filter(type == "tcp").filter(direction == "ingress").cpm(); +cilium_service_instance_l4_write_pkg_drop_cpm = from(CiliumServiceInstance.*).filter(verdict == "dropped").filter(type == "tcp").filter(direction == "egress").cpm(); +cilium_service_instance_l4_drop_reason_count = from(CiliumServiceInstance.*).filter(verdict == "dropped").filter(type == "tcp").labelCount(dropReason); +// Protocols of Service Instance(Summary) +cilium_service_instance_protocol_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_instance_protocol_call_duration = from(CiliumServiceInstance.duration).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_instance_protocol_call_success_count = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +// Protocols of Service Instance(HTTP) +cilium_service_instance_protocol_http_call_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_instance_protocol_http_call_duration = from(CiliumServiceInstance.duration).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_instance_protocol_http_call_success_count = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_instance_protocol_http_status_1xx_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 100).filter(http.code < 200).cpm(); +cilium_service_instance_protocol_http_status_2xx_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 200).filter(http.code < 300).cpm(); +cilium_service_instance_protocol_http_status_3xx_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 300).filter(http.code < 400).cpm(); +cilium_service_instance_protocol_http_status_4xx_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 400).filter(http.code < 500).cpm(); +cilium_service_instance_protocol_http_status_5xx_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 500).filter(http.code < 600).cpm(); +// Protocols of Service Instance(DNS) +cilium_service_instance_protocol_dns_call_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_instance_protocol_dns_call_duration = from(CiliumServiceInstance.duration).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_instance_protocol_dns_call_success_count = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_instance_protocol_dns_error_count = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).filter(success == false).labelCount(dns.rcodeString); +// Protocols of Service Instance(Kafka) +cilium_service_instance_protocol_kafka_call_cpm = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_instance_protocol_kafka_call_duration = from(CiliumServiceInstance.duration).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_instance_protocol_kafka_call_success_count = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_instance_protocol_kafka_call_error_count = from(CiliumServiceInstance.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).filter(success == false).labelCount(kafka.errorCodeString); + +// Cilium Endpoint +// Protocols of Endpoint(Summary) +cilium_endpoint_protocol_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type != "tcp").cpm(); +cilium_endpoint_protocol_call_duration = from(CiliumEndpoint.duration).filter(verdict == "forwarded").filter(type != "tcp").sum(); +cilium_endpoint_protocol_call_success_count = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type != "tcp").filter(success == true).cpm(); +// Protocols of Endpoint(HTTP) +cilium_endpoint_protocol_http_call_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "http").cpm(); +cilium_endpoint_protocol_http_call_duration = from(CiliumEndpoint.duration).filter(verdict == "forwarded").filter(type == "http").sum(); +cilium_endpoint_protocol_http_call_success_count = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "http").filter(success == true).cpm(); +cilium_endpoint_protocol_http_status_1xx_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "http").filter(http.code >= 100).filter(http.code < 200).cpm(); +cilium_endpoint_protocol_http_status_2xx_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "http").filter(http.code >= 200).filter(http.code < 300).cpm(); +cilium_endpoint_protocol_http_status_3xx_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "http").filter(http.code >= 300).filter(http.code < 400).cpm(); +cilium_endpoint_protocol_http_status_4xx_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "http").filter(http.code >= 400).filter(http.code < 500).cpm(); +cilium_endpoint_protocol_http_status_5xx_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "http").filter(http.code >= 500).filter(http.code < 600).cpm(); +// Protocols of Endpoint(DNS) +cilium_endpoint_protocol_dns_call_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "dns").cpm(); +cilium_endpoint_protocol_dns_call_duration = from(CiliumEndpoint.duration).filter(verdict == "forwarded").filter(type == "dns").sum(); +cilium_endpoint_protocol_dns_call_success_count = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "dns").filter(success == true).cpm(); +cilium_endpoint_protocol_dns_error_count = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "dns").filter(success == false).labelCount(dns.rcodeString); +// Protocols of Endpoint(Kafka) +cilium_endpoint_protocol_kafka_call_cpm = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "kafka").cpm(); +cilium_endpoint_protocol_kafka_call_duration = from(CiliumEndpoint.duration).filter(verdict == "forwarded").filter(type == "kafka").sum(); +cilium_endpoint_protocol_kafka_call_success_count = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "kafka").filter(success == true).cpm(); +cilium_endpoint_protocol_kafka_call_error_count = from(CiliumEndpoint.*).filter(verdict == "forwarded").filter(type == "kafka").filter(success == false).labelCount(kafka.errorCodeString); + +// Cilium Service Relation +cilium_service_relation_client_l4_read_pkg_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(direction == "ingress").cpm(); +cilium_service_relation_client_l4_write_pkg_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(direction == "egress").cpm(); +cilium_service_relation_client_l4_read_pkg_drop_cpm = from(CiliumServiceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(direction == "ingress").cpm(); +cilium_service_relation_client_l4_write_pkg_drop_cpm = from(CiliumServiceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(direction == "egress").cpm(); +cilium_service_relation_client_l4_drop_reason_count = from(CiliumServiceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).labelCount(dropReason); +cilium_service_relation_server_l4_read_pkg_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).filter(direction == "ingress").cpm(); +cilium_service_relation_server_l4_write_pkg_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).filter(direction == "egress").cpm(); +cilium_service_relation_server_l4_read_pkg_drop_cpm = from(CiliumServiceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).filter(direction == "ingress").cpm(); +cilium_service_relation_server_l4_write_pkg_drop_cpm = from(CiliumServiceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).filter(direction == "egress").cpm(); +cilium_service_relation_server_l4_drop_reason_count = from(CiliumServiceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).labelCount(dropReason); +// Protocols of Service Relation(Summary) +cilium_service_relation_client_protocol_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.CLIENT).cpm(); +cilium_service_relation_client_protocol_call_duration = from(CiliumServiceRelation.duration).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.CLIENT).sum(); +cilium_service_relation_client_protocol_call_success_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(success == true).cpm(); +cilium_service_relation_server_protocol_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_relation_server_protocol_call_duration = from(CiliumServiceRelation.duration).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_relation_server_protocol_call_success_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +// Protocols of Service Relation(HTTP) +cilium_service_relation_client_protocol_http_call_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.CLIENT).cpm(); +cilium_service_relation_client_protocol_http_call_duration = from(CiliumServiceRelation.duration).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.CLIENT).sum(); +cilium_service_relation_client_protocol_http_call_success_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.CLIENT).filter(success == true).cpm(); +cilium_service_relation_server_protocol_http_call_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_relation_server_protocol_http_call_duration = from(CiliumServiceRelation.duration).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_relation_server_protocol_http_call_success_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_relation_protocol_http_status_1xx_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 100).filter(http.code < 200).cpm(); +cilium_service_relation_protocol_http_status_2xx_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 200).filter(http.code < 300).cpm(); +cilium_service_relation_protocol_http_status_3xx_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 300).filter(http.code < 400).cpm(); +cilium_service_relation_protocol_http_status_4xx_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 400).filter(http.code < 500).cpm(); +cilium_service_relation_protocol_http_status_5xx_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 500).filter(http.code < 600).cpm(); +// Protocols of Service Relation(DNS) +cilium_service_relation_client_protocol_dns_call_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.CLIENT).cpm(); +cilium_service_relation_client_protocol_dns_call_duration = from(CiliumServiceRelation.duration).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.CLIENT).sum(); +cilium_service_relation_client_protocol_dns_call_success_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.CLIENT).filter(success == true).cpm(); +cilium_service_relation_client_protocol_dns_error_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.CLIENT).filter(success == false).labelCount(dns.rcodeString); +cilium_service_relation_server_protocol_dns_call_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_relation_server_protocol_dns_call_duration = from(CiliumServiceRelation.duration).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_relation_server_protocol_dns_call_success_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_relation_server_protocol_dns_error_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).filter(success == false).labelCount(dns.rcodeString); +// Protocols of Service Relation(Kafka) +cilium_service_relation_client_protocol_kafka_call_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.CLIENT).cpm(); +cilium_service_relation_client_protocol_kafka_call_duration = from(CiliumServiceRelation.duration).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.CLIENT).sum(); +cilium_service_relation_client_protocol_kafka_call_success_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.CLIENT).filter(success == true).cpm(); +cilium_service_relation_client_protocol_kafka_call_error_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.CLIENT).filter(success == false).labelCount(kafka.errorCodeString); +cilium_service_relation_server_protocol_kafka_call_cpm = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_relation_server_protocol_kafka_call_duration = from(CiliumServiceRelation.duration).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_relation_server_protocol_kafka_call_success_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_relation_server_protocol_kafka_call_error_count = from(CiliumServiceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).filter(success == false).labelCount(kafka.errorCodeString); + +// Cilium Service Instance Relation +cilium_service_instance_relation_client_l4_read_pkg_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(direction == "ingress").cpm(); +cilium_service_instance_relation_client_l4_write_pkg_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(direction == "egress").cpm(); +cilium_service_instance_relation_client_l4_read_pkg_drop_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(direction == "ingress").cpm(); +cilium_service_instance_relation_client_l4_write_pkg_drop_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(direction == "egress").cpm(); +cilium_service_instance_relation_client_l4_drop_reason_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.CLIENT).labelCount(dropReason); +cilium_service_instance_relation_server_l4_read_pkg_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).filter(direction == "ingress").cpm(); +cilium_service_instance_relation_server_l4_write_pkg_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).filter(direction == "egress").cpm(); +cilium_service_instance_relation_server_l4_read_pkg_drop_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).filter(direction == "ingress").cpm(); +cilium_service_instance_relation_server_l4_write_pkg_drop_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).filter(direction == "egress").cpm(); +cilium_service_instance_relation_server_l4_drop_reason_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "dropped").filter(type == "tcp").filter(detectPoint == DetectPoint.SERVER).labelCount(dropReason); +// Protocols of Service Instance Relation(Summary) +cilium_service_instance_relation_client_protocol_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.CLIENT).cpm(); +cilium_service_instance_relation_client_protocol_call_duration = from(CiliumServiceInstanceRelation.duration).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.CLIENT).sum(); +cilium_service_instance_relation_client_protocol_call_success_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.CLIENT).filter(success == true).cpm(); +cilium_service_instance_relation_server_protocol_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_instance_relation_server_protocol_call_duration = from(CiliumServiceInstanceRelation.duration).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_instance_relation_server_protocol_call_success_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type != "tcp").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +// Protocols of Service Instance Relation(HTTP) +cilium_service_instance_relation_client_protocol_http_call_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.CLIENT).cpm(); +cilium_service_instance_relation_client_protocol_http_call_duration = from(CiliumServiceInstanceRelation.duration).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.CLIENT).sum(); +cilium_service_instance_relation_client_protocol_http_call_success_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.CLIENT).filter(success == true).cpm(); +cilium_service_instance_relation_server_protocol_http_call_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_instance_relation_server_protocol_http_call_duration = from(CiliumServiceInstanceRelation.duration).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_instance_relation_server_protocol_http_call_success_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_instance_relation_protocol_http_status_1xx_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 100).filter(http.code < 200).cpm(); +cilium_service_instance_relation_protocol_http_status_2xx_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 200).filter(http.code < 300).cpm(); +cilium_service_instance_relation_protocol_http_status_3xx_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 300).filter(http.code < 400).cpm(); +cilium_service_instance_relation_protocol_http_status_4xx_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 400).filter(http.code < 500).cpm(); +cilium_service_instance_relation_protocol_http_status_5xx_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "http").filter(detectPoint == DetectPoint.SERVER).filter(http.code >= 500).filter(http.code < 600).cpm(); +// Protocols of Service Instance Relation(DNS) +cilium_service_instance_relation_client_protocol_dns_call_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.CLIENT).cpm(); +cilium_service_instance_relation_client_protocol_dns_call_duration = from(CiliumServiceInstanceRelation.duration).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.CLIENT).sum(); +cilium_service_instance_relation_client_protocol_dns_call_success_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.CLIENT).filter(success == true).cpm(); +cilium_service_instance_relation_client_protocol_dns_error_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.CLIENT).filter(success == false).labelCount(dns.rcodeString); +cilium_service_instance_relation_server_protocol_dns_call_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_instance_relation_server_protocol_dns_call_duration = from(CiliumServiceInstanceRelation.duration).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_instance_relation_server_protocol_dns_call_success_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_instance_relation_server_protocol_dns_error_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "dns").filter(detectPoint == DetectPoint.SERVER).filter(success == false).labelCount(dns.rcodeString); +// Protocols of Service Instance Relation(Kafka) +cilium_service_instance_relation_client_protocol_kafka_call_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.CLIENT).cpm(); +cilium_service_instance_relation_client_protocol_kafka_call_duration = from(CiliumServiceInstanceRelation.duration).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.CLIENT).sum(); +cilium_service_instance_relation_client_protocol_kafka_call_success_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.CLIENT).filter(success == true).cpm(); +cilium_service_instance_relation_client_protocol_kafka_call_error_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.CLIENT).filter(success == false).labelCount(kafka.errorCodeString); +cilium_service_instance_relation_server_protocol_kafka_call_cpm = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).cpm(); +cilium_service_instance_relation_server_protocol_kafka_call_duration = from(CiliumServiceInstanceRelation.duration).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).sum(); +cilium_service_instance_relation_server_protocol_kafka_call_success_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).filter(success == true).cpm(); +cilium_service_instance_relation_server_protocol_kafka_call_error_count = from(CiliumServiceInstanceRelation.*).filter(verdict == "forwarded").filter(type == "kafka").filter(detectPoint == DetectPoint.SERVER).filter(success == false).labelCount(kafka.errorCodeString); diff --git a/oap-server/oal-rt/src/test/resources/oal/core.oal b/oap-server/oal-rt/src/test/resources/oal/core.oal new file mode 100755 index 0000000000..ba6e664d6a --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/core.oal @@ -0,0 +1,98 @@ +/* + * 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. + * + */ + +// Service scope metrics +service_resp_time = from(Service.latency).longAvg().decorator("ServiceDecorator"); +service_sla = from(Service.*).percent(status == true).decorator("ServiceDecorator"); +service_cpm = from(Service.*).cpm().decorator("ServiceDecorator"); +service_percentile = from(Service.latency).percentile2(10); // Multiple values including p50, p75, p90, p95, p99 +service_apdex = from(Service.latency).apdex(name, status).decorator("ServiceDecorator"); +service_mq_consume_count = from(Service.*).filter(type == RequestType.MQ).count(); +service_mq_consume_latency = from((str->long)Service.tag["transmission.latency"]).filter(type == RequestType.MQ).filter(tag["transmission.latency"] != null).longAvg(); + +// 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_percentile = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).percentile2(10); // Multiple values including p50, p75, p90, p95, p99 +service_relation_server_percentile = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).percentile2(10); // Multiple values including p50, p75, p90, p95, p99 + +// 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_percentile = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.CLIENT).percentile2(10); // Multiple values including p50, p75, p90, p95, p99 +service_instance_relation_server_percentile = from(ServiceInstanceRelation.latency).filter(detectPoint == DetectPoint.SERVER).percentile2(10); // Multiple values including p50, p75, p90, p95, p99 + +// 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().decorator("EndpointDecorator"); +endpoint_resp_time = from(Endpoint.latency).longAvg().decorator("EndpointDecorator"); +endpoint_sla = from(Endpoint.*).percent(status == true).decorator("EndpointDecorator"); +endpoint_percentile = from(Endpoint.latency).percentile2(10); // Multiple values including p50, p75, p90, p95, p99 +endpoint_mq_consume_latency = from((str->long)Endpoint.tag["transmission.latency"]).filter(type == RequestType.MQ).filter(tag["transmission.latency"] != null).longAvg(); + +// 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(); +endpoint_relation_sla = from(EndpointRelation.*).filter(detectPoint == DetectPoint.SERVER).percent(status == true); +endpoint_relation_percentile = from(EndpointRelation.rpcLatency).filter(detectPoint == DetectPoint.SERVER).percentile2(10); // Multiple values including p50, p75, p90, p95, p99 + +database_access_resp_time = from(DatabaseAccess.latency).longAvg(); +database_access_sla = from(DatabaseAccess.*).percent(status == true); +database_access_cpm = from(DatabaseAccess.*).cpm(); +database_access_percentile = from(DatabaseAccess.latency).percentile2(10); + +cache_read_resp_time = from(CacheAccess.latency).filter(operation == VirtualCacheOperation.Read).longAvg(); +cache_read_sla = from(CacheAccess.*).filter(operation == VirtualCacheOperation.Read).percent(status == true); +cache_read_cpm = from(CacheAccess.*).filter(operation == VirtualCacheOperation.Read).cpm(); +cache_read_percentile = from(CacheAccess.latency).filter(operation == VirtualCacheOperation.Read).percentile2(10); + +cache_write_resp_time = from(CacheAccess.latency).filter(operation == VirtualCacheOperation.Write).longAvg(); +cache_write_sla = from(CacheAccess.*).filter(operation == VirtualCacheOperation.Write).percent(status == true); +cache_write_cpm = from(CacheAccess.*).filter(operation == VirtualCacheOperation.Write).cpm(); +cache_write_percentile = from(CacheAccess.latency).filter(operation == VirtualCacheOperation.Write).percentile2(10); + +cache_access_resp_time = from(CacheAccess.latency).longAvg(); +cache_access_sla = from(CacheAccess.*).percent(status == true); +cache_access_cpm = from(CacheAccess.*).cpm(); +cache_access_percentile = from(CacheAccess.latency).percentile2(10); + +mq_service_consume_cpm = from(MQAccess.*).filter(operation == MQOperation.Consume).cpm(); +mq_service_consume_sla = from(MQAccess.*).filter(operation == MQOperation.Consume).percent(status == true); +mq_service_consume_latency = from(MQAccess.transmissionLatency).filter(operation == MQOperation.Consume).longAvg(); +mq_service_consume_percentile = from(MQAccess.transmissionLatency).filter(operation == MQOperation.Consume).percentile2(10); +mq_service_produce_cpm = from(MQAccess.*).filter(operation == MQOperation.Produce).cpm(); +mq_service_produce_sla = from(MQAccess.*).filter(operation == MQOperation.Produce).percent(status == true); + +mq_endpoint_consume_cpm = from(MQEndpointAccess.*).filter(operation == MQOperation.Consume).cpm(); +mq_endpoint_consume_latency = from(MQEndpointAccess.transmissionLatency).filter(operation == MQOperation.Consume).longAvg(); +mq_endpoint_consume_percentile = from(MQEndpointAccess.transmissionLatency).filter(operation == MQOperation.Consume).percentile2(10); +mq_endpoint_consume_sla = from(MQEndpointAccess.*).filter(operation == MQOperation.Consume).percent(status == true); +mq_endpoint_produce_cpm = from(MQEndpointAccess.*).filter(operation == MQOperation.Produce).cpm(); +mq_endpoint_produce_sla = from(MQEndpointAccess.*).filter(operation == MQOperation.Produce).percent(status == true); diff --git a/oap-server/oal-rt/src/test/resources/oal/disable.oal b/oap-server/oal-rt/src/test/resources/oal/disable.oal new file mode 100644 index 0000000000..a14dbbf5f9 --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/disable.oal @@ -0,0 +1,31 @@ +/* + * 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. + * + */ + +/////////////////////////////////////////////////////////////// +// +// Disable unnecessary hard core stream, targeting @Stream#name +// +/////////////////////////////////////////////////////////////// +// disable(segment); +// disable(endpoint_relation_server_side); +// disable(top_n_database_statement); +// disable(zipkin_span); +// disable(jaeger_span); +// disable(profile_task); +// disable(profile_task_log); +// disable(profile_task_segment_snapshot); diff --git a/oap-server/oal-rt/src/test/resources/oal/dotnet-agent.oal b/oap-server/oal-rt/src/test/resources/oal/dotnet-agent.oal new file mode 100644 index 0000000000..e5f10d5132 --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/dotnet-agent.oal @@ -0,0 +1,28 @@ +/* + * 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. + * + */ + +// 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(); \ No newline at end of file diff --git a/oap-server/oal-rt/src/test/resources/oal/ebpf.oal b/oap-server/oal-rt/src/test/resources/oal/ebpf.oal new file mode 100644 index 0000000000..b2f8c8b613 --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/ebpf.oal @@ -0,0 +1,356 @@ +/* + * 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. + * + */ + +// Kubernetes Service +kubernetes_service_connect_cpm = from(K8SService.*).filter(type == "connect").cpm(); +kubernetes_service_connect_time = from(K8SService.connect.duration).filter(type == "connect").longAvg(); +kubernetes_service_connect_success_cpm = from(K8SService.*).filter(type == "connect").filter(connect.success == true).cpm(); +kubernetes_service_accept_cpm = from(K8SService.*).filter(type == "accept").cpm(); +kubernetes_service_accept_time = from(K8SService.accept.duration).filter(type == "accept").longAvg(); +kubernetes_service_close_cpm = from(K8SService.*).filter(type == "close").cpm(); +kubernetes_service_close_time = from(K8SService.close.duration).filter(type == "close").longAvg(); + +kubernetes_service_write_cpm = from(K8SService.*).filter(type == "write").cpm(); +kubernetes_service_write_time = from(K8SService.write.duration).filter(type == "write").longAvg(); +kubernetes_service_write_l4_time = from(K8SService.write.l4.duration).filter(type == "write").longAvg(); +kubernetes_service_write_package_cpm = from(K8SService.write.l4.transmitPackageCount).filter(type == "write").sum(); +kubernetes_service_write_retrains_package_cpm = from(K8SService.write.l4.retransmitPackageCount).filter(type == "write").sum(); +kubernetes_service_write_package_size = from(K8SService.write.l4.totalPackageSize).filter(type == "write").sum(); +kubernetes_service_write_l3_time = from(K8SService.write.l3.duration).filter(type == "write").longAvg(); +kubernetes_service_write_l3_local_time = from(K8SService.write.l3.localDuration).filter(type == "write").longAvg(); +kubernetes_service_write_l3_output_time = from(K8SService.write.l3.outputDuration).filter(type == "write").longAvg(); +kubernetes_service_write_l2_time = from(K8SService.write.l2.duration).filter(type == "write").longAvg(); +kubernetes_service_write_l2_enter_avg_queue_count = from(K8SService.write.l2.enterQueueBufferCount).filter(type == "write").longAvg(); +kubernetes_service_write_l2_ready_avg_send_duration = from(K8SService.write.l2.readySendDuration).filter(type == "write").longAvg(); +kubernetes_service_write_l2_net_device_avg_send_duration = from(K8SService.write.l2.networkDeviceSendDuration).filter(type == "write").longAvg(); + +kubernetes_service_read_cpm = from(K8SService.*).filter(type == "read").cpm(); +kubernetes_service_read_time = from(K8SService.read.duration).filter(type == "read").longAvg(); +kubernetes_service_read_l4_time = from(K8SService.read.l4.duration).filter(type == "read").longAvg(); +kubernetes_service_read_l3_time = from(K8SService.read.l3.duration).filter(type == "read").longAvg(); +kubernetes_service_read_l3_rcv_time = from(K8SService.read.l3.rcvDuration).filter(type == "read").longAvg(); +kubernetes_service_read_l3_local_time = from(K8SService.read.l3.localDuration).filter(type == "read").longAvg(); +kubernetes_service_read_package_cpm = from(K8SService.read.l2.packageCount).filter(type == "read").sum(); +kubernetes_service_read_package_size = from(K8SService.read.l2.totalPackageSize).filter(type == "read").sum(); +kubernetes_service_read_package_to_queue_time = from(K8SService.read.l2.packageToQueueDuration).filter(type == "read").longAvg(); +kubernetes_service_read_rcv_package_from_queue_time = from(K8SService.read.l2.packageToQueueDuration).filter(type == "read").longAvg(); + +kubernetes_service_resolve_mac_cpm = from(K8SService.write.l3.resolveMACCount).filter(type == "write").sum(); +kubernetes_service_resolve_mac_duration = from(K8SService.write.l3.resolveMACDuration).filter(type == "write").sum(); +kubernetes_service_write_netfilter_cpm = from(K8SService.write.l3.netFilterCount).filter(type == "write").sum(); +kubernetes_service_write_netfilter_duration = from(K8SService.write.l3.netFilterDuration).filter(type == "write").sum(); +kubernetes_service_read_netfilter_cpm = from(K8SService.read.l3.netFilterCount).filter(type == "read").sum(); +kubernetes_service_read_netfilter_duration = from(K8SService.read.l3.netFilterDuration).filter(type == "read").sum(); + +kubernetes_service_http_call_cpm = from(K8SService.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").cpm().decorator("K8SServiceDecorator"); +kubernetes_service_http_call_time = from(K8SService.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg().decorator("K8SServiceDecorator"); +kubernetes_service_http_call_successful_rate = from(K8SService.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").percent(protocol.success == true).decorator("K8SServiceDecorator"); +kubernetes_service_http_avg_req_header_size = from(K8SService.protocol.http.sizeOfRequestHeader).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_http_avg_req_body_size = from(K8SService.protocol.http.sizeOfRequestBody).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_http_avg_resp_header_size = from(K8SService.protocol.http.sizeOfResponseHeader).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_http_avg_resp_body_size = from(K8SService.protocol.http.sizeOfResponseBody).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_apdex = from(K8SService.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").apdex(name, protocol.success).decorator("K8SServiceDecorator"); +kubernetes_service_percentile = from(K8SService.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").percentile2(10); + +kubernetes_service_http_status_1xx_cpm = from(K8SService.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 100).filter(protocol.http.statusCode < 200).cpm(); +kubernetes_service_http_status_2xx_cpm = from(K8SService.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 200).filter(protocol.http.statusCode < 300).cpm(); +kubernetes_service_http_status_3xx_cpm = from(K8SService.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 300).filter(protocol.http.statusCode < 400).cpm(); +kubernetes_service_http_status_4xx_cpm = from(K8SService.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 400).filter(protocol.http.statusCode < 500).cpm(); +kubernetes_service_http_status_5xx_cpm = from(K8SService.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 500).filter(protocol.http.statusCode < 600).cpm(); + + +// Kubernetes Service Instance +kubernetes_service_instance_connect_cpm = from(K8SServiceInstance.*).filter(type == "connect").cpm(); +kubernetes_service_instance_connect_time = from(K8SServiceInstance.connect.duration).filter(type == "connect").longAvg(); +kubernetes_service_instance_connect_success_cpm = from(K8SServiceInstance.*).filter(type == "connect").filter(connect.success == true).cpm(); +kubernetes_service_instance_accept_cpm = from(K8SServiceInstance.*).filter(type == "accept").cpm(); +kubernetes_service_instance_accept_time = from(K8SServiceInstance.accept.duration).filter(type == "accept").longAvg(); +kubernetes_service_instance_close_cpm = from(K8SServiceInstance.*).filter(type == "close").cpm(); +kubernetes_service_instance_close_time = from(K8SServiceInstance.close.duration).filter(type == "close").longAvg(); + +kubernetes_service_instance_write_cpm = from(K8SServiceInstance.*).filter(type == "write").cpm(); +kubernetes_service_instance_write_time = from(K8SServiceInstance.write.duration).filter(type == "write").longAvg(); +kubernetes_service_instance_write_l4_time = from(K8SServiceInstance.write.l4.duration).filter(type == "write").longAvg(); +kubernetes_service_instance_write_package_cpm = from(K8SServiceInstance.write.l4.transmitPackageCount).filter(type == "write").sum(); +kubernetes_service_instance_write_retrains_package_cpm = from(K8SServiceInstance.write.l4.retransmitPackageCount).filter(type == "write").sum(); +kubernetes_service_instance_write_package_size = from(K8SServiceInstance.write.l4.totalPackageSize).filter(type == "write").sum(); +kubernetes_service_instance_write_l3_time = from(K8SServiceInstance.write.l3.duration).filter(type == "write").longAvg(); +kubernetes_service_instance_write_l3_local_time = from(K8SServiceInstance.write.l3.localDuration).filter(type == "write").longAvg(); +kubernetes_service_instance_write_l3_output_time = from(K8SServiceInstance.write.l3.outputDuration).filter(type == "write").longAvg(); +kubernetes_service_instance_write_l2_time = from(K8SServiceInstance.write.l2.duration).filter(type == "write").longAvg(); +kubernetes_service_instance_write_l2_avg_enter_queue_count = from(K8SServiceInstance.write.l2.enterQueueBufferCount).filter(type == "write").longAvg(); +kubernetes_service_instance_write_l2_ready_send_time = from(K8SServiceInstance.write.l2.readySendDuration).filter(type == "write").longAvg(); +kubernetes_service_instance_write_l2_net_device_send_time = from(K8SServiceInstance.write.l2.networkDeviceSendDuration).filter(type == "write").longAvg(); + +kubernetes_service_instance_read_cpm = from(K8SServiceInstance.*).filter(type == "read").cpm(); +kubernetes_service_instance_read_time = from(K8SServiceInstance.read.duration).filter(type == "read").longAvg(); +kubernetes_service_instance_read_l4_time = from(K8SServiceInstance.read.l4.duration).filter(type == "read").longAvg(); +kubernetes_service_instance_read_l3_time = from(K8SServiceInstance.read.l3.duration).filter(type == "read").longAvg(); +kubernetes_service_instance_read_l3_rcv_time = from(K8SServiceInstance.read.l3.rcvDuration).filter(type == "read").longAvg(); +kubernetes_service_instance_read_l3_local_time = from(K8SServiceInstance.read.l3.localDuration).filter(type == "read").longAvg(); +kubernetes_service_instance_read_package_cpm = from(K8SServiceInstance.read.l2.packageCount).filter(type == "read").sum(); +kubernetes_service_instance_read_package_size = from(K8SServiceInstance.read.l2.totalPackageSize).filter(type == "read").sum(); +kubernetes_service_instance_read_package_to_queue_time = from(K8SServiceInstance.read.l2.packageToQueueDuration).filter(type == "read").longAvg(); +kubernetes_service_instance_read_rcv_package_from_queue_time = from(K8SServiceInstance.read.l2.packageToQueueDuration).filter(type == "read").longAvg(); + +kubernetes_service_instance_resolve_mac_cpm = from(K8SServiceInstance.write.l3.resolveMACCount).filter(type == "write").sum(); +kubernetes_service_instance_resolve_mac_duration = from(K8SServiceInstance.write.l3.resolveMACDuration).filter(type == "write").sum(); +kubernetes_service_instance_write_netfilter_cpm = from(K8SServiceInstance.write.l3.netFilterCount).filter(type == "write").sum(); +kubernetes_service_instance_write_netfilter_duration = from(K8SServiceInstance.write.l3.netFilterDuration).filter(type == "write").sum(); +kubernetes_service_instance_read_netfilter_cpm = from(K8SServiceInstance.read.l3.netFilterCount).filter(type == "read").sum(); +kubernetes_service_instance_read_netfilter_duration = from(K8SServiceInstance.read.l3.netFilterDuration).filter(type == "read").sum(); + +kubernetes_service_instance_http_call_cpm = from(K8SServiceInstance.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").cpm(); +kubernetes_service_instance_http_call_time = from(K8SServiceInstance.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_http_call_successful_rate = from(K8SServiceInstance.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").percent(protocol.success == true); +kubernetes_service_instance_http_avg_req_header_size = from(K8SServiceInstance.protocol.http.sizeOfRequestHeader).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_http_avg_req_body_size = from(K8SServiceInstance.protocol.http.sizeOfRequestBody).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_http_avg_resp_header_size = from(K8SServiceInstance.protocol.http.sizeOfResponseHeader).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_http_avg_resp_body_size = from(K8SServiceInstance.protocol.http.sizeOfResponseBody).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_apdex = from(K8SServiceInstance.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").apdex(serviceName, protocol.success); +kubernetes_service_instance_percentile = from(K8SServiceInstance.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").percentile2(10); + +kubernetes_service_instance_http_status_1xx_cpm = from(K8SServiceInstance.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 100).filter(protocol.http.statusCode < 200).cpm(); +kubernetes_service_instance_http_status_2xx_cpm = from(K8SServiceInstance.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 200).filter(protocol.http.statusCode < 300).cpm(); +kubernetes_service_instance_http_status_3xx_cpm = from(K8SServiceInstance.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 300).filter(protocol.http.statusCode < 400).cpm(); +kubernetes_service_instance_http_status_4xx_cpm = from(K8SServiceInstance.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 400).filter(protocol.http.statusCode < 500).cpm(); +kubernetes_service_instance_http_status_5xx_cpm = from(K8SServiceInstance.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 500).filter(protocol.http.statusCode < 600).cpm(); + +// Kubernetes Service Endpoint +kubernetes_service_endpoint_call_cpm = from(K8SEndpoint.*).cpm(); +kubernetes_service_endpoint_call_successful_rate = from(K8SEndpoint.*).percent(success == true); +kubernetes_service_endpoint_call_time = from(K8SEndpoint.duration).longAvg(); + +kubernetes_service_endpoint_http_call_cpm = from(K8SEndpoint.*).filter(type == "http").cpm(); +kubernetes_service_endpoint_http_call_successful_rate = from(K8SEndpoint.*).filter(type == "http").percent(success == true); +kubernetes_service_endpoint_http_call_time = from(K8SEndpoint.http.latency).filter(type == "http").longAvg(); +kubernetes_service_endpoint_http_avg_req_header_size = from(K8SEndpoint.http.sizeOfRequestHeader).filter(type == "http").longAvg(); +kubernetes_service_endpoint_http_avg_req_body_size = from(K8SEndpoint.http.sizeOfRequestBody).filter(type == "http").longAvg(); +kubernetes_service_endpoint_http_avg_resp_header_size = from(K8SEndpoint.http.sizeOfResponseHeader).filter(type == "http").longAvg(); +kubernetes_service_endpoint_http_avg_resp_body_size = from(K8SEndpoint.http.sizeOfResponseBody).filter(type == "http").longAvg(); + +kubernetes_service_endpoint_http_status_1xx_cpm = from(K8SEndpoint.*).filter(type == "http").filter(http.statusCode >= 100).filter(http.statusCode < 200).cpm(); +kubernetes_service_endpoint_http_status_2xx_cpm = from(K8SEndpoint.*).filter(type == "http").filter(http.statusCode >= 200).filter(http.statusCode < 300).cpm(); +kubernetes_service_endpoint_http_status_3xx_cpm = from(K8SEndpoint.*).filter(type == "http").filter(http.statusCode >= 300).filter(http.statusCode < 400).cpm(); +kubernetes_service_endpoint_http_status_4xx_cpm = from(K8SEndpoint.*).filter(type == "http").filter(http.statusCode >= 400).filter(http.statusCode < 500).cpm(); +kubernetes_service_endpoint_http_status_5xx_cpm = from(K8SEndpoint.*).filter(type == "http").filter(http.statusCode >= 500).filter(http.statusCode < 600).cpm(); + +// Kubernetes Service Relation +kubernetes_service_relation_connect_cpm = from(K8SServiceRelation.*).filter(type == "connect").cpm(); +kubernetes_service_relation_connect_duration = from(K8SServiceRelation.connect.duration).filter(type == "connect").sum(); +kubernetes_service_relation_connect_success_cpm = from(K8SServiceRelation.*).filter(type == "connect").filter(connect.success == true).cpm(); +kubernetes_service_relation_accept_cpm = from(K8SServiceRelation.*).filter(type == "accept").cpm(); +kubernetes_service_relation_accept_duration = from(K8SServiceRelation.accept.duration).filter(type == "accept").sum(); +kubernetes_service_relation_close_cpm = from(K8SServiceRelation.*).filter(type == "close").cpm(); +kubernetes_service_relation_close_duration = from(K8SServiceRelation.close.duration).filter(type == "close").sum(); + +kubernetes_service_relation_server_write_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").cpm(); +kubernetes_service_relation_server_write_package_cpm = from(K8SServiceRelation.write.l4.transmitPackageCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_relation_server_write_retrains_package_cpm = from(K8SServiceRelation.write.l4.retransmitPackageCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_relation_server_write_package_size = from(K8SServiceRelation.write.l4.totalPackageSize).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_relation_server_write_package_duration = from(K8SServiceRelation.write.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_relation_server_read_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").cpm(); +kubernetes_service_relation_server_read_package_cpm = from(K8SServiceRelation.read.l2.packageCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); +kubernetes_service_relation_server_read_package_size = from(K8SServiceRelation.read.l2.totalPackageSize).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); +kubernetes_service_relation_server_read_package_duration = from(K8SServiceRelation.read.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); + +kubernetes_service_relation_client_write_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").cpm(); +kubernetes_service_relation_client_write_package_cpm = from(K8SServiceRelation.write.l4.transmitPackageCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_relation_client_write_retrains_package_cpm = from(K8SServiceRelation.write.l4.retransmitPackageCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_relation_client_write_package_size = from(K8SServiceRelation.write.l4.totalPackageSize).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_relation_client_write_package_duration = from(K8SServiceRelation.write.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_relation_client_read_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").cpm(); +kubernetes_service_relation_client_read_package_cpm = from(K8SServiceRelation.read.l2.packageCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); +kubernetes_service_relation_client_read_package_size = from(K8SServiceRelation.read.l2.totalPackageSize).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); +kubernetes_service_relation_client_read_package_duration = from(K8SServiceRelation.read.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); + +kubernetes_service_relation_server_write_l4_time = from(K8SServiceRelation.write.l4.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_relation_server_write_l3_time = from(K8SServiceRelation.write.l3.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_relation_server_write_l3_local_time = from(K8SServiceRelation.write.l3.localDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_relation_server_write_l3_output_time = from(K8SServiceRelation.write.l3.outputDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_relation_server_write_l2_time = from(K8SServiceRelation.write.l2.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_relation_server_write_l2_ready_send_time = from(K8SServiceRelation.write.l2.readySendDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_relation_server_write_l2_net_dev_send_time = from(K8SServiceRelation.write.l2.networkDeviceSendDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_relation_server_read_l4_time = from(K8SServiceRelation.read.l4.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_relation_server_read_l3_time = from(K8SServiceRelation.read.l3.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_relation_server_read_l3_rcv_time = from(K8SServiceRelation.read.l3.rcvDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_relation_server_read_l3_local_time = from(K8SServiceRelation.read.l3.localDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_relation_server_read_l2_package_to_queue_time = from(K8SServiceRelation.read.l2.packageToQueueDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_relation_server_read_l2_rcv_package_from_queue_time = from(K8SServiceRelation.read.l2.rcvPackageFromQueueDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); + +kubernetes_service_relation_client_write_l4_time = from(K8SServiceRelation.write.l4.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_relation_client_write_l3_time = from(K8SServiceRelation.write.l3.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_relation_client_write_l3_local_time = from(K8SServiceRelation.write.l3.localDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_relation_client_write_l3_output_time = from(K8SServiceRelation.write.l3.outputDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_relation_client_write_l2_time = from(K8SServiceRelation.write.l2.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_relation_client_write_l2_ready_send_time = from(K8SServiceRelation.write.l2.readySendDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_relation_client_write_l2_net_dev_send_time = from(K8SServiceRelation.write.l2.networkDeviceSendDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_relation_client_read_l4_time = from(K8SServiceRelation.read.l4.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_relation_client_read_l3_time = from(K8SServiceRelation.read.l3.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_relation_client_read_l3_rcv_time = from(K8SServiceRelation.read.l3.rcvDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_relation_client_read_l3_local_time = from(K8SServiceRelation.read.l3.localDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_relation_client_read_l2_package_to_queue_time = from(K8SServiceRelation.read.l2.packageToQueueDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_relation_client_read_l2_rcv_package_from_queue_time = from(K8SServiceRelation.read.l2.rcvPackageFromQueueDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); + +kubernetes_service_relation_server_write_resolve_mac_cpm = from(K8SServiceRelation.write.l3.resolveMACCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_relation_server_write_resolve_mac_duration = from(K8SServiceRelation.write.l3.resolveMACDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_relation_server_write_netfilter_cpm = from(K8SServiceRelation.write.l3.netFilterCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_relation_server_write_netfilter_duration = from(K8SServiceRelation.write.l3.netFilterDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_relation_server_read_netfilter_cpm = from(K8SServiceRelation.read.l3.netFilterCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); +kubernetes_service_relation_server_read_netfilter_duration = from(K8SServiceRelation.read.l3.netFilterDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); + +kubernetes_service_relation_client_write_resolve_mac_cpm = from(K8SServiceRelation.write.l3.resolveMACCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_relation_client_write_resolve_mac_duration = from(K8SServiceRelation.write.l3.resolveMACDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_relation_client_write_netfilter_cpm = from(K8SServiceRelation.write.l3.netFilterCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_relation_client_write_netfilter_duration = from(K8SServiceRelation.write.l3.netFilterDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_relation_client_read_netfilter_cpm = from(K8SServiceRelation.read.l3.netFilterCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); +kubernetes_service_relation_client_read_netfilter_duration = from(K8SServiceRelation.read.l3.netFilterDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); + +kubernetes_service_relation_server_http_call_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").cpm(); +kubernetes_service_relation_server_http_success_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.success == true).cpm(); +kubernetes_service_relation_server_http_call_time = from(K8SServiceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_server_http_avg_req_header_size = from(K8SServiceRelation.protocol.http.sizeOfRequestHeader).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_server_http_avg_req_body_size = from(K8SServiceRelation.protocol.http.sizeOfRequestBody).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_server_http_avg_resp_header_size = from(K8SServiceRelation.protocol.http.sizeOfResponseHeader).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_server_http_avg_resp_body_size = from(K8SServiceRelation.protocol.http.sizeOfResponseBody).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_server_apdex = from(K8SServiceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").apdex(destServiceName, protocol.success); +kubernetes_service_relation_server_percentile = from(K8SServiceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").percentile2(10); + +kubernetes_service_relation_client_http_call_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").cpm(); +kubernetes_service_relation_client_http_success_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.success == true).cpm(); +kubernetes_service_relation_client_http_call_duration = from(K8SServiceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").sum(); +kubernetes_service_relation_client_http_call_time = from(K8SServiceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_client_http_avg_req_header_size = from(K8SServiceRelation.protocol.http.sizeOfRequestHeader).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_client_http_avg_req_body_size = from(K8SServiceRelation.protocol.http.sizeOfRequestBody).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_client_http_avg_resp_header_size = from(K8SServiceRelation.protocol.http.sizeOfResponseHeader).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_client_http_avg_resp_body_size = from(K8SServiceRelation.protocol.http.sizeOfResponseBody).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_relation_client_apdex = from(K8SServiceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").apdex(sourceServiceName, protocol.success); +kubernetes_service_relation_client_percentile = from(K8SServiceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").percentile2(10); + +kubernetes_service_relation_server_http_status_1xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 100).filter(protocol.http.statusCode < 200).cpm(); +kubernetes_service_relation_server_http_status_2xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 200).filter(protocol.http.statusCode < 300).cpm(); +kubernetes_service_relation_server_http_status_3xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 300).filter(protocol.http.statusCode < 400).cpm(); +kubernetes_service_relation_server_http_status_4xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 400).filter(protocol.http.statusCode < 500).cpm(); +kubernetes_service_relation_server_http_status_5xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 500).filter(protocol.http.statusCode < 600).cpm(); + +kubernetes_service_relation_client_http_status_1xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 100).filter(protocol.http.statusCode < 200).cpm(); +kubernetes_service_relation_client_http_status_2xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 200).filter(protocol.http.statusCode < 300).cpm(); +kubernetes_service_relation_client_http_status_3xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 300).filter(protocol.http.statusCode < 400).cpm(); +kubernetes_service_relation_client_http_status_4xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 400).filter(protocol.http.statusCode < 500).cpm(); +kubernetes_service_relation_client_http_status_5xx_cpm = from(K8SServiceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 500).filter(protocol.http.statusCode < 600).cpm(); + +// Kubernetes Service Instance Relation +kubernetes_service_instance_relation_connect_cpm = from(K8SServiceInstanceRelation.*).filter(type == "connect").cpm(); +kubernetes_service_instance_relation_connect_duration = from(K8SServiceInstanceRelation.connect.duration).filter(type == "connect").sum(); +kubernetes_service_instance_relation_connect_success_cpm = from(K8SServiceInstanceRelation.*).filter(type == "connect").filter(connect.success == true).cpm(); +kubernetes_service_instance_relation_accept_cpm = from(K8SServiceInstanceRelation.*).filter(type == "accept").cpm(); +kubernetes_service_instance_relation_accept_duration = from(K8SServiceInstanceRelation.accept.duration).filter(type == "accept").sum(); +kubernetes_service_instance_relation_close_cpm = from(K8SServiceInstanceRelation.*).filter(type == "close").cpm(); +kubernetes_service_instance_relation_close_duration = from(K8SServiceInstanceRelation.close.duration).filter(type == "close").sum(); + +kubernetes_service_instance_relation_server_write_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").cpm(); +kubernetes_service_instance_relation_server_write_package_cpm = from(K8SServiceInstanceRelation.write.l4.transmitPackageCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_instance_relation_server_write_retrains_package_cpm = from(K8SServiceInstanceRelation.write.l4.retransmitPackageCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_instance_relation_server_write_package_size = from(K8SServiceInstanceRelation.write.l4.totalPackageSize).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_instance_relation_server_write_package_duration = from(K8SServiceInstanceRelation.write.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_instance_relation_server_read_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").cpm(); +kubernetes_service_instance_relation_server_read_package_cpm = from(K8SServiceInstanceRelation.read.l2.packageCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); +kubernetes_service_instance_relation_server_read_package_size = from(K8SServiceInstanceRelation.read.l2.totalPackageSize).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); +kubernetes_service_instance_relation_server_read_package_duration = from(K8SServiceInstanceRelation.read.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); + +kubernetes_service_instance_relation_client_write_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").cpm(); +kubernetes_service_instance_relation_client_write_package_cpm = from(K8SServiceInstanceRelation.write.l4.transmitPackageCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_instance_relation_client_write_retrains_package_cpm = from(K8SServiceInstanceRelation.write.l4.retransmitPackageCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_instance_relation_client_write_package_size = from(K8SServiceInstanceRelation.write.l4.totalPackageSize).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_instance_relation_client_write_package_duration = from(K8SServiceInstanceRelation.write.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_instance_relation_client_read_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").cpm(); +kubernetes_service_instance_relation_client_read_package_cpm = from(K8SServiceInstanceRelation.read.l2.packageCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); +kubernetes_service_instance_relation_client_read_package_size = from(K8SServiceInstanceRelation.read.l2.totalPackageSize).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); +kubernetes_service_instance_relation_client_read_package_duration = from(K8SServiceInstanceRelation.read.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); + +kubernetes_service_instance_relation_server_write_l4_time = from(K8SServiceInstanceRelation.write.l4.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_server_write_l3_time = from(K8SServiceInstanceRelation.write.l3.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_server_write_l3_local_time = from(K8SServiceInstanceRelation.write.l3.localDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_server_write_l3_output_time = from(K8SServiceInstanceRelation.write.l3.outputDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_server_write_l2_time = from(K8SServiceInstanceRelation.write.l2.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_server_write_l2_ready_send_time = from(K8SServiceInstanceRelation.write.l2.readySendDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_server_write_l2_net_dev_send_time = from(K8SServiceInstanceRelation.write.l2.networkDeviceSendDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_server_read_l4_time = from(K8SServiceInstanceRelation.read.l4.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_server_read_l3_time = from(K8SServiceInstanceRelation.read.l3.duration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_server_read_l3_rcv_time = from(K8SServiceInstanceRelation.read.l3.rcvDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_server_read_l3_local_time = from(K8SServiceInstanceRelation.read.l3.localDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_server_read_l2_package_to_queue_time = from(K8SServiceInstanceRelation.read.l2.packageToQueueDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_server_read_l2_rcv_package_from_queue_time = from(K8SServiceInstanceRelation.read.l2.rcvPackageFromQueueDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").longAvg(); + +kubernetes_service_instance_relation_client_write_l4_time = from(K8SServiceInstanceRelation.write.l4.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_client_write_l3_time = from(K8SServiceInstanceRelation.write.l3.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_client_write_l3_local_time = from(K8SServiceInstanceRelation.write.l3.localDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_client_write_l3_output_time = from(K8SServiceInstanceRelation.write.l3.outputDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_client_write_l2_time = from(K8SServiceInstanceRelation.write.l2.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_client_write_l2_ready_send_time = from(K8SServiceInstanceRelation.write.l2.readySendDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_client_write_l2_net_dev_send_time = from(K8SServiceInstanceRelation.write.l2.networkDeviceSendDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").longAvg(); +kubernetes_service_instance_relation_client_read_l4_time = from(K8SServiceInstanceRelation.read.l4.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_client_read_l3_time = from(K8SServiceInstanceRelation.read.l3.duration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_client_read_l3_rcv_time = from(K8SServiceInstanceRelation.read.l3.rcvDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_client_read_l3_local_time = from(K8SServiceInstanceRelation.read.l3.localDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_client_read_l2_package_to_queue_time = from(K8SServiceInstanceRelation.read.l2.packageToQueueDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); +kubernetes_service_instance_relation_client_read_l2_rcv_package_from_queue_time = from(K8SServiceInstanceRelation.read.l2.rcvPackageFromQueueDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").longAvg(); + +kubernetes_service_instance_relation_server_write_resolve_mac_cpm = from(K8SServiceInstanceRelation.write.l3.resolveMACCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_instance_relation_server_write_resolve_mac_duration = from(K8SServiceInstanceRelation.write.l3.resolveMACDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_instance_relation_server_write_netfilter_cpm = from(K8SServiceInstanceRelation.write.l3.netFilterCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_instance_relation_server_write_netfilter_duration = from(K8SServiceInstanceRelation.write.l3.netFilterDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "write").sum(); +kubernetes_service_instance_relation_server_read_netfilter_cpm = from(K8SServiceInstanceRelation.read.l3.netFilterCount).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); +kubernetes_service_instance_relation_server_read_netfilter_duration = from(K8SServiceInstanceRelation.read.l3.netFilterDuration).filter(detectPoint == DetectPoint.SERVER).filter(type == "read").sum(); + +kubernetes_service_instance_relation_client_write_resolve_mac_cpm = from(K8SServiceInstanceRelation.write.l3.resolveMACCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_instance_relation_client_write_resolve_mac_duration = from(K8SServiceInstanceRelation.write.l3.resolveMACDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_instance_relation_client_write_netfilter_cpm = from(K8SServiceInstanceRelation.write.l3.netFilterCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_instance_relation_client_write_netfilter_duration = from(K8SServiceInstanceRelation.write.l3.netFilterDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "write").sum(); +kubernetes_service_instance_relation_client_read_netfilter_cpm = from(K8SServiceInstanceRelation.read.l3.netFilterCount).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); +kubernetes_service_instance_relation_client_read_netfilter_duration = from(K8SServiceInstanceRelation.read.l3.netFilterDuration).filter(detectPoint == DetectPoint.CLIENT).filter(type == "read").sum(); + +kubernetes_service_instance_relation_server_http_call_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").cpm(); +kubernetes_service_instance_relation_server_http_call_time = from(K8SServiceInstanceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_relation_server_http_avg_req_header_size = from(K8SServiceInstanceRelation.protocol.http.sizeOfRequestHeader).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_relation_server_http_avg_req_body_size = from(K8SServiceInstanceRelation.protocol.http.sizeOfRequestBody).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_relation_server_http_avg_resp_header_size = from(K8SServiceInstanceRelation.protocol.http.sizeOfResponseHeader).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_relation_server_http_avg_resp_body_size = from(K8SServiceInstanceRelation.protocol.http.sizeOfResponseBody).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_relation_server_apdex = from(K8SServiceInstanceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").apdex(destServiceName, protocol.success); +kubernetes_service_instance_relation_server_percentile = from(K8SServiceInstanceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").percentile2(10); + +kubernetes_service_instance_relation_client_http_call_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").cpm(); +kubernetes_service_instance_relation_client_http_call_time = from(K8SServiceInstanceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").longAvg(); +kubernetes_service_instance_relation_client_http_avg_req_header_size = from(K8SServiceInstanceRelation.protocol.http.sizeOfRequestHeader).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").sum(); +kubernetes_service_instance_relation_client_http_avg_req_body_size = from(K8SServiceInstanceRelation.protocol.http.sizeOfRequestBody).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").sum(); +kubernetes_service_instance_relation_client_http_avg_resp_header_size = from(K8SServiceInstanceRelation.protocol.http.sizeOfResponseHeader).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").sum(); +kubernetes_service_instance_relation_client_http_avg_resp_body_size = from(K8SServiceInstanceRelation.protocol.http.sizeOfResponseBody).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").sum(); +kubernetes_service_instance_relation_client_apdex = from(K8SServiceInstanceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").apdex(sourceServiceName, protocol.success); +kubernetes_service_instance_relation_client_percentile = from(K8SServiceInstanceRelation.protocol.http.latency).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").percentile2(10); + +kubernetes_service_instance_relation_server_http_status_1xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 100).filter(protocol.http.statusCode < 200).cpm(); +kubernetes_service_instance_relation_server_http_status_2xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 200).filter(protocol.http.statusCode < 300).cpm(); +kubernetes_service_instance_relation_server_http_status_3xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 300).filter(protocol.http.statusCode < 400).cpm(); +kubernetes_service_instance_relation_server_http_status_4xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 400).filter(protocol.http.statusCode < 500).cpm(); +kubernetes_service_instance_relation_server_http_status_5xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.SERVER).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 500).filter(protocol.http.statusCode < 600).cpm(); + +kubernetes_service_instance_relation_client_http_status_1xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 100).filter(protocol.http.statusCode < 200).cpm(); +kubernetes_service_instance_relation_client_http_status_2xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 200).filter(protocol.http.statusCode < 300).cpm(); +kubernetes_service_instance_relation_client_http_status_3xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 300).filter(protocol.http.statusCode < 400).cpm(); +kubernetes_service_instance_relation_client_http_status_4xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 400).filter(protocol.http.statusCode < 500).cpm(); +kubernetes_service_instance_relation_client_http_status_5xx_cpm = from(K8SServiceInstanceRelation.*).filter(detectPoint == DetectPoint.CLIENT).filter(type == "protocol").filter(protocol.type == "http").filter(protocol.http.statusCode >= 500).filter(protocol.http.statusCode < 600).cpm(); diff --git a/oap-server/oal-rt/src/test/resources/oal/java-agent.oal b/oap-server/oal-rt/src/test/resources/oal/java-agent.oal new file mode 100644 index 0000000000..497f6c41bb --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/java-agent.oal @@ -0,0 +1,51 @@ +/* + * 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. + * + */ + +// 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_memory_pool_code_cache = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.CODE_CACHE_USAGE).longAvg(); +instance_jvm_memory_pool_newgen = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.NEWGEN_USAGE).longAvg(); +instance_jvm_memory_pool_oldgen = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.OLDGEN_USAGE).longAvg(); +instance_jvm_memory_pool_survivor = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.SURVIVOR_USAGE).longAvg(); +instance_jvm_memory_pool_permgen = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.PERMGEN_USAGE).longAvg(); +instance_jvm_memory_pool_metaspace = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.METASPACE_USAGE).longAvg(); +instance_jvm_memory_pool_zheap = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.ZHEAP_USAGE).longAvg(); +instance_jvm_memory_pool_compressed_class_space = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.COMPRESSED_CLASS_SPACE_USAGE).longAvg(); +instance_jvm_memory_pool_codeheap_non_nmethods = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.CODEHEAP_NON_NMETHODS_USAGE).longAvg(); +instance_jvm_memory_pool_codeheap_profiled_nmethods = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.CODEHEAP_PROFILED_NMETHODS_USAGE).longAvg(); +instance_jvm_memory_pool_codeheap_non_profiled_nmethods = from(ServiceInstanceJVMMemoryPool.used).filter(poolType == MemoryPoolType.CODEHEAP_NON_PROFILED_NMETHODS_USAGE).longAvg(); +instance_jvm_young_gc_time = from(ServiceInstanceJVMGC.time).filter(phase == GCPhase.NEW).sum(); +instance_jvm_old_gc_time = from(ServiceInstanceJVMGC.time).filter(phase == GCPhase.OLD).sum(); +instance_jvm_normal_gc_time = from(ServiceInstanceJVMGC.time).filter(phase == GCPhase.NORMAL).sum(); +instance_jvm_young_gc_count = from(ServiceInstanceJVMGC.count).filter(phase == GCPhase.NEW).sum(); +instance_jvm_old_gc_count = from(ServiceInstanceJVMGC.count).filter(phase == GCPhase.OLD).sum(); +instance_jvm_normal_gc_count = from(ServiceInstanceJVMGC.count).filter(phase == GCPhase.NORMAL).sum(); +instance_jvm_thread_live_count = from(ServiceInstanceJVMThread.liveCount).longAvg(); +instance_jvm_thread_daemon_count = from(ServiceInstanceJVMThread.daemonCount).longAvg(); +instance_jvm_thread_peak_count = from(ServiceInstanceJVMThread.peakCount).longAvg(); +instance_jvm_thread_runnable_state_thread_count = from(ServiceInstanceJVMThread.runnableStateThreadCount).longAvg(); +instance_jvm_thread_blocked_state_thread_count = from(ServiceInstanceJVMThread.blockedStateThreadCount).longAvg(); +instance_jvm_thread_waiting_state_thread_count = from(ServiceInstanceJVMThread.waitingStateThreadCount).longAvg(); +instance_jvm_thread_timed_waiting_state_thread_count = from(ServiceInstanceJVMThread.timedWaitingStateThreadCount).longAvg(); +instance_jvm_class_loaded_class_count = from(ServiceInstanceJVMClass.loadedClassCount).longAvg(); +instance_jvm_class_total_unloaded_class_count = from(ServiceInstanceJVMClass.totalUnloadedClassCount).longAvg(); +instance_jvm_class_total_loaded_class_count = from(ServiceInstanceJVMClass.totalLoadedClassCount).longAvg(); \ No newline at end of file diff --git a/oap-server/oal-rt/src/test/resources/oal/mesh.oal b/oap-server/oal-rt/src/test/resources/oal/mesh.oal new file mode 100755 index 0000000000..d4bd9bac29 --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/mesh.oal @@ -0,0 +1,36 @@ +/* + * 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. + * + */ + +service_sidecar_internal_req_latency_nanos = from(Service.sideCar.internalRequestLatencyNanos).longAvg(); +service_sidecar_internal_resp_latency_nanos = from(Service.sideCar.internalResponseLatencyNanos).longAvg(); + +service_instance_sidecar_internal_req_latency_nanos = from(ServiceInstance.sideCar.internalRequestLatencyNanos).longAvg(); +service_instance_sidecar_internal_resp_latency_nanos = from(ServiceInstance.sideCar.internalResponseLatencyNanos).longAvg(); + +endpoint_sidecar_internal_req_latency_nanos = from(Endpoint.sideCar.internalRequestLatencyNanos).longAvg(); +endpoint_sidecar_internal_resp_latency_nanos = from(Endpoint.sideCar.internalResponseLatencyNanos).longAvg(); + +service_client_sidecar_internal_req_latency_nanos = from(ServiceRelation.sideCar.internalRequestLatencyNanos).filter(detectPoint == DetectPoint.CLIENT).longAvg(); +service_server_sidecar_internal_req_latency_nanos = from(ServiceRelation.sideCar.internalRequestLatencyNanos).filter(detectPoint == DetectPoint.SERVER).longAvg(); +service_client_sidecar_internal_resp_latency_nanos = from(ServiceRelation.sideCar.internalResponseLatencyNanos).filter(detectPoint == DetectPoint.CLIENT).longAvg(); +service_server_sidecar_internal_resp_latency_nanos = from(ServiceRelation.sideCar.internalResponseLatencyNanos).filter(detectPoint == DetectPoint.SERVER).longAvg(); + +instance_client_sidecar_internal_req_latency_nanos = from(ServiceInstanceRelation.sideCar.internalRequestLatencyNanos).filter(detectPoint == DetectPoint.CLIENT).longAvg(); +instance_server_sidecar_internal_req_latency_nanos = from(ServiceInstanceRelation.sideCar.internalRequestLatencyNanos).filter(detectPoint == DetectPoint.SERVER).longAvg(); +instance_client_sidecar_internal_resp_latency_nanos = from(ServiceInstanceRelation.sideCar.internalResponseLatencyNanos).filter(detectPoint == DetectPoint.CLIENT).longAvg(); +instance_server_sidecar_internal_resp_latency_nanos = from(ServiceInstanceRelation.sideCar.internalResponseLatencyNanos).filter(detectPoint == DetectPoint.SERVER).longAvg(); diff --git a/oap-server/oal-rt/src/test/resources/oal/tcp.oal b/oap-server/oal-rt/src/test/resources/oal/tcp.oal new file mode 100644 index 0000000000..7934c56c3d --- /dev/null +++ b/oap-server/oal-rt/src/test/resources/oal/tcp.oal @@ -0,0 +1,32 @@ +/* + * 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. + * + */ + +// TCP services' metrics +service_throughput_received = from(TCPService.receivedBytes).longAvg(); +service_throughput_sent = from(TCPService.sentBytes).longAvg(); +service_relation_client_received = from(TCPServiceRelation.receivedBytes).filter(detectPoint == DetectPoint.CLIENT).longAvg(); +service_relation_client_sent = from(TCPServiceRelation.sentBytes).filter(detectPoint == DetectPoint.CLIENT).longAvg(); +service_relation_server_received = from(TCPServiceRelation.receivedBytes).filter(detectPoint == DetectPoint.SERVER).longAvg(); +service_relation_server_sent = from(TCPServiceRelation.sentBytes).filter(detectPoint == DetectPoint.SERVER).longAvg(); + +service_instance_throughput_received = from(TCPServiceInstance.receivedBytes).longAvg(); +service_instance_throughput_sent = from(TCPServiceInstance.sentBytes).longAvg(); +service_instance_relation_client_received = from(TCPServiceInstanceRelation.receivedBytes).filter(detectPoint == DetectPoint.CLIENT).longAvg(); +service_instance_relation_client_sent = from(TCPServiceInstanceRelation.sentBytes).filter(detectPoint == DetectPoint.CLIENT).longAvg(); +service_instance_relation_server_received = from(TCPServiceInstanceRelation.receivedBytes).filter(detectPoint == DetectPoint.SERVER).longAvg(); +service_instance_relation_server_sent = from(TCPServiceInstanceRelation.sentBytes).filter(detectPoint == DetectPoint.SERVER).longAvg();
