dns clickhouse改造
This commit is contained in:
@@ -6,15 +6,16 @@ package serverconfigs
|
||||
type AccessLogWriteTargets struct {
|
||||
File bool `yaml:"file" json:"file"` // 写本地 JSON 文件(供 Fluent Bit → ClickHouse 或自用)
|
||||
MySQL bool `yaml:"mysql" json:"mysql"` // 写 MySQL 默认库按日分表
|
||||
ClickHouse bool `yaml:"clickhouse" json:"clickhouse"` // 需要落 ClickHouse(文件+Fluent Bit 或 API 直写)
|
||||
ClickHouse bool `yaml:"clickhouse" json:"clickhouse"` // 标记需要 ClickHouse 查询链路(写入由文件+Fluent Bit 异步完成)
|
||||
}
|
||||
|
||||
// NeedReportToAPI 是否需要上报到 API(写 MySQL 或 API 直写 ClickHouse 时需要)
|
||||
// NeedReportToAPI 是否需要上报到 API。
|
||||
// 与 DNS 语义一致:仅 MySQL 打开时才上报 API,ClickHouse-only 不上报。
|
||||
func (t *AccessLogWriteTargets) NeedReportToAPI() bool {
|
||||
if t == nil {
|
||||
return true // 兼容:未配置时保持原行为,上报
|
||||
}
|
||||
return t.MySQL || t.ClickHouse
|
||||
return t.MySQL
|
||||
}
|
||||
|
||||
// NeedWriteFile 节点是否需要写本地文件
|
||||
@@ -25,8 +26,9 @@ func (t *AccessLogWriteTargets) NeedWriteFile() bool {
|
||||
return t.File
|
||||
}
|
||||
|
||||
// ParseWriteTargetsFromPolicy 兼容入口:当前统一按 type 推导写入目标,不再依赖 writeTargets 字段
|
||||
// ParseWriteTargetsFromPolicy 从策略字段解析写入目标。
|
||||
// 当前以 type 为唯一真源,writeTargetsJSON 参数仅保留函数签名兼容。
|
||||
func ParseWriteTargetsFromPolicy(writeTargetsJSON []byte, policyType string, disableDefaultDB bool) *AccessLogWriteTargets {
|
||||
_ = writeTargetsJSON
|
||||
return ResolveWriteTargetsByType(policyType, disableDefaultDB)
|
||||
return BuildWriteTargetsByStorageType(policyType, disableDefaultDB)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user