def METHOD_NAME(self, request, project_id, cluster_id):
    """按 instance_id 聚合的 targets 列表"""
    params = self.params_validate(FetchTargetsSLZ)
    result = get_targets(project_id, cluster_id).get('data') or []
    targets = self._filter_targets(result, params['show_discovered'])
    targets_dict = {}
    for instance_id, targets in itertools.groupby(
        sorted(targets, key=lambda x: x['instance_id']), key=lambda y: y['instance_id']
    ):
        targets = METHOD_NAME(targets)
        jobs = {t['job'] for t in targets}
        graph_url = self._gen_graph_url(project_id, cluster_id, jobs) if jobs else None
        targets_dict[instance_id] = {
            'targets': targets,
            'graph_url': graph_url,
            'total_count': len(targets),
            'health_count': len([t for t in targets if t['health'] == 'up']),
        }
    # 如果是共享集群，需要过滤出属于项目的命名空间的 Target
    # 过滤规则：targets_dict key: {namespace}/{name} 取 ns 进行检查
    if get_cluster_type(cluster_id) == ClusterType.SHARED:
        project_namespaces = get_shared_cluster_proj_namespaces(request.ctx_cluster, request.project.english_name)
        targets_dict = {
            inst_id: target_info
            for inst_id, target_info in targets_dict.items()
            if inst_id.split('/')[0] in project_namespaces
        }
    return Response(targets_dict)