Skip to content

Commit

Permalink
fix: otel 增强服务兼容没有空间id 的情况 (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
jiayuan929 authored Jan 13, 2023
1 parent 04a7866 commit af1bd5a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions svc-otel/svc_otel/vendor/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ def render_instance_data(request: HttpRequest, instance: ServiceInstance) -> Dic

if settings.ENABLE_ADMIN:
# NOTE: 签发管理页面的访问链接, 如果不提供管理入口, 去掉 `admin_url` 即可
admin_url = "{}/?space_uid={}#/apm/application?filter-app_name={}".format(
settings.BK_MONITORV3_URL, config['bk_monitor_space_id'], config['app_name']
)
config["admin_url"] = admin_url
# 没有空间 ID 则不显示详情页面
if bk_monitor_space_id := config.get('bk_monitor_space_id'):
admin_url = "{}/?space_uid={}#/apm/application?filter-app_name={}".format(
settings.BK_MONITORV3_URL, bk_monitor_space_id, config['app_name']
)
config["admin_url"] = admin_url

return data

0 comments on commit af1bd5a

Please sign in to comment.