Panel types for dashboards

原文:https://docs.gitlab.com/ee/operations/metrics/dashboards/panel_types.html

Panel types for dashboards

监视仪表板中支持以下面板类型.

Area or Line Chart

要将面积图面板类型添加到仪表盘,请查看以下样本仪表盘文件:

  1. dashboard: 'Dashboard Title'
  2. panel_groups:
  3. - group: 'Group Title'
  4. panels:
  5. - type: area-chart # or line-chart
  6. title: 'Area Chart Title'
  7. y_label: "Y-Axis"
  8. y_axis:
  9. format: number
  10. precision: 0
  11. metrics:
  12. - id: area_http_requests_total
  13. query_range: 'http_requests_total'
  14. label: "Instance: {{instance}}, Method: {{method}}"
  15. unit: "count"

请注意以下属性:

Property Type Required Description
type string no 要渲染的面板类型. 区域面板类型的可选
query_range string required 对于区域面板类型,必须使用范围查询

area panel chart

版本 12.8开始,y 轴值将根据数据自动缩放. 以前,它总是从 0 开始.

Anomaly chart

在 GitLab 12.5 中引入 .

要将异常图表面板类型添加到仪表盘,请添加恰好具有 3 个指标的面板.

第一个指标代表当前状态,第二个和第三个指标分别代表上限和下限:

  1. dashboard: 'Dashboard Title'
  2. panel_groups:
  3. - group: 'Group Title'
  4. panels:
  5. - type: anomaly-chart
  6. title: "Chart Title"
  7. y_label: "Y-Axis"
  8. metrics:
  9. - id: anomaly_requests_normal
  10. query_range: 'http_requests_total'
  11. label: "# of Requests"
  12. unit: "count"
  13. metrics:
  14. - id: anomaly_requests_upper_limit
  15. query_range: 10000
  16. label: "Max # of requests"
  17. unit: "count"
  18. metrics:
  19. - id: anomaly_requests_lower_limit
  20. query_range: 2000
  21. label: "Min # of requests"
  22. unit: "count"

请注意以下属性:

Property Type Required Description
type string required 异常面板类型必须为anomaly-chart
query_range yes required 对于异常面板类型,必须在每个指标中使用范围查询 .

anomaly panel type

Bar chart

要将条形图添加到仪表板,请查看以下样本仪表板文件:

  1. dashboard: 'Dashboard Title'
  2. panel_groups:
  3. - group: 'Group title'
  4. panels:
  5. - type: bar
  6. title: "Http Handlers"
  7. x_label: 'Response Size'
  8. y_axis:
  9. name: "Handlers"
  10. metrics:
  11. - id: prometheus_http_response_size_bytes_bucket
  12. query_range: "sum(increase(prometheus_http_response_size_bytes_bucket[1d])) by (handler)"
  13. unit: 'Bytes'

请注意以下属性:

Property Type Required Description
type string yes 要渲染的面板类型. 对于条形图类型,设置为bar
query_range yes yes 对于条形图,必须使用范围查询

bar chart panel type

Column chart

要将列面板类型添加到仪表板,请查看以下样本仪表板文件:

  1. dashboard: 'Dashboard Title'
  2. panel_groups:
  3. - group: 'Group title'
  4. panels:
  5. - title: "Column"
  6. type: "column"
  7. metrics:
  8. - id: 1024_memory
  9. query: 'avg(sum(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}) by (job)) without (job) / count(avg(container_memory_usage_bytes{container_name!="POD",pod_name=~"^%{ci_environment_slug}-([^c].*|c([^a]|a([^n]|n([^a]|a([^r]|r[^y])))).*|)-(.*)",namespace="%{kube_namespace}"}) without (job)) /1024/1024'
  10. unit: MB
  11. label: "Memory Usage"

请注意以下属性:

Property Type Required Description
type string yes 要渲染的面板类型. 对于列面板类型,设置为column
query_range yes yes 对于列面板类型,必须使用范围查询

anomaly panel type

Stacked column

在 GitLab 12.8 中引入 .

要将堆叠的列面板类型添加到仪表板,请查看以下样本仪表板文件:

  1. dashboard: 'Dashboard title'
  2. priority: 1
  3. panel_groups:
  4. - group: 'Group Title'
  5. priority: 5
  6. panels:
  7. - type: 'stacked-column'
  8. title: "Stacked column"
  9. y_label: "y label"
  10. x_label: 'x label'
  11. metrics:
  12. - id: memory_1
  13. query_range: 'memory_query'
  14. label: "memory query 1"
  15. unit: "count"
  16. series_name: 'group 1'
  17. - id: memory_2
  18. query_range: 'memory_query_2'
  19. label: "memory query 2"
  20. unit: "count"
  21. series_name: 'group 2'

stacked column panel type

Property Type Required Description
type string yes 要渲染的面板类型. 对于堆叠式柱面板类型,设置为” stacked-column
query_range yes yes 对于堆叠式列面板类型,必须使用范围查询

Single Stat

要将单个状态面板类型添加到仪表板,请查看以下样本仪表板文件:

  1. dashboard: 'Dashboard Title'
  2. panel_groups:
  3. - group: 'Group Title'
  4. panels:
  5. - title: "Single Stat"
  6. type: "single-stat"
  7. metrics:
  8. - id: 10
  9. query: 'max(go_memstats_alloc_bytes{job="prometheus"})'
  10. unit: MB
  11. label: "Total"

请注意以下属性:

Property Type Required Description
type string yes 要渲染的面板类型. 对于单一统计信息面板类型,设置为single-stat
field string no 面板显示指标的值. 要使面板显示标签的值,请在该键中放置标签的名称.
query string yes For single stat panel types, you must use an instant query

single stat panel type

Percentile based results

在 GitLab 12.8 中引入 .

有时需要将查询结果表示为 100 中的百分比值.您可以在面板定义的根部使用max_value属性:

  1. dashboard: 'Dashboard Title'
  2. panel_groups:
  3. - group: 'Group Title'
  4. panels:
  5. - title: "Single Stat"
  6. type: "single-stat"
  7. max_value: 100
  8. metrics:
  9. - id: 10
  10. query: 'max(go_memstats_alloc_bytes{job="prometheus"})'
  11. unit: '%'
  12. label: "Total"

例如,如果查询值为53.6 ,则将%添加为单位将得出53.6%的单个统计值,但是如果查询的最大期望值为120 ,则该值为44.6% . 添加max_value会导致显示正确的百分比值.

Heatmaps

在 GitLab 12.5 中引入 .

要将热图面板类型添加到仪表板,请查看以下样本仪表板文件:

  1. dashboard: 'Dashboard Title'
  2. panel_groups:
  3. - group: 'Group Title'
  4. panels:
  5. - title: "Heatmap"
  6. type: "heatmap"
  7. metrics:
  8. - id: 10
  9. query: 'sum(rate(nginx_upstream_responses_total{upstream=~"%{kube_namespace}-%{ci_environment_slug}-.*"}[60m])) by (status_code)'
  10. unit: req/sec
  11. label: "Status code"

请注意以下属性:

Property Type Required Description
type string yes 要渲染的面板类型. 对于热图面板类型,设置为heatmap
query_range yes yes 对于区域面板类型,必须使用范围查询

heatmap panel type

警告:当查询返回太多数据点时,热图数据桶的尺寸趋于向下至 0,从而使图表的数据不可见,如下图所示. 要解决此问题,请通过更改指标仪表板 UI 上的时间范围过滤器,或将step属性添加到仪表板的 YAML 文件中,来限制返回的数据量.

heatmap chart_too_much_data