未验证 提交 2b9de200 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Separate UI template files for further enhancement. (#5656)

* Separate UI template files for further enhancement.

* Add doc about the UI template.
上级 d86570a8
......@@ -51,14 +51,11 @@
<include>gateways.yml</include>
<include>service-apdex-threshold.yml</include>
<include>endpoint-name-grouping.yml</include>
<include>ui-initialized-templates.yml</include>
<include>oal/browser.oal</include>
<include>oal/core.oal</include>
<include>oal/java-agent.oal</include>
<include>oal/dotnet-agent.oal</include>
<include>oal/envoy.oal</include>
<include>fetcher-prom-rules/self.yaml</include>
<include>meter-receive-config/spring-sleuth.yaml</include>
<include>oal/*.oal</include>
<include>fetcher-prom-rules/*.yaml</include>
<include>meter-receive-config/*.yaml</include>
<include>oc-rules/*</include>
<include>ui-initialized-templates/*</include>
</includes>
<outputDirectory>/config</outputDirectory>
</fileSet>
......
......@@ -50,15 +50,12 @@
<include>component-libraries.yml</include>
<include>gateways.yml</include>
<include>service-apdex-threshold.yml</include>
<include>ui-initialized-templates.yml</include>
<include>endpoint-name-grouping.yml</include>
<include>oal/browser.oal</include>
<include>oal/core.oal</include>
<include>oal/java-agent.oal</include>
<include>oal/dotnet-agent.oal</include>
<include>oal/envoy.oal</include>
<include>fetcher-prom-rules/self.yaml</include>
<include>meter-receive-config/spring-sleuth.yaml</include>
<include>oal/*.oal</include>
<include>fetcher-prom-rules/*.yaml</include>
<include>meter-receive-config/*.yaml</include>
<include>oc-rules/*</include>
<include>ui-initialized-templates/*</include>
</includes>
<outputDirectory>/config</outputDirectory>
</fileSet>
......
......@@ -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.
......
......@@ -257,14 +257,11 @@
<exclude>gateways.yml</exclude>
<exclude>service-apdex-threshold.yml</exclude>
<exclude>endpoint-name-grouping.yml</exclude>
<exclude>ui-initialized-templates.yml</exclude>
<exclude>oal/browser.oal</exclude>
<exclude>oal/core.oal</exclude>
<exclude>oal/java-agent.oal</exclude>
<exclude>oal/dotnet-agent.oal</exclude>
<exclude>oal/envoy.oal</exclude>
<exclude>oal/</exclude>
<exclude>fetcher-prom-rules/</exclude>
<exclude>meter-receive-config/</exclude>
<exclude>oc-rules/</exclude>
<exclude>ui-initialized-templates/</exclude>
</excludes>
</configuration>
</plugin>
......
# 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
# 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
# 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
......@@ -19,33 +19,110 @@
# could be added automatically.
templates:
- name: "APM"
- 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: "DASHBOARD"
type: "TOPOLOGY_ENDPOINT"
# 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.
[
{
"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
- 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
disabled: false
\ No newline at end of file
# 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
......@@ -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");
......
/*
* 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<UITemplate> uiTemplates = new ArrayList<>();
for (final File templateFile : templateFiles) {
UITemplateInitializer initializer = new UITemplateInitializer(
new FileInputStream(templateFile));
uiTemplates.addAll(initializer.read());
}
final List<UITemplate> distinct = uiTemplates.stream().distinct().collect(Collectors.toList());
Assert.assertEquals(distinct.size(), uiTemplates.size());
}
}
......@@ -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
};
}
}
......@@ -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<UITemplate> 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");
......
......@@ -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<UITemplate> uiTemplates = initializer.read();
public void testReadFile() throws FileNotFoundException {
final File[] templateFiles = ResourceUtils.getPathFiles("test-ui-templates");
final List<UITemplate> 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<UITemplate> uiTemplates = initializer.read();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册