Skip to content

Commit

Permalink
Merge branch 'master' into feat/field_analysis/#1010158081121930426
Browse files Browse the repository at this point in the history
  • Loading branch information
zzz833708 authored Feb 13, 2025
2 parents 0a47ca2 + 8dda68a commit fc7bbaa
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bkmonitor/api/kubernetes/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ def perform_request(self, params):
return self.get_clusters_from_bcs_cluster_manager(params)


class FetchIngressListByClusterResource(CacheResource):
class FetchK8sIngressListByClusterResource(CacheResource):
cache_type = CacheType.BCS

class RequestSerializer(serializers.Serializer):
Expand Down
5 changes: 4 additions & 1 deletion bkmonitor/apm/core/platform_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,9 @@ def get_resource_fill_dimensions_config(cls, bcs_cluster_id=None):
return {}
operator_service_name = svc.items[0].metadata.name

cluster_cache_config = settings.K8S_COLLECTOR_CONFIG or {}
cache_interval = cluster_cache_config.get(bcs_cluster_id, {}).get("cache", {}).get("interval", '10s')

return {
"name": "resource_filter/fill_dimensions",
"from_record": [
Expand All @@ -368,7 +371,7 @@ def get_resource_fill_dimensions_config(cls, bcs_cluster_id=None):
"key": "k8s.pod.ip",
"url": f"http://{operator_service_name}:8080/pods",
"timeout": "60s",
"interval": "10s",
"interval": cache_interval,
},
},
}
Expand Down
1 change: 1 addition & 0 deletions bkmonitor/bkmonitor/define/global_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
("ENABLE_DEFAULT_STRATEGY", slz.BooleanField(label="是否开启默认策略", default=True)),
("IS_ENABLE_VIEW_CMDB_LEVEL", slz.BooleanField(label="是否开启前端视图部分的CMDB预聚合", default=False)),
("K8S_OPERATOR_DEPLOY_NAMESPACE", slz.JSONField(label="bkmonitor-operator 特殊集群部署命名空间信息", default={})),
("K8S_COLLECTOR_CONFIG", slz.JSONField(label="集群内 collector 数据接收端特殊配置", default={})),
# === BKDATA & AIOPS 相关配置 开始 ===
("AIOPS_BIZ_WHITE_LIST", slz.ListField(label="开启智能异常算法的业务白名单", default=[])),
("AIOPS_INCIDENT_BIZ_WHITE_LIST", slz.ListField(label="开启根因故障定位的业务白名单", default=[])),
Expand Down
7 changes: 7 additions & 0 deletions bkmonitor/config/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,13 @@ def decode_plaintext(cls, plaintext_bytes: bytes, encoding: str = "utf-8", **kwa
# }
K8S_OPERATOR_DEPLOY_NAMESPACE = {}

# 集群内 collector 接收端特殊配置,针对一个集群部署多套 operator 时需要配置这个
# 格式: {
# "BCS-K8S-00000": {"cache": {"interval": "10s"}},
# "BCS-K8S-00001": {"cache": {"interval": "1s"}},
# }
K8S_COLLECTOR_CONFIG = {}

# 默认K8S插件采集集群ID
K8S_PLUGIN_COLLECT_CLUSTER_ID = ""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def _add_member_to_notice_group(
user_group_inst, data={"duty_arranges": [{"users": current_users}]}, partial=True
)

user_group_serializer.is_valid(True)
user_group_serializer.is_valid(raise_exception=True)
return user_group_serializer.save().id

def _apply_default_notice_group(self) -> int:
Expand Down
4 changes: 3 additions & 1 deletion bkmonitor/packages/monitor_web/overview/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,9 @@ def perform_request(self, params: Dict[str, Any]) -> None:
config = config.config

# 查询已屏蔽策略
shield_configs = Shield.objects.filter(category="strategy", failure_time__gte=timezone.now())
shield_configs = Shield.objects.filter(
category="strategy", failure_time__gte=timezone.now(), bk_biz_id=bk_biz_id
)
shielded_strategy_ids = set(
itertools.chain.from_iterable(
[shield_config.dimension_config.get("strategy_id", []) for shield_config in shield_configs]
Expand Down

0 comments on commit fc7bbaa

Please sign in to comment.