-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
参考https://cwiki.yunify.com/pages/viewpage.action?pageId=197085143 方案二实现
-
orgId的表示- 引入新的Org CRD。使用Org CR创建或删除
orgId(命名上受K8S CR名称的约束) - Remote Write请求和查询请求时使用
X-Scope-OrgIDheader来标记orgId - 指标数据存储时以
org_id标签来标记orgId - 系统Org CR,名称默认为
system-org,默认创建
- 引入新的Org CRD。使用Org CR创建或删除
-
org-ingester(接收外部数据)
- 相应的Ingester CR使用
org-<orgId>前缀命名,与clusters对应的ingesters(称作cluster-ingester)进行区分 - 引入新的org-controller: (以下忽略系统Org CR)
- 在新Org CR创建后为其生成Ingester CR
- Org CR删除时其对应的Ingester CR需要同步删除
- 相应的Ingester CR使用
-
cluster-ingester(接收内部数据)
--labels中加上org_id="system-org"以标记数据所属的Org
-
org-router(路由外部数据到org-ingester)
- 相应的Router CR使用
org-前缀命名,以与旧的Router CR(称作cluster-router)进行区分 - 更新router-controller:
- 为org-router生成hashring配置,包含所有org-ingester(cluster-router则对应所有cluster-ingester)
- 相应的Router CR使用
-
gateway:
/{cluster}/api/v1/receive接收cluster的数据,属于系统Org,代理到cluster-router/api/v1/receive,通过X-Scope-OrgIDheader识别Org- org
system-org的数据代理到cluster-router - 其他org的数据代理到org-router
- org
/{cluster}/api/v1/query等api查询cluster的数据,属于系统Org,在promql或matchers条件中注入org_id=~"system-org|"(这里包含org_id为空的情况以兼容旧数据)/api/v1/query等api查询所有数据,通过X-Scope-OrgIDheader识别Org,在promql或matchers条件中注入org_id="<orgId>"
-
whizard-telemetry-apiserver:
- 监控查询请求的header中添加
X-Scope-OrgID: system-org,或promql/matchers中包含org_id="system-org"
- 监控查询请求的header中添加
-
whizard-alerting:
- RuleGroups/ClusterRuleGroups->PrometheusRules时promql中注入
org_id="system-org" - 支持外部Org数据的告警
- GlobalRuleGroups中支持配置orgId
- kse-console支持在配置全局规则时选择orgId(需设计、前端介入):
- 选择
kse-system时,支持按模板配置规则,支持自定义规则时选择集群等 - 选择其他org时,仅支持自定义规则
- 选择
- 转换到PrometheusRules时promql注入
org_id="<orgId>" - 转换到PrometheusRules时labels中加上
org_id: <orgId>标签 - remote write ALERTS指标时应将ALERTS中的
org_id: <orgId>标签转换到加上headerX-Scope-OrgID: <orgId>上- 此时还需要考虑在orgId为系统Org时如何将cluster标签放在header上,可参考receive/handler: implement tenant label splitting thanos-io/thanos#7256 在cluster-router上处理
- RuleGroups/ClusterRuleGroups->PrometheusRules时promql中注入
Metadata
Metadata
Assignees
Labels
No labels