Skip to content

Commit

Permalink
fix(backend): grafana 数据源初始化 #5119
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangzhw8 committed Jun 21, 2024
1 parent e1626be commit 81cf6e9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions dbm-ui/backend/bk_dataview/grafana/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,11 @@ def perform_provisioning(self, request):
# 仅当db中配置了监控的token,才进行数据源初始化
if SystemSettings.objects.filter(key=SystemSettingsEnum.BKM_DBM_TOKEN.value).exists():
# 注入数据源
ds_list = []
logger.info("create datasource monitor for grafana")
for ds in provisioning.datasources(request, org_name, org_id):
if not isinstance(ds, Datasource):
raise ValueError("%s is not instance %s" % (type(ds), Datasource))
ds_list.append(ds)
self.handler.handle_datasources(request, org_name, org_id, ds_list)
logger.info(f"create datasource monitor for grafana. {ds}")
self.handler.handle_datasources(request, org_name, org_id, [ds])
else:
logger.error("skip datasource init for grafana, please set BKM_DBM_TOKEN in database")

Expand Down

0 comments on commit 81cf6e9

Please sign in to comment.