diff --git a/apm-dist-es7/src/main/assembly/binary-es7.xml b/apm-dist-es7/src/main/assembly/binary-es7.xml index abb059f51..9c2a74c6c 100644 --- a/apm-dist-es7/src/main/assembly/binary-es7.xml +++ b/apm-dist-es7/src/main/assembly/binary-es7.xml @@ -51,14 +51,11 @@ gateways.yml service-apdex-threshold.yml endpoint-name-grouping.yml - ui-initialized-templates.yml - oal/browser.oal - oal/core.oal - oal/java-agent.oal - oal/dotnet-agent.oal - oal/envoy.oal - fetcher-prom-rules/self.yaml - meter-receive-config/spring-sleuth.yaml + oal/*.oal + fetcher-prom-rules/*.yaml + meter-receive-config/*.yaml + oc-rules/* + ui-initialized-templates/* /config diff --git a/apm-dist/src/main/assembly/binary.xml b/apm-dist/src/main/assembly/binary.xml index dbc0ab4b9..b61d99f1a 100644 --- a/apm-dist/src/main/assembly/binary.xml +++ b/apm-dist/src/main/assembly/binary.xml @@ -50,15 +50,12 @@ component-libraries.yml gateways.yml service-apdex-threshold.yml - ui-initialized-templates.yml endpoint-name-grouping.yml - oal/browser.oal - oal/core.oal - oal/java-agent.oal - oal/dotnet-agent.oal - oal/envoy.oal - fetcher-prom-rules/self.yaml - meter-receive-config/spring-sleuth.yaml + oal/*.oal + fetcher-prom-rules/*.yaml + meter-receive-config/*.yaml + oc-rules/* + ui-initialized-templates/* /config diff --git a/docs/en/ui/README.md b/docs/en/ui/README.md index 2693f7e87..1096b116a 100644 --- a/docs/en/ui/README.md +++ b/docs/en/ui/README.md @@ -33,6 +33,57 @@ Two default dashboards are provided to visualize the metrics of service and data User could click the `lock` button left aside the `Service/Instance/Endpoint Reload` button to custom your own dashboard. +### Custom Dashboard +Users could customize the dashboard. The default dashboards are provided through the default templates located in +`/ui-initialized-templates` folders. + +The template file follows this format. +```yaml +templates: + - name: template name # The unique name + # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. + # DASHBOARD type templates could have multiple definitions, by using different names. + # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, + # as they are used in the topology page only. + type: "DASHBOARD" + # Custom the dashboard or create a new one on the UI, set the metrics as you like in the edit mode. + # Then, you could export this configuration through the page and add it here. + configuration: |- + [ + { + "name":"Spring Sleuth", + "type":"service", + "children":[ + { + "name":"Sleuth", + "children": [{ + "width": "3", + "title": "HTTP Request", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_http_server_requests_count", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "Count" + } + ... + ] + } + ] + } + ] + # Activated means this templates added into the UI page automatically. + # False means providing a basic template, user needs to add it manually on the page. + activated: false + # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. + disabled: false +``` + +**NOTE**, UI initialized templates would only be initialized if there is no template in the storage has the same name. +Check the entity named as `ui_template` in your storage. + ## Topology Topology map shows the relationship among the services and instances with metrics. diff --git a/oap-server/server-bootstrap/pom.xml b/oap-server/server-bootstrap/pom.xml index 47f233c49..2b60d331f 100644 --- a/oap-server/server-bootstrap/pom.xml +++ b/oap-server/server-bootstrap/pom.xml @@ -257,14 +257,11 @@ gateways.yml service-apdex-threshold.yml endpoint-name-grouping.yml - ui-initialized-templates.yml - oal/browser.oal - oal/core.oal - oal/java-agent.oal - oal/dotnet-agent.oal - oal/envoy.oal + oal/ fetcher-prom-rules/ meter-receive-config/ + oc-rules/ + ui-initialized-templates/ diff --git a/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates.yml b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates.yml deleted file mode 100644 index a4c7f832e..000000000 --- a/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates.yml +++ /dev/null @@ -1,1247 +0,0 @@ -# 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. - -# UI templates initialized file includes the default template when the SkyWalking OAP starts up at the first time. -# -# Also, SkyWalking would detect the existing templates in the database, once they are missing, all templates in this file -# could be added automatically. - -templates: - - name: "APM" - # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. - # DASHBOARD type templates could have multiple definitions, by using different names. - # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. - type: "DASHBOARD" - # Configuration could be defined through UI, and use `export` to format in the standard JSON. - configuration: |- - [ - { - "name": "APM", - "type": "service", - "children": [ - { - "name": "Global", - "children": [ - { - "width": 3, - "title": "Services Load", - "height": "300", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_cpm", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": false, - "unit": "CPM - calls per minute" - }, - { - "width": 3, - "title": "Slow Services", - "height": "300", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_resp_time", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": false, - "unit": "ms" - }, - { - "width": 3, - "title": "Un-Health Services (Apdex)", - "height": "300", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_apdex", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": false, - "aggregation": "/", - "aggregationNum": "10000", - "sortOrder": "ASC" - }, - { - "width": 3, - "title": "Slow Endpoints", - "height": "300", - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_avg", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": false, - "unit": "ms" - }, - { - "width": "6", - "title": "Global Response Latency", - "height": "280", - "entityType": "All", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "metricName": "all_percentile", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "metricLabels": "P50, P75, P90, P95, P99", - "labelsIndex": "0, 1, 2, 3, 4", - "unit": "percentile in ms" - }, - { - "width": "6", - "title": "Global Heatmap", - "height": "280", - "entityType": "All", - "independentSelector": false, - "metricType": "HEATMAP", - "unit": "ms", - "queryMetricType": "readHeatMap", - "chartType": "ChartHeatmap", - "metricName": "all_heatmap" - } - ] - }, - { - "name": "Service", - "children": [ - { - "width": 3, - "title": "Service Apdex", - "height": "200", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_apdex", - "queryMetricType": "readMetricsValue", - "chartType": "ChartNum", - "aggregation": "/", - "aggregationNum": "10000" - }, - { - "width": 3, - "title": "Service Avg Response Time", - "height": "200", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_resp_time", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, - { - "width": 3, - "title": "Successful Rate", - "height": "200", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_sla", - "queryMetricType": "readMetricsValue", - "chartType": "ChartNum", - "unit": "%", - "aggregation": "/", - "aggregationNum": "100" - }, - { - "width": 3, - "title": "Service Load", - "height": "200", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_cpm", - "queryMetricType": "readMetricsValue", - "chartType": "ChartNum", - "unit": "CPM - calls per minute" - }, - { - "width": 3, - "title": "Service Apdex", - "height": "200", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_apdex", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "aggregation": "/", - "aggregationNum": "10000" - }, - { - "width": 3, - "title": "Service Response Time Percentile", - "height": "200", - "entityType": "Service", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "metricName": "service_percentile", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "unit": "ms", - "metricLabels": "P50, P75, P90, P95, P99", - "labelsIndex": "0, 1, 2, 3, 4" - }, - { - "width": 3, - "title": "Successful Rate", - "height": "200", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_sla", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%", - "aggregation": "/", - "aggregationNum": "100" - }, - { - "width": 3, - "title": "Service Load", - "height": "200", - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_cpm", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "CPM - calls per minute" - }, - { - "width": "4", - "title": "Service Instances Load", - "height": "280", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_cpm", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": true, - "unit": "CPM - calls per minute" - }, - { - "width": "4", - "title": "Slow Service Instance", - "height": "280", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_resp_time", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": true, - "unit": "ms" - }, - { - "width": "4", - "title": "Service Instance Successful Rate", - "height": "280", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_sla", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": true, - "unit": "%", - "aggregation": "/", - "aggregationNum": "100", - "sortOrder": "ASC" - } - ] - }, - { - "name": "Instance", - "children": [ - { - "width": "4", - "title": "Service Instance Load", - "height": "150", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_cpm", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "CPM - calls per minute" - }, - { - "width": "4", - "title": "Service Instance Successful Rate", - "height": "150", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_sla", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%", - "aggregation": "/", - "aggregationNum": "100" - }, - { - "width": "4", - "title": "Service Instance Latency", - "height": "150", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_resp_time", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, - { - "width": 3, - "title": "JVM CPU (Java Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_jvm_cpu", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%", - "aggregation": "+", - "aggregationNum": "" - }, - { - "width": 3, - "title": "JVM Memory (Java Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_jvm_memory_heap, instance_jvm_memory_heap_max,instance_jvm_memory_noheap, instance_jvm_memory_noheap_max", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "MB", - "aggregation": "/", - "aggregationNum": "1048576" - }, - { - "width": 3, - "title": "JVM GC Time", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_jvm_young_gc_time, instance_jvm_old_gc_time", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, - { - "width": 3, - "title": "JVM GC Count", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar", - "metricName": "instance_jvm_young_gc_count, instance_jvm_old_gc_count" - }, - { - "width": 3, - "title": "JVM Thread Count (Java Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "metricName": "instance_jvm_thread_live_count, instance_jvm_thread_daemon_count, instance_jvm_thread_peak_count" - }, - { - "width": 3, - "title": "CLR CPU (.NET Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_clr_cpu", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%" - }, - { - "width": 3, - "title": "CLR GC (.NET Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_clr_gen0_collect_count, instance_clr_gen1_collect_count, instance_clr_gen2_collect_count", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar" - }, - { - "width": 3, - "title": "CLR Heap Memory (.NET Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_clr_heap_memory", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "MB", - "aggregation": "/", - "aggregationNum": "1048576" - }, - { - "width": 3, - "title": "CLR Thread (.NET Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "metricName": "instance_clr_available_completion_port_threads,instance_clr_available_worker_threads,instance_clr_max_completion_port_threads,instance_clr_max_worker_threads" - } - ] - }, - { - "name": "Endpoint", - "children": [ - { - "width": "4", - "title": "Endpoint Load in Current Service", - "height": "280", - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_cpm", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": true, - "unit": "CPM - calls per minute" - }, - { - "width": "4", - "title": "Slow Endpoints in Current Service", - "height": "280", - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "metricName": "endpoint_avg", - "unit": "ms", - "parentService": true - }, - { - "width": "4", - "title": "Successful Rate in Current Service", - "height": "280", - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_sla", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "aggregation": "/", - "aggregationNum": "100", - "parentService": true, - "unit": "%", - "sortOrder": "ASC" - }, - { - "width": 3, - "title": "Endpoint Load", - "height": 350, - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_cpm", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine" - }, - { - "width": 3, - "title": "Endpoint Avg Response Time", - "height": 350, - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_avg", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, - { - "width": 3, - "title": "Endpoint Response Time Percentile", - "height": 350, - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "metricName": "endpoint_percentile", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "metricLabels": "P50, P75, P90, P95, P99", - "labelsIndex": "0, 1, 2, 3, 4", - "unit": "ms" - }, - { - "width": 3, - "title": "Endpoint Successful Rate", - "height": 350, - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_sla", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%", - "aggregation": "/", - "aggregationNum": "100" - } - ] - } - ] - } - ] - # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. - # False means providing a basic template, user needs to add it manually. - activated: true - # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. - disabled: false - - - name: "Database" - # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. - # DASHBOARD type templates could have multiple definitions, by using different names. - # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. - type: "DASHBOARD" - # Configuration could be defined through UI, and use `export` to format in the standard JSON. - configuration: |- - [ - { - "name": "Database", - "type": "database", - "children": [ - { - "name": "Database", - "children": [ - { - "width": 3, - "title": "Database Avg Response Time", - "height": 350, - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "database_access_resp_time", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, - { - "width": 3, - "title": "Database Access Successful Rate", - "height": 350, - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "database_access_sla", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%", - "aggregation": "/", - "aggregationNum": "100" - }, - { - "width": 3, - "title": "Database Traffic", - "height": 350, - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "database_access_cpm", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "CPM - calls per minute" - }, - { - "width": 3, - "title": "Database Access Latency Percentile", - "height": 350, - "entityType": "Service", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "metricName": "database_access_percentile", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "metricLabels": "P50, P75, P90, P95, P99", - "labelsIndex": "0, 1, 2, 3, 4", - "unit": "ms" - }, - { - "width": "6", - "title": "Slow Statements", - "height": 350, - "entityType": "Service", - "independentSelector": false, - "metricType": "SAMPLED_RECORD", - "metricName": "top_n_database_statement", - "queryMetricType": "readSampledRecords", - "chartType": "ChartSlow", - "parentService": true, - "sortOrder": "DES", - "unit": "ms" - }, - { - "width": 3, - "title": "All Database Loads", - "height": 350, - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "database_access_cpm", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": false, - "sortOrder": "DES", - "unit": "CPM - calls per minute" - }, - { - "width": 3, - "title": "Un-Health Databases (Successful Rate)", - "height": 350, - "entityType": "Service", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "database_access_sla", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": false, - "sortOrder": "ASC", - "unit": "%", - "aggregation": "/", - "aggregationNum": "100" - } - ] - } - ] - } - ] - # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. - # False means providing a basic template, user needs to add it manually. - activated: true - # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. - disabled: false - - - name: "Topology Instance" - # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. - # DASHBOARD type templates could have multiple definitions, by using different names. - # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. - type: "TOPOLOGY_INSTANCE" - # Configuration could be defined through UI, and use `export` to format in the standard JSON. - configuration: |- - [ - { - "width": "4", - "title": "Service Instance Load", - "height": "150", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_cpm", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "CPM - calls per minute" - }, - { - "width": "4", - "title": "Service Instance Successful Rate", - "height": "150", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_resp_time", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%", - "aggregation": "/", - "aggregationNum": "100" - }, - { - "width": "4", - "title": "Service Instance Latency", - "height": "150", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "service_instance_resp_time", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, - { - "width": 3, - "title": "JVM CPU (Java Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_jvm_cpu", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%", - "aggregation": "+", - "aggregationNum": "" - }, - { - "width": 3, - "title": "JVM Memory (Java Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_jvm_memory_heap, instance_jvm_memory_heap_max,instance_jvm_memory_noheap, instance_jvm_memory_noheap_max", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "MB", - "aggregation": "/", - "aggregationNum": "1048576" - }, - { - "width": 3, - "title": "JVM GC Time", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_jvm_young_gc_time, instance_jvm_old_gc_time", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, - { - "width": 3, - "title": "JVM GC Count", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar", - "metricName": "instance_jvm_young_gc_count, instance_jvm_old_gc_count" - }, - { - "width": 3, - "title": "CLR CPU (.NET Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_clr_cpu", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%" - }, - { - "width": 3, - "title": "CLR GC (.NET Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_clr_gen0_collect_count, instance_clr_gen1_collect_count, instance_clr_gen2_collect_count", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar" - }, - { - "width": 3, - "title": "CLR Heap Memory (.NET Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "instance_clr_heap_memory", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "MB" - }, - { - "width": 3, - "title": "CLR Thread (.NET Service)", - "height": "250", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "metricName": "instance_clr_available_completion_port_threads,instance_clr_available_worker_threads,instance_clr_max_completion_port_threads,instance_clr_max_worker_threads" - } - ] - # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. - # False means providing a basic template, user needs to add it manually. - activated: true - # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. - disabled: false - - - name: "Topology Endpoint" - # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. - # DASHBOARD type templates could have multiple definitions, by using different names. - # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. - type: "TOPOLOGY_ENDPOINT" - # Configuration could be defined through UI, and use `export` to format in the standard JSON. - configuration: |- - [ - { - "width": "4", - "title": "Endpoint Load in Current Service", - "height": "280", - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_cpm", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "parentService": true, - "unit": "CPM - calls per minute" - }, - { - "width": "4", - "title": "Slow Endpoints in Current Service", - "height": "280", - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "metricName": "endpoint_avg", - "unit": "ms", - "parentService": true - }, - { - "width": "4", - "title": "Successful Rate in Current Service", - "height": "280", - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_sla", - "queryMetricType": "sortMetrics", - "chartType": "ChartSlow", - "aggregation": "/", - "aggregationNum": "100", - "parentService": true, - "unit": "%", - "sortOrder": "ASC" - }, - { - "width": 3, - "title": "Endpoint Load", - "height": 350, - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_cpm", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine" - }, - { - "width": 3, - "title": "Endpoint Avg Response Time", - "height": 350, - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_avg", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, - { - "width": 3, - "title": "Endpoint Response Time Percentile", - "height": 350, - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "metricName": "endpoint_percentile", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "metricLabels": "P50, P75, P90, P95, P99", - "labelsIndex": "0, 1, 2, 3, 4", - "unit": "ms" - }, - { - "width": 3, - "title": "Endpoint Successful Rate", - "height": 350, - "entityType": "Endpoint", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "endpoint_sla", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%", - "aggregation": "/", - "aggregationNum": "100" - } - ] - # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. - # False means providing a basic template, user needs to add it manually. - activated: true - # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. - disabled: false - - name: SelfObservability - type: "DASHBOARD" - configuration: |- - [ - { - "name": "SelfObservability", - "type": "service", - "children": [ - { - "name": "oap-server", - "children": [ - { - "width": "3", - "title": "CPU", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_instance_cpu_percentage", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "%" - }, - { - "width": "3", - "title": "Memory", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_instance_jvm_memory_bytes_used", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "MB", - "aggregation": "/", - "aggregationNum": "1000000" - }, - { - "width": "3", - "title": "GC Count", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_instance_jvm_young_gc_count,meter_instance_jvm_old_gc_count", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar", - "unit": "Per Minute" - }, - { - "width": 3, - "title": "GC Time", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_instance_jvm_young_gc_time,meter_instance_jvm_old_gc_time", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "Millisecond" - }, - { - "width": 3, - "title": "Trace Analysis Count", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_instance_trace_count,meter_instance_trace_analysis_error_count", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar", - "unit": "Per Minute" - }, - { - "width": 3, - "title": "Trace Analysis Latency", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "metricName": "meter_instance_trace_latency_percentile", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "labelsIndex": "50,70,90,99", - "metricLabels": "50,70,90,99", - "unit": "Millisecond" - }, - { - "width": 3, - "title": "Mesh Analysis Count", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_instance_mesh_count,meter_instance_mesh_analysis_error_count", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar", - "unit": "Per Minute" - }, - { - "width": 3, - "title": "Mesh Analysis Latency", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "metricName": "meter_instance_mesh_latency_percentile", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "metricLabels": "50,70,90,99", - "labelsIndex": "50,70,90,99", - "unit": "Millisecond" - }, - { - "width": "3", - "title": "Aggregation", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_instance_metrics_first_aggregation,meter_instance_metrics_second_aggregation", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar", - "unit": "Per Minute" - }, - { - "width": 3, - "title": "Persistence Count", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_instance_persistence_prepare_count,meter_instance_persistence_execute_count,meter_instance_persistence_error_count", - "queryMetricType": "readMetricsValues", - "chartType": "ChartBar", - "unit": "Per 5 Minutes" - }, - { - "width": 3, - "title": "Persistence Preparing Latency ", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "unit": "Millisecond", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "metricName": "meter_instance_persistence_prepare_percentile", - "metricLabels": "50,70,90,99", - "labelsIndex": "50,70,90,99" - }, - { - "width": 3, - "title": "Persistence Execution Latency ", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "LABELED_VALUE", - "metricName": "meter_instance_persistence_execute_percentile", - "queryMetricType": "readLabeledMetricsValues", - "chartType": "ChartLine", - "metricLabels": "50,70,90,99", - "labelsIndex": "50,70,90,99", - "unit": "Millisecond" - } - ] - } - ] - } - ] - # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. - # False means providing a basic template, user needs to add it manually. - activated: true - # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. - disabled: false - - name: Spring-Sleuth - type: "DASHBOARD" - configuration: |- - [ - { - "name":"Spring Sleuth", - "type":"service", - "children":[ - { - "name":"Sleuth", - "children": [{ - "width": "3", - "title": "HTTP Request", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_http_server_requests_count", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "Count" - }, { - "width": "3", - "title": "HTTP Request Duration", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_http_server_requests_duration", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms" - }, { - "width": "3", - "title": "JDBC Connections", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "metricName": "meter_jdbc_connections_max,meter_jdbc_connections_active,meter_jdbc_connections_idle", - "unit": "Count" - }, { - "width": "3", - "title": "Tomcat Session", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "metricName": "meter_tomcat_sessions_active_max,meter_tomcat_sessions_active_current,meter_tomcat_sessions_rejected", - "unit": "Count" - }, { - "width": "3", - "title": "Instance CPU Usage", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_process_cpu_usage", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "aggregation": "+", - "aggregationNum": "", - "unit": "%" - }, { - "width": "3", - "title": "OS CPU Usage", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_system_cpu_usage", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "aggregation": "+", - "aggregationNum": "", - "unit": "%" - }, { - "width": "3", - "title": "OS System Load", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_system_load_average_1m", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "", - "aggregation": "+", - "aggregationNum": "" - }, { - "width": "3", - "title": "OS Process File", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_process_files_max,meter_process_files_open", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "Count", - "aggregation": "+", - "aggregationNum": "" - }, { - "width": "3", - "title": "JVM GC Pause Duration", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_jvm_gc_pause_duration", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "ms", - "aggregation": "+", - "aggregationNum": "" - }, { - "width": "3", - "title": "JVM Memory", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_jvm_memory_max,meter_jvm_memory_used,meter_jvm_memory_committed", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "aggregation": "/", - "aggregationNum": "1048576", - "unit": "MB" - }, { - "width": "3", - "title": "JVM Thread", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_jvm_threads_peak,meter_jvm_threads_live,meter_jvm_threads_daemon", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "Count" - }, { - "width": "3", - "title": "JVM classes", - "height": "200", - "entityType": "ServiceInstance", - "independentSelector": false, - "metricType": "REGULAR_VALUE", - "metricName": "meter_jvm_classes_loaded,meter_jvm_classes_unloaded", - "queryMetricType": "readMetricsValues", - "chartType": "ChartLine", - "unit": "Count" - }] - } - ] - } - ] - # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. - # False means providing a basic template, user needs to add it manually. - activated: false - # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. - disabled: false \ No newline at end of file diff --git a/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/apm.yml b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/apm.yml new file mode 100644 index 000000000..fa4189823 --- /dev/null +++ b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/apm.yml @@ -0,0 +1,528 @@ +# 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. + +# UI templates initialized file includes the default template when the SkyWalking OAP starts up at the first time. +# +# Also, SkyWalking would detect the existing templates in the database, once they are missing, all templates in this file +# could be added automatically. + +templates: + - name: "APM" + # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. + # DASHBOARD type templates could have multiple definitions, by using different names. + # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. + type: "DASHBOARD" + # Configuration could be defined through UI, and use `export` to format in the standard JSON. + configuration: |- + [ + { + "name": "APM", + "type": "service", + "children": [ + { + "name": "Global", + "children": [ + { + "width": 3, + "title": "Services Load", + "height": "300", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_cpm", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": false, + "unit": "CPM - calls per minute" + }, + { + "width": 3, + "title": "Slow Services", + "height": "300", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_resp_time", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": false, + "unit": "ms" + }, + { + "width": 3, + "title": "Un-Health Services (Apdex)", + "height": "300", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_apdex", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": false, + "aggregation": "/", + "aggregationNum": "10000", + "sortOrder": "ASC" + }, + { + "width": 3, + "title": "Slow Endpoints", + "height": "300", + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_avg", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": false, + "unit": "ms" + }, + { + "width": "6", + "title": "Global Response Latency", + "height": "280", + "entityType": "All", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "metricName": "all_percentile", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "metricLabels": "P50, P75, P90, P95, P99", + "labelsIndex": "0, 1, 2, 3, 4", + "unit": "percentile in ms" + }, + { + "width": "6", + "title": "Global Heatmap", + "height": "280", + "entityType": "All", + "independentSelector": false, + "metricType": "HEATMAP", + "unit": "ms", + "queryMetricType": "readHeatMap", + "chartType": "ChartHeatmap", + "metricName": "all_heatmap" + } + ] + }, + { + "name": "Service", + "children": [ + { + "width": 3, + "title": "Service Apdex", + "height": "200", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_apdex", + "queryMetricType": "readMetricsValue", + "chartType": "ChartNum", + "aggregation": "/", + "aggregationNum": "10000" + }, + { + "width": 3, + "title": "Service Avg Response Time", + "height": "200", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_resp_time", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, + { + "width": 3, + "title": "Successful Rate", + "height": "200", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_sla", + "queryMetricType": "readMetricsValue", + "chartType": "ChartNum", + "unit": "%", + "aggregation": "/", + "aggregationNum": "100" + }, + { + "width": 3, + "title": "Service Load", + "height": "200", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_cpm", + "queryMetricType": "readMetricsValue", + "chartType": "ChartNum", + "unit": "CPM - calls per minute" + }, + { + "width": 3, + "title": "Service Apdex", + "height": "200", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_apdex", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "aggregation": "/", + "aggregationNum": "10000" + }, + { + "width": 3, + "title": "Service Response Time Percentile", + "height": "200", + "entityType": "Service", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "metricName": "service_percentile", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "unit": "ms", + "metricLabels": "P50, P75, P90, P95, P99", + "labelsIndex": "0, 1, 2, 3, 4" + }, + { + "width": 3, + "title": "Successful Rate", + "height": "200", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_sla", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%", + "aggregation": "/", + "aggregationNum": "100" + }, + { + "width": 3, + "title": "Service Load", + "height": "200", + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_cpm", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "CPM - calls per minute" + }, + { + "width": "4", + "title": "Service Instances Load", + "height": "280", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_cpm", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": true, + "unit": "CPM - calls per minute" + }, + { + "width": "4", + "title": "Slow Service Instance", + "height": "280", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_resp_time", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": true, + "unit": "ms" + }, + { + "width": "4", + "title": "Service Instance Successful Rate", + "height": "280", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_sla", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": true, + "unit": "%", + "aggregation": "/", + "aggregationNum": "100", + "sortOrder": "ASC" + } + ] + }, + { + "name": "Instance", + "children": [ + { + "width": "4", + "title": "Service Instance Load", + "height": "150", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_cpm", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "CPM - calls per minute" + }, + { + "width": "4", + "title": "Service Instance Successful Rate", + "height": "150", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_sla", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%", + "aggregation": "/", + "aggregationNum": "100" + }, + { + "width": "4", + "title": "Service Instance Latency", + "height": "150", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_resp_time", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, + { + "width": 3, + "title": "JVM CPU (Java Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_jvm_cpu", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%", + "aggregation": "+", + "aggregationNum": "" + }, + { + "width": 3, + "title": "JVM Memory (Java Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_jvm_memory_heap, instance_jvm_memory_heap_max,instance_jvm_memory_noheap, instance_jvm_memory_noheap_max", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "MB", + "aggregation": "/", + "aggregationNum": "1048576" + }, + { + "width": 3, + "title": "JVM GC Time", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_jvm_young_gc_time, instance_jvm_old_gc_time", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, + { + "width": 3, + "title": "JVM GC Count", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar", + "metricName": "instance_jvm_young_gc_count, instance_jvm_old_gc_count" + }, + { + "width": 3, + "title": "JVM Thread Count (Java Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "metricName": "instance_jvm_thread_live_count, instance_jvm_thread_daemon_count, instance_jvm_thread_peak_count" + }, + { + "width": 3, + "title": "CLR CPU (.NET Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_clr_cpu", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%" + }, + { + "width": 3, + "title": "CLR GC (.NET Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_clr_gen0_collect_count, instance_clr_gen1_collect_count, instance_clr_gen2_collect_count", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar" + }, + { + "width": 3, + "title": "CLR Heap Memory (.NET Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_clr_heap_memory", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "MB", + "aggregation": "/", + "aggregationNum": "1048576" + }, + { + "width": 3, + "title": "CLR Thread (.NET Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "metricName": "instance_clr_available_completion_port_threads,instance_clr_available_worker_threads,instance_clr_max_completion_port_threads,instance_clr_max_worker_threads" + } + ] + }, + { + "name": "Endpoint", + "children": [ + { + "width": "4", + "title": "Endpoint Load in Current Service", + "height": "280", + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_cpm", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": true, + "unit": "CPM - calls per minute" + }, + { + "width": "4", + "title": "Slow Endpoints in Current Service", + "height": "280", + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "metricName": "endpoint_avg", + "unit": "ms", + "parentService": true + }, + { + "width": "4", + "title": "Successful Rate in Current Service", + "height": "280", + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_sla", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "aggregation": "/", + "aggregationNum": "100", + "parentService": true, + "unit": "%", + "sortOrder": "ASC" + }, + { + "width": 3, + "title": "Endpoint Load", + "height": 350, + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_cpm", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine" + }, + { + "width": 3, + "title": "Endpoint Avg Response Time", + "height": 350, + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_avg", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, + { + "width": 3, + "title": "Endpoint Response Time Percentile", + "height": 350, + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "metricName": "endpoint_percentile", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "metricLabels": "P50, P75, P90, P95, P99", + "labelsIndex": "0, 1, 2, 3, 4", + "unit": "ms" + }, + { + "width": 3, + "title": "Endpoint Successful Rate", + "height": 350, + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_sla", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%", + "aggregation": "/", + "aggregationNum": "100" + } + ] + } + ] + } + ] + # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. + # False means providing a basic template, user needs to add it manually. + activated: true + # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. + disabled: false \ No newline at end of file diff --git a/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/database.yml b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/database.yml new file mode 100644 index 000000000..c6deec262 --- /dev/null +++ b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/database.yml @@ -0,0 +1,142 @@ +# 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. + +# UI templates initialized file includes the default template when the SkyWalking OAP starts up at the first time. +# +# Also, SkyWalking would detect the existing templates in the database, once they are missing, all templates in this file +# could be added automatically. + +templates: + - name: "Database" + # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. + # DASHBOARD type templates could have multiple definitions, by using different names. + # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. + type: "DASHBOARD" + # Configuration could be defined through UI, and use `export` to format in the standard JSON. + configuration: |- + [ + { + "name": "Database", + "type": "database", + "children": [ + { + "name": "Database", + "children": [ + { + "width": 3, + "title": "Database Avg Response Time", + "height": 350, + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "database_access_resp_time", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, + { + "width": 3, + "title": "Database Access Successful Rate", + "height": 350, + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "database_access_sla", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%", + "aggregation": "/", + "aggregationNum": "100" + }, + { + "width": 3, + "title": "Database Traffic", + "height": 350, + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "database_access_cpm", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "CPM - calls per minute" + }, + { + "width": 3, + "title": "Database Access Latency Percentile", + "height": 350, + "entityType": "Service", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "metricName": "database_access_percentile", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "metricLabels": "P50, P75, P90, P95, P99", + "labelsIndex": "0, 1, 2, 3, 4", + "unit": "ms" + }, + { + "width": "6", + "title": "Slow Statements", + "height": 350, + "entityType": "Service", + "independentSelector": false, + "metricType": "SAMPLED_RECORD", + "metricName": "top_n_database_statement", + "queryMetricType": "readSampledRecords", + "chartType": "ChartSlow", + "parentService": true, + "sortOrder": "DES", + "unit": "ms" + }, + { + "width": 3, + "title": "All Database Loads", + "height": 350, + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "database_access_cpm", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": false, + "sortOrder": "DES", + "unit": "CPM - calls per minute" + }, + { + "width": 3, + "title": "Un-Health Databases (Successful Rate)", + "height": 350, + "entityType": "Service", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "database_access_sla", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": false, + "sortOrder": "ASC", + "unit": "%", + "aggregation": "/", + "aggregationNum": "100" + } + ] + } + ] + } + ] + # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. + # False means providing a basic template, user needs to add it manually. + activated: true + # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. + disabled: false \ No newline at end of file diff --git a/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/self-observability.yml b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/self-observability.yml new file mode 100644 index 000000000..d17fcd189 --- /dev/null +++ b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/self-observability.yml @@ -0,0 +1,196 @@ +# 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. + +# UI templates initialized file includes the default template when the SkyWalking OAP starts up at the first time. +# +# Also, SkyWalking would detect the existing templates in the database, once they are missing, all templates in this file +# could be added automatically. + +templates: + - name: SelfObservability + type: "DASHBOARD" + configuration: |- + [ + { + "name": "SelfObservability", + "type": "service", + "children": [ + { + "name": "oap-server", + "children": [ + { + "width": "3", + "title": "CPU", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_instance_cpu_percentage", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%" + }, + { + "width": "3", + "title": "Memory", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_instance_jvm_memory_bytes_used", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "MB", + "aggregation": "/", + "aggregationNum": "1000000" + }, + { + "width": "3", + "title": "GC Count", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_instance_jvm_young_gc_count,meter_instance_jvm_old_gc_count", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar", + "unit": "Per Minute" + }, + { + "width": 3, + "title": "GC Time", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_instance_jvm_young_gc_time,meter_instance_jvm_old_gc_time", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "Millisecond" + }, + { + "width": 3, + "title": "Trace Analysis Count", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_instance_trace_count,meter_instance_trace_analysis_error_count", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar", + "unit": "Per Minute" + }, + { + "width": 3, + "title": "Trace Analysis Latency", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "metricName": "meter_instance_trace_latency_percentile", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "labelsIndex": "50,70,90,99", + "metricLabels": "50,70,90,99", + "unit": "Millisecond" + }, + { + "width": 3, + "title": "Mesh Analysis Count", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_instance_mesh_count,meter_instance_mesh_analysis_error_count", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar", + "unit": "Per Minute" + }, + { + "width": 3, + "title": "Mesh Analysis Latency", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "metricName": "meter_instance_mesh_latency_percentile", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "metricLabels": "50,70,90,99", + "labelsIndex": "50,70,90,99", + "unit": "Millisecond" + }, + { + "width": "3", + "title": "Aggregation", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_instance_metrics_first_aggregation,meter_instance_metrics_second_aggregation", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar", + "unit": "Per Minute" + }, + { + "width": 3, + "title": "Persistence Count", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_instance_persistence_prepare_count,meter_instance_persistence_execute_count,meter_instance_persistence_error_count", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar", + "unit": "Per 5 Minutes" + }, + { + "width": 3, + "title": "Persistence Preparing Latency ", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "unit": "Millisecond", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "metricName": "meter_instance_persistence_prepare_percentile", + "metricLabels": "50,70,90,99", + "labelsIndex": "50,70,90,99" + }, + { + "width": 3, + "title": "Persistence Execution Latency ", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "metricName": "meter_instance_persistence_execute_percentile", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "metricLabels": "50,70,90,99", + "labelsIndex": "50,70,90,99", + "unit": "Millisecond" + } + ] + } + ] + } + ] + # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. + # False means providing a basic template, user needs to add it manually. + activated: true + # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. + disabled: false \ No newline at end of file diff --git a/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/spring-sleuth.yml b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/spring-sleuth.yml new file mode 100644 index 000000000..d2084affd --- /dev/null +++ b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/spring-sleuth.yml @@ -0,0 +1,185 @@ +# 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. + +# UI templates initialized file includes the default template when the SkyWalking OAP starts up at the first time. +# +# Also, SkyWalking would detect the existing templates in the database, once they are missing, all templates in this file +# could be added automatically. + +templates: + - name: Spring-Sleuth + type: "DASHBOARD" + configuration: |- + [ + { + "name":"Spring Sleuth", + "type":"service", + "children":[ + { + "name":"Sleuth", + "children": [{ + "width": "3", + "title": "HTTP Request", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_http_server_requests_count", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "Count" + }, { + "width": "3", + "title": "HTTP Request Duration", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_http_server_requests_duration", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, { + "width": "3", + "title": "JDBC Connections", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "metricName": "meter_jdbc_connections_max,meter_jdbc_connections_active,meter_jdbc_connections_idle", + "unit": "Count" + }, { + "width": "3", + "title": "Tomcat Session", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "metricName": "meter_tomcat_sessions_active_max,meter_tomcat_sessions_active_current,meter_tomcat_sessions_rejected", + "unit": "Count" + }, { + "width": "3", + "title": "Instance CPU Usage", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_process_cpu_usage", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "aggregation": "+", + "aggregationNum": "", + "unit": "%" + }, { + "width": "3", + "title": "OS CPU Usage", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_system_cpu_usage", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "aggregation": "+", + "aggregationNum": "", + "unit": "%" + }, { + "width": "3", + "title": "OS System Load", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_system_load_average_1m", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "", + "aggregation": "+", + "aggregationNum": "" + }, { + "width": "3", + "title": "OS Process File", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_process_files_max,meter_process_files_open", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "Count", + "aggregation": "+", + "aggregationNum": "" + }, { + "width": "3", + "title": "JVM GC Pause Duration", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_jvm_gc_pause_duration", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms", + "aggregation": "+", + "aggregationNum": "" + }, { + "width": "3", + "title": "JVM Memory", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_jvm_memory_max,meter_jvm_memory_used,meter_jvm_memory_committed", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "aggregation": "/", + "aggregationNum": "1048576", + "unit": "MB" + }, { + "width": "3", + "title": "JVM Thread", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_jvm_threads_peak,meter_jvm_threads_live,meter_jvm_threads_daemon", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "Count" + }, { + "width": "3", + "title": "JVM classes", + "height": "200", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "meter_jvm_classes_loaded,meter_jvm_classes_unloaded", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "Count" + }] + } + ] + } + ] + # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. + # False means providing a basic template, user needs to add it manually. + activated: false + # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. + disabled: false \ No newline at end of file diff --git a/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/topology-endpoint.yml b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/topology-endpoint.yml new file mode 100644 index 000000000..4f23dc7a3 --- /dev/null +++ b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/topology-endpoint.yml @@ -0,0 +1,128 @@ +# 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. + +# UI templates initialized file includes the default template when the SkyWalking OAP starts up at the first time. +# +# Also, SkyWalking would detect the existing templates in the database, once they are missing, all templates in this file +# could be added automatically. + +templates: + - name: "Topology Endpoint" + # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. + # DASHBOARD type templates could have multiple definitions, by using different names. + # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. + type: "TOPOLOGY_ENDPOINT" + # Configuration could be defined through UI, and use `export` to format in the standard JSON. + configuration: |- + [ + { + "width": "4", + "title": "Endpoint Load in Current Service", + "height": "280", + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_cpm", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "parentService": true, + "unit": "CPM - calls per minute" + }, + { + "width": "4", + "title": "Slow Endpoints in Current Service", + "height": "280", + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "metricName": "endpoint_avg", + "unit": "ms", + "parentService": true + }, + { + "width": "4", + "title": "Successful Rate in Current Service", + "height": "280", + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_sla", + "queryMetricType": "sortMetrics", + "chartType": "ChartSlow", + "aggregation": "/", + "aggregationNum": "100", + "parentService": true, + "unit": "%", + "sortOrder": "ASC" + }, + { + "width": 3, + "title": "Endpoint Load", + "height": 350, + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_cpm", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine" + }, + { + "width": 3, + "title": "Endpoint Avg Response Time", + "height": 350, + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_avg", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, + { + "width": 3, + "title": "Endpoint Response Time Percentile", + "height": 350, + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "LABELED_VALUE", + "metricName": "endpoint_percentile", + "queryMetricType": "readLabeledMetricsValues", + "chartType": "ChartLine", + "metricLabels": "P50, P75, P90, P95, P99", + "labelsIndex": "0, 1, 2, 3, 4", + "unit": "ms" + }, + { + "width": 3, + "title": "Endpoint Successful Rate", + "height": 350, + "entityType": "Endpoint", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "endpoint_sla", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%", + "aggregation": "/", + "aggregationNum": "100" + } + ] + # Activated as the TOPOLOGY_ENDPOINT type, makes this templates added into the UI page automatically. + # False means providing a basic template, user needs to add it manually. + activated: true + # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. + disabled: false \ No newline at end of file diff --git a/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/topology-instance.yml b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/topology-instance.yml new file mode 100644 index 000000000..a02ed4b82 --- /dev/null +++ b/oap-server/server-bootstrap/src/main/resources/ui-initialized-templates/topology-instance.yml @@ -0,0 +1,170 @@ +# 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. + +# UI templates initialized file includes the default template when the SkyWalking OAP starts up at the first time. +# +# Also, SkyWalking would detect the existing templates in the database, once they are missing, all templates in this file +# could be added automatically. + +templates: + - name: "Topology Instance" + # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. + # DASHBOARD type templates could have multiple definitions, by using different names. + # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. + type: "TOPOLOGY_INSTANCE" + # Configuration could be defined through UI, and use `export` to format in the standard JSON. + configuration: |- + [ + { + "width": "4", + "title": "Service Instance Load", + "height": "150", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_cpm", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "CPM - calls per minute" + }, + { + "width": "4", + "title": "Service Instance Successful Rate", + "height": "150", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_resp_time", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%", + "aggregation": "/", + "aggregationNum": "100" + }, + { + "width": "4", + "title": "Service Instance Latency", + "height": "150", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "service_instance_resp_time", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, + { + "width": 3, + "title": "JVM CPU (Java Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_jvm_cpu", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%", + "aggregation": "+", + "aggregationNum": "" + }, + { + "width": 3, + "title": "JVM Memory (Java Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_jvm_memory_heap, instance_jvm_memory_heap_max,instance_jvm_memory_noheap, instance_jvm_memory_noheap_max", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "MB", + "aggregation": "/", + "aggregationNum": "1048576" + }, + { + "width": 3, + "title": "JVM GC Time", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_jvm_young_gc_time, instance_jvm_old_gc_time", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "ms" + }, + { + "width": 3, + "title": "JVM GC Count", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar", + "metricName": "instance_jvm_young_gc_count, instance_jvm_old_gc_count" + }, + { + "width": 3, + "title": "CLR CPU (.NET Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_clr_cpu", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "%" + }, + { + "width": 3, + "title": "CLR GC (.NET Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_clr_gen0_collect_count, instance_clr_gen1_collect_count, instance_clr_gen2_collect_count", + "queryMetricType": "readMetricsValues", + "chartType": "ChartBar" + }, + { + "width": 3, + "title": "CLR Heap Memory (.NET Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "metricName": "instance_clr_heap_memory", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "unit": "MB" + }, + { + "width": 3, + "title": "CLR Thread (.NET Service)", + "height": "250", + "entityType": "ServiceInstance", + "independentSelector": false, + "metricType": "REGULAR_VALUE", + "queryMetricType": "readMetricsValues", + "chartType": "ChartLine", + "metricName": "instance_clr_available_completion_port_threads,instance_clr_available_worker_threads,instance_clr_max_completion_port_threads,instance_clr_max_worker_threads" + } + ] + # Activated as the TOPOLOGY_INSTANCE type, makes this templates added into the UI page automatically. + # False means providing a basic template, user needs to add it manually. + activated: true + # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. + disabled: false \ No newline at end of file diff --git a/oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/TestComponentLibraries.java b/oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/ComponentLibrariesTest.java similarity index 98% rename from oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/TestComponentLibraries.java rename to oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/ComponentLibrariesTest.java index f609164b1..8c74b3637 100644 --- a/oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/TestComponentLibraries.java +++ b/oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/ComponentLibrariesTest.java @@ -36,7 +36,7 @@ import static org.junit.Assert.fail; * component-libraries.yml}, note that this test only verifies Java components. */ @SuppressWarnings("rawtypes") -public class TestComponentLibraries { +public class ComponentLibrariesTest { @Test public void testComponentsAreInSync() throws Exception { final Reader reader = ResourceUtils.read("component-libraries.yml"); diff --git a/oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/UITemplateCheckerTest.java b/oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/UITemplateCheckerTest.java new file mode 100644 index 000000000..49fc5660e --- /dev/null +++ b/oap-server/server-bootstrap/src/test/java/org/apache/skywalking/oap/server/starter/UITemplateCheckerTest.java @@ -0,0 +1,54 @@ +/* + * 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.oap.server.starter; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; +import org.apache.skywalking.oap.server.core.management.ui.template.UITemplate; +import org.apache.skywalking.oap.server.core.management.ui.template.UITemplateInitializer; +import org.apache.skywalking.oap.server.library.util.ResourceUtils; +import org.junit.Assert; +import org.junit.Test; + +/** + * @since 8.2.0 SkyWalking supports multiple UI initialized templates, this check is avoiding the duplicated definitions + * in the multiple files. + * + * If the codes include duplicate template name in same or different template files in `ui-initialized-templates` + * folder, this test case would fail, in order to block the merge. + */ +public class UITemplateCheckerTest { + @Test + public void testNoTemplateConflict() throws FileNotFoundException { + final File[] templateFiles = ResourceUtils.getPathFiles("ui-initialized-templates"); + final List uiTemplates = new ArrayList<>(); + for (final File templateFile : templateFiles) { + UITemplateInitializer initializer = new UITemplateInitializer( + new FileInputStream(templateFile)); + uiTemplates.addAll(initializer.read()); + } + + final List distinct = uiTemplates.stream().distinct().collect(Collectors.toList()); + Assert.assertEquals(distinct.size(), uiTemplates.size()); + } +} diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java index 72cebd5bb..dbaba794e 100755 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/CoreModuleProvider.java @@ -18,6 +18,8 @@ package org.apache.skywalking.oap.server.core; +import java.io.File; +import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import org.apache.skywalking.oap.server.configuration.api.ConfigurationModule; @@ -145,14 +147,14 @@ public class CoreModuleProvider extends ModuleProvider { } EndpointNameGrouping endpointNameGrouping = new EndpointNameGrouping(); this.registerServiceImplementation(NamingControl.class, new NamingControl( - moduleConfig.getServiceNameMaxLength(), - moduleConfig.getInstanceNameMaxLength(), - moduleConfig.getEndpointNameMaxLength(), - endpointNameGrouping + moduleConfig.getServiceNameMaxLength(), + moduleConfig.getInstanceNameMaxLength(), + moduleConfig.getEndpointNameMaxLength(), + endpointNameGrouping )); try { endpointNameGroupingRuleWatcher = new EndpointNameGroupingRuleWatcher( - this, endpointNameGrouping); + this, endpointNameGrouping); } catch (FileNotFoundException e) { throw new ModuleStartException(e.getMessage(), e); } @@ -180,8 +182,8 @@ public class CoreModuleProvider extends ModuleProvider { if (moduleConfig.isGRPCSslEnabled()) { grpcServer = new GRPCServer(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort(), - moduleConfig.getGRPCSslCertChainPath(), - moduleConfig.getGRPCSslKeyPath() + moduleConfig.getGRPCSslCertChainPath(), + moduleConfig.getGRPCSslKeyPath() ); } else { grpcServer = new GRPCServer(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort()); @@ -217,7 +219,7 @@ public class CoreModuleProvider extends ModuleProvider { this.registerServiceImplementation(ConfigService.class, new ConfigService(moduleConfig)); this.registerServiceImplementation( - DownSamplingConfigService.class, new DownSamplingConfigService(moduleConfig.getDownsampling())); + DownSamplingConfigService.class, new DownSamplingConfigService(moduleConfig.getDownsampling())); this.registerServiceImplementation(GRPCHandlerRegister.class, new GRPCHandlerRegisterImpl(grpcServer)); this.registerServiceImplementation(JettyHandlerRegister.class, new JettyHandlerRegisterImpl(jettyServer)); @@ -236,7 +238,7 @@ public class CoreModuleProvider extends ModuleProvider { this.registerServiceImplementation(ModelManipulator.class, storageModels); this.registerServiceImplementation( - NetworkAddressAliasCache.class, new NetworkAddressAliasCache(moduleConfig)); + NetworkAddressAliasCache.class, new NetworkAddressAliasCache(moduleConfig)); this.registerServiceImplementation(TopologyQueryService.class, new TopologyQueryService(getManager())); this.registerServiceImplementation(MetricsMetadataQueryService.class, new MetricsMetadataQueryService()); @@ -251,9 +253,9 @@ public class CoreModuleProvider extends ModuleProvider { // add profile service implementations this.registerServiceImplementation( - ProfileTaskMutationService.class, new ProfileTaskMutationService(getManager())); + ProfileTaskMutationService.class, new ProfileTaskMutationService(getManager())); this.registerServiceImplementation( - ProfileTaskQueryService.class, new ProfileTaskQueryService(getManager(), moduleConfig)); + ProfileTaskQueryService.class, new ProfileTaskQueryService(getManager(), moduleConfig)); this.registerServiceImplementation(ProfileTaskCache.class, new ProfileTaskCache(getManager(), moduleConfig)); this.registerServiceImplementation(CommandService.class, new CommandService(getManager())); @@ -265,14 +267,16 @@ public class CoreModuleProvider extends ModuleProvider { if (moduleConfig.isGRPCSslEnabled()) { this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout(), - moduleConfig.getGRPCSslTrustedCAPath()); + moduleConfig.getGRPCSslTrustedCAPath() + ); } else { this.remoteClientManager = new RemoteClientManager(getManager(), moduleConfig.getRemoteTimeout()); } this.registerServiceImplementation(RemoteClientManager.class, remoteClientManager); // Management - this.registerServiceImplementation(UITemplateManagementService.class, new UITemplateManagementService(getManager())); + this.registerServiceImplementation( + UITemplateManagementService.class, new UITemplateManagementService(getManager())); MetricsStreamProcessor.getInstance().setEnableDatabaseSession(moduleConfig.isEnableDatabaseSession()); TopNStreamProcessor.getInstance().setTopNWorkerReportCycle(moduleConfig.getTopNReportPeriod()); @@ -296,23 +300,23 @@ public class CoreModuleProvider extends ModuleProvider { Address gRPCServerInstanceAddress = new Address(moduleConfig.getGRPCHost(), moduleConfig.getGRPCPort(), true); TelemetryRelatedContext.INSTANCE.setId(gRPCServerInstanceAddress.toString()); if (CoreModuleConfig.Role.Mixed.name() - .equalsIgnoreCase( - moduleConfig.getRole()) - || CoreModuleConfig.Role.Aggregator.name() - .equalsIgnoreCase( - moduleConfig.getRole())) { + .equalsIgnoreCase( + moduleConfig.getRole()) + || CoreModuleConfig.Role.Aggregator.name() + .equalsIgnoreCase( + moduleConfig.getRole())) { RemoteInstance gRPCServerInstance = new RemoteInstance(gRPCServerInstanceAddress); this.getManager() - .find(ClusterModule.NAME) - .provider() - .getService(ClusterRegister.class) - .registerRemote(gRPCServerInstance); + .find(ClusterModule.NAME) + .provider() + .getService(ClusterRegister.class) + .registerRemote(gRPCServerInstance); } DynamicConfigurationService dynamicConfigurationService = getManager().find(ConfigurationModule.NAME) - .provider() - .getService( - DynamicConfigurationService.class); + .provider() + .getService( + DynamicConfigurationService.class); dynamicConfigurationService.registerConfigChangeWatcher(apdexThresholdConfig); dynamicConfigurationService.registerConfigChangeWatcher(endpointNameGroupingRuleWatcher); } @@ -335,11 +339,15 @@ public class CoreModuleProvider extends ModuleProvider { CacheUpdateTimer.INSTANCE.start(getManager(), moduleConfig.getMetricsDataTTL()); try { - new UITemplateInitializer(ResourceUtils.read("ui-initialized-templates.yml")) + final File[] templateFiles = ResourceUtils.getPathFiles("ui-initialized-templates"); + for (final File templateFile : templateFiles) { + new UITemplateInitializer(new FileInputStream(templateFile)) .read() .forEach(uiTemplate -> { ManagementStreamProcessor.getInstance().in(uiTemplate); }); + } + } catch (FileNotFoundException e) { throw new ModuleStartException(e.getMessage(), e); } @@ -347,9 +355,9 @@ public class CoreModuleProvider extends ModuleProvider { @Override public String[] requiredModules() { - return new String[]{ - TelemetryModule.NAME, - ConfigurationModule.NAME + return new String[] { + TelemetryModule.NAME, + ConfigurationModule.NAME }; } } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java index 4ec82ae6b..1b06f0d13 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializer.java @@ -18,32 +18,37 @@ package org.apache.skywalking.oap.server.core.management.ui.template; +import java.io.IOException; import java.io.InputStream; -import java.io.Reader; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; +import lombok.extern.slf4j.Slf4j; import org.apache.skywalking.apm.util.StringUtil; import org.apache.skywalking.oap.server.core.query.enumeration.TemplateType; import org.apache.skywalking.oap.server.library.util.BooleanUtils; import org.yaml.snakeyaml.Yaml; /** - * UITemplateInitializer load the template from the config file in YAML format. The template definition is by JSON format in default, - * but it depends on the UI implementation only. + * UITemplateInitializer load the template from the config file in YAML format. The template definition is by JSON + * format in default, but it depends on the UI implementation only. */ +@Slf4j public class UITemplateInitializer { private Map yamlData; public UITemplateInitializer(InputStream inputStream) { Yaml yaml = new Yaml(); - yamlData = yaml.loadAs(inputStream, Map.class); - } - - public UITemplateInitializer(Reader io) { - Yaml yaml = new Yaml(); - yamlData = yaml.loadAs(io, Map.class); + try { + yamlData = yaml.loadAs(inputStream, Map.class); + } finally { + try { + inputStream.close(); + } catch (IOException e) { + log.warn(e.getMessage(), e); + } + } } public List read() { @@ -68,16 +73,16 @@ public class UITemplateInitializer { } newTemplate.setConfiguration(configuration); newTemplate.setActivated( - BooleanUtils.booleanToValue( - // The template should be activated in default, it is just an option. - (Boolean) template.getOrDefault("activated", false) - ) + BooleanUtils.booleanToValue( + // The template should be activated in default, it is just an option. + (Boolean) template.getOrDefault("activated", false) + ) ); newTemplate.setDisabled( - BooleanUtils.booleanToValue( - // The template should be available in default. - (Boolean) template.getOrDefault("disabled", false) - ) + BooleanUtils.booleanToValue( + // The template should be available in default. + (Boolean) template.getOrDefault("disabled", false) + ) ); if (uiTemplates.contains(newTemplate)) { throw new IllegalArgumentException("Template " + newTemplate.getName() + " name conflicts"); diff --git a/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializerTest.java b/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializerTest.java index 219328516..82e9d3a56 100644 --- a/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializerTest.java +++ b/oap-server/server-core/src/test/java/org/apache/skywalking/oap/server/core/management/ui/template/UITemplateInitializerTest.java @@ -18,19 +18,26 @@ package org.apache.skywalking.oap.server.core.management.ui.template; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.util.ArrayList; import java.util.List; import org.apache.skywalking.oap.server.library.util.BooleanUtils; +import org.apache.skywalking.oap.server.library.util.ResourceUtils; import org.junit.Assert; import org.junit.Test; public class UITemplateInitializerTest { @Test - public void testReadFile() { - UITemplateInitializer initializer = new UITemplateInitializer(this.getClass() - .getClassLoader() - .getResourceAsStream( - "ui-initialized-templates.yml")); - final List uiTemplates = initializer.read(); + public void testReadFile() throws FileNotFoundException { + final File[] templateFiles = ResourceUtils.getPathFiles("test-ui-templates"); + final List uiTemplates = new ArrayList<>(); + for (final File templateFile : templateFiles) { + UITemplateInitializer initializer = new UITemplateInitializer( + new FileInputStream(templateFile)); + uiTemplates.addAll(initializer.read()); + } Assert.assertEquals(2, uiTemplates.size()); UITemplate uiTemplate = uiTemplates.get(0); @@ -45,13 +52,4 @@ public class UITemplateInitializerTest { Assert.assertEquals(BooleanUtils.FALSE, uiTemplate.getActivated()); Assert.assertEquals(BooleanUtils.TRUE, uiTemplate.getDisabled()); } - - @Test(expected = IllegalArgumentException.class) - public void testTemplateConflict() { - UITemplateInitializer initializer = new UITemplateInitializer(this.getClass() - .getClassLoader() - .getResourceAsStream( - "ui-initialized-templates-conflict.yml")); - final List uiTemplates = initializer.read(); - } } diff --git a/oap-server/server-core/src/test/resources/ui-initialized-templates.yml b/oap-server/server-core/src/test/resources/test-ui-templates/ui-initialized-templates.yml similarity index 100% rename from oap-server/server-core/src/test/resources/ui-initialized-templates.yml rename to oap-server/server-core/src/test/resources/test-ui-templates/ui-initialized-templates.yml diff --git a/oap-server/server-core/src/test/resources/ui-initialized-templates-conflict.yml b/oap-server/server-core/src/test/resources/ui-initialized-templates-conflict.yml deleted file mode 100644 index 9f55a1c4e..000000000 --- a/oap-server/server-core/src/test/resources/ui-initialized-templates-conflict.yml +++ /dev/null @@ -1,51 +0,0 @@ -# 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. - -# UI templates initialized file includes the default template when the SkyWalking OAP starts up at the first time. -# -# Also, SkyWalking would detect the existing templates in the database, once they are missing, all templates in this file -# could be added automatically. - -templates: - - name: "APM" - # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. - # DASHBOARD type templates could have multiple definitions, by using different names. - # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. - type: "DASHBOARD" - # Configuration could be defined through UI, and use `export` to format in the standard JSON. - configuration: |- - ui exported definition in JSONsdfsd - sdjfkasld - sdfui - skdfj:dafjisa - adifaosi - # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. - # False means providing a basic template, user needs to add it manually. - activated: true - # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. - # disabled: false - - name: "APM" - # The type includes DASHBOARD, TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT. - # DASHBOARD type templates could have multiple definitions, by using different names. - # TOPOLOGY_INSTANCE, TOPOLOGY_ENDPOINT type templates should be defined once, as they are used in the topology page only. - type: "DASHBOARD" - # Configuration could be defined through UI, and use `export` to format in the standard JSON. - configuration: |- - Mesh metrics configuration. - # Activated as the DASHBOARD type, makes this templates added into the UI page automatically. - # False means providing a basic template, user needs to add it manually. - # activated: true - # True means wouldn't show up on the dashboard. Only keeps the definition in the storage. - disabled: true