Skip to content

Commit

Permalink
fix: the bug of metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryanthelol committed Nov 20, 2023
1 parent 6842022 commit dfebe7e
Show file tree
Hide file tree
Showing 10 changed files with 1,081 additions and 7 deletions.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pychassiscli"
version = "0.3.2"
version = "0.3.3"
description = "A lightweight Python distributed microservice command line tool"
authors = [
{ name = "BryantHe", email = "bryantsisu@qq.com" },
Expand All @@ -18,7 +18,7 @@ dependencies = [
"rich>=13.7.0",
"click>=8.1.7",
"mako>=1.3.0",
"pytest>=7.4.0",
"pytest==7.4.3",
]
requires-python = ">=3.8"
readme = "README.md"
Expand Down
168 changes: 168 additions & 0 deletions src/pychassiscli/templates/metric-configs/grafana.json.mako
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"graphTooltip": 0,
"id": 20,
"links": [],
"liveNow": false,
"panels": [
% for grafana_dict in grafana_list:
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": {
"type": "statsd"
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 12,
"w": 12,
"x": 0,
"y": 0
},
"hiddenSeries": false,
"id": ${loop.index},
"legend": {
"alignAsTable": true,
"avg": true,
"current": true,
"hideEmpty": false,
"hideZero": false,
"max": true,
"min": true,
"rightSide": false,
"show": true,
"total": false,
"values": true
},
"lines": true,
"linewidth": 1,
"links": [],
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "8.5.5",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"expr": "${grafana_dict['stat_name']}",
"format": "time_series",
"hide": false,
"intervalFactor": 2,
"legendFormat": "${grafana_dict['stat_name']} {{quantile}}",
"refId": "A"
}
],
"thresholds": [],
"timeRegions": [],
"title": "${service_name} | ${grafana_dict['stat_name']}",
"tooltip": {
"shared": true,
"sort": ${loop.index},
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"mode": "time",
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"logBase": 1,
"show": true
},
{
"format": "short",
"logBase": 1,
"show": true
}
],
"yaxis": {
"align": false
}

% if grafana_dict['is_last'] == 1:
}
% else:
},
% endif
% endfor
],
"refresh": "3s",
"schemaVersion": 36,
"style": "dark",
"tags": [],
"templating": {
"list": []
},
"time": {
"from": "now-12h",
"to": "now"
},
"timepicker": {
"refresh_intervals": [
"3s",
"5s",
"10s",
"30s",
"1m",
"5m",
"15m",
"30m",
"1h",
"2h",
"1d"
],
"time_options": [
"5m",
"15m",
"1h",
"6h",
"12h",
"24h",
"2d",
"7d",
"30d"
]
},
"timezone": "",
"title": "${service_name}",
"uid": "${uid}",
"version": 7,
"weekStart": ""
}
Loading

0 comments on commit dfebe7e

Please sign in to comment.