换成单集群模式

This commit is contained in:
robin
2026-03-02 20:07:53 +08:00
parent 5d0b7c7e91
commit 2a76d1773d
432 changed files with 5681 additions and 5095 deletions

View File

@@ -0,0 +1,57 @@
package accesslogs
import "github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
// HTTPDNSIngestLog HTTPDNS 访问日志单行结构JSONEachRow字段与
// ClickHouse httpdns_access_logs_ingest 表一一对应。
type HTTPDNSIngestLog struct {
Timestamp int64 `json:"timestamp"`
RequestId string `json:"request_id"`
ClusterId int64 `json:"cluster_id"`
NodeId int64 `json:"node_id"`
AppId string `json:"app_id"`
AppName string `json:"app_name"`
Domain string `json:"domain"`
QType string `json:"qtype"`
ClientIP string `json:"client_ip"`
ClientRegion string `json:"client_region"`
Carrier string `json:"carrier"`
SDKVersion string `json:"sdk_version"`
OS string `json:"os"`
ResultIPs string `json:"result_ips"`
Status string `json:"status"`
ErrorCode string `json:"error_code"`
CostMs int32 `json:"cost_ms"`
CreatedAt int64 `json:"created_at"`
Day string `json:"day"`
Summary string `json:"summary"`
}
// FromPBAccessLog 将 pb.HTTPDNSAccessLog 转为本地 ingest 结构。
func FromPBAccessLog(log *pb.HTTPDNSAccessLog) *HTTPDNSIngestLog {
if log == nil {
return nil
}
return &HTTPDNSIngestLog{
Timestamp: log.GetCreatedAt(),
RequestId: log.GetRequestId(),
ClusterId: log.GetClusterId(),
NodeId: log.GetNodeId(),
AppId: log.GetAppId(),
AppName: log.GetAppName(),
Domain: log.GetDomain(),
QType: log.GetQtype(),
ClientIP: log.GetClientIP(),
ClientRegion: log.GetClientRegion(),
Carrier: log.GetCarrier(),
SDKVersion: log.GetSdkVersion(),
OS: log.GetOs(),
ResultIPs: log.GetResultIPs(),
Status: log.GetStatus(),
ErrorCode: log.GetErrorCode(),
CostMs: log.GetCostMs(),
CreatedAt: log.GetCreatedAt(),
Day: log.GetDay(),
Summary: log.GetSummary(),
}
}