Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] 插件调试支持按服务实例维度进行调试 #1344

Closed
zhangzhw8 opened this issue Dec 19, 2022 · 4 comments
Closed

[FEATURE] 插件调试支持按服务实例维度进行调试 #1344

zhangzhw8 opened this issue Dec 19, 2022 · 4 comments
Assignees
Labels

Comments

@zhangzhw8
Copy link
Member

你想要什么功能
插件调试支持按服务实例维度进行调试

为什么需要
调试时,没有服务实例相关的上下文,导致插件调试报错

建议如何实现
现在写死了,需通过接口参数传递

                object_type=models.Subscription.ObjectType.HOST,
                node_type=models.Subscription.NodeType.INSTANCE,

image

@CohleRustW
Copy link
Collaborator

方案简述

  1. 序列号器增加字段兼容服务模板ID传入
    class InstanceInfoSerializer(serializers.Serializer):
        id = serializers.IntegerField(required=True)
        bk_biz_id = serializers.IntegerField(required=True
  1. 订阅node应该为{"id": 1}, 订阅object_typeSERVICE

  2. 查询主机信息通过get_service_instance_by_ids获取bk_host_id

@ZhuoZhuoCrayon
Copy link
Member

方案没有问题,不过注意接口协议要向前兼容,可以新开一个 instance_info,但原来的 host_info 要保留,序列化器校验两个二选一

@ZhuoZhuoCrayon
Copy link
Member

ZhuoZhuoCrayon commented Feb 10, 2023

验证方式:

  1. 在监控创建一个默认插件
  2. 裸调 start_debug 创建服务实例维度的订阅
  3. 验证 query_debug 是否有日志上报
  4. 验证 stop_debug 接口可用性

验证结果脱敏放在 issue 里

@ZhuoZhuoCrayon
Copy link
Member

保证接口的可扩展性

  1. 开放 object_type node_type 参数,默认为 HOST INSTANCE
  2. instance_info 里的 id / bk_inst_id / bk_obj_id 属性均设置为非必填
  3. 根据 object_type / node_type 校验 instance_info(以及是否缺字段) host_info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants