grafana fix, github actions cache

This commit is contained in:
BennyThink
2021-07-05 18:33:29 +08:00
parent 39e807937a
commit f749f49a55
5 changed files with 388 additions and 23 deletions

View File

@@ -2,4 +2,10 @@ mongo_data/*
certs/* certs/*
data/* data/*
logs/* logs/*
YYeTsFE/node_modules/* YYeTsFE/node_modules/*
.github/*
assets/*
tools/*
scripts/*
conf/*
tests/*

View File

@@ -51,7 +51,7 @@ jobs:
push: true push: true
tags: bennythink/yyetsbot:latest tags: bennythink/yyetsbot:latest
cache-from: type=local,src=/tmp/.buildx-cache cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
- name: Move cache - name: Move cache
run: | run: |

13
API.md
View File

@@ -2,20 +2,21 @@
## FE ## FE
- [ ] group为admin特殊显示评论接口已返回group信息 - [x] group为admin特殊显示评论接口已返回group信息
- [ ] 评论楼中楼 - [x] 评论楼中楼
- [x] 联合搜索当本地数据库搜索不到数据时会返回extra字段
- [ ] 评论通知(浏览器通知) - [ ] 评论通知(浏览器通知)
- [ ] 最新评论id为-1 - [ ] 最新评论id为-1
- [ ] 联合搜索当本地数据库搜索不到数据时会返回extra字段 - [ ] 公告
# BE # BE
- [ ] 添加资源API
- [x] 联合搜索字幕侠、new字幕组、追新番 - [x] 联合搜索字幕侠、new字幕组、追新番
- [ ] 评论通知,需要新接口 - [x] grafana面板
- [ ] grafana面板
- [ ] 豆瓣接口 - [ ] 豆瓣接口
- [ ] 用户体系(添加邮箱,邮件支持,找回密码) - [ ] 用户体系(添加邮箱,邮件支持,找回密码)
- [ ] 评论通知,需要新接口
- [ ] 添加资源API
# 资源 # 资源

View File

@@ -14,7 +14,7 @@
"type": "grafana", "type": "grafana",
"id": "grafana", "id": "grafana",
"name": "Grafana", "name": "Grafana",
"version": "7.3.4" "version": "7.5.9"
}, },
{ {
"type": "panel", "type": "panel",
@@ -55,9 +55,7 @@
"dashes": false, "dashes": false,
"datasource": "${DS_JSON}", "datasource": "${DS_JSON}",
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {},
"custom": {}
},
"overrides": [] "overrides": []
}, },
"fill": 1, "fill": 1,
@@ -69,6 +67,113 @@
"y": 0 "y": 0
}, },
"hiddenSeries": false, "hiddenSeries": false,
"id": 10,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.5.9",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"data": "",
"refId": "A",
"target": "help",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "B",
"target": "database",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "C",
"target": "discuss",
"type": "timeseries"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Other",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_JSON}",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 0
},
"hiddenSeries": false,
"id": 2, "id": 2,
"legend": { "legend": {
"avg": false, "avg": false,
@@ -86,7 +191,7 @@
"alertThreshold": true "alertThreshold": true
}, },
"percentage": false, "percentage": false,
"pluginVersion": "7.3.4", "pluginVersion": "7.5.9",
"pointradius": 2, "pointradius": 2,
"points": false, "points": false,
"renderer": "flot", "renderer": "flot",
@@ -98,19 +203,42 @@
{ {
"data": "", "data": "",
"refId": "A", "refId": "A",
"target": "access", "target": "resource",
"type": "timeseries" "type": "timeseries"
}, },
{ {
"data": "", "data": "",
"hide": false,
"refId": "B", "refId": "B",
"target": "top",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "C",
"target": "home",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "D",
"target": "search", "target": "search",
"type": "timeseries" "type": "timeseries"
}, },
{ {
"data": "", "data": "",
"refId": "C", "hide": false,
"target": "resource", "refId": "E",
"target": "backOld",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "F",
"target": "extra",
"type": "timeseries" "type": "timeseries"
} }
], ],
@@ -118,7 +246,235 @@
"timeFrom": null, "timeFrom": null,
"timeRegions": [], "timeRegions": [],
"timeShift": null, "timeShift": null,
"title": "Access Report", "title": "Resource",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_JSON}",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 0,
"y": 8
},
"hiddenSeries": false,
"id": 8,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.5.9",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"data": "",
"refId": "A",
"target": "user",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "B",
"target": "share",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "C",
"target": "me",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "D",
"target": "comment",
"type": "timeseries"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "User",
"tooltip": {
"shared": true,
"sort": 0,
"value_type": "individual"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_JSON}",
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 1,
"fillGradient": 0,
"gridPos": {
"h": 8,
"w": 12,
"x": 12,
"y": 8
},
"hiddenSeries": false,
"id": 6,
"legend": {
"avg": false,
"current": false,
"max": false,
"min": false,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 1,
"nullPointMode": "null",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.5.9",
"pointradius": 2,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"data": "",
"refId": "A",
"target": "multiDownload",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "B",
"target": "download",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "C",
"target": "favorite",
"type": "timeseries"
},
{
"data": "",
"hide": false,
"refId": "D",
"target": "unFavorite",
"type": "timeseries"
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Action",
"tooltip": { "tooltip": {
"shared": true, "shared": true,
"sort": 0, "sort": 0,
@@ -156,7 +512,7 @@
} }
} }
], ],
"schemaVersion": 26, "schemaVersion": 27,
"style": "dark", "style": "dark",
"tags": [], "tags": [],
"templating": { "templating": {
@@ -170,5 +526,5 @@
"timezone": "", "timezone": "",
"title": "YYeTs", "title": "YYeTs",
"uid": "zJOru_8Gz", "uid": "zJOru_8Gz",
"version": 2 "version": 5
} }

View File

@@ -329,8 +329,8 @@ class CommentHandler(BaseHandler):
class CommentChildHandler(CommentHandler): class CommentChildHandler(CommentHandler):
class_name = f"CommentChild{adapter}Resource" class_name = f"CommentChild{adapter}Resource"
from Mongo import CommentChildResource # from Mongo import CommentChildResource
instance = CommentChildResource() # instance = CommentChildResource()
@run_on_executor() @run_on_executor()
def get_comment(self): def get_comment(self):
@@ -455,7 +455,8 @@ class GrafanaIndexHandler(BaseHandler):
class GrafanaSearchHandler(BaseHandler): class GrafanaSearchHandler(BaseHandler):
def post(self): def post(self):
data = ["access", "search", "resource"] data = ["resource", "top", "home", "search", "extra", "discuss", "multiDownload", "download", "user", "share",
"me", "database", "help", "backOld", "favorite", "unFavorite", "comment"]
self.write(json.dumps(data)) self.write(json.dumps(data))
@@ -493,8 +494,9 @@ class GrafanaQueryHandler(BaseHandler):
for target in targets: for target in targets:
data_points = [] data_points = []
result = self.instance.get_grafana_data(date_series) result = self.instance.get_grafana_data(date_series)
i: dict
for i in result: for i in result:
datum = [i[target], self.time_str_int(i["date"]) * 1000] datum = [i[target], self.time_str_int(i["date"]) * 1000] if i.get(target) else []
data_points.append(datum) data_points.append(datum)
temp = { temp = {
"target": target, "target": target,