package model import "time" // TraceDataSource 链路追踪数据源(Jaeger / Tempo) // Logan.Li type TraceDataSource struct { ID uint `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"` Name string `gorm:"type:varchar(128);not null;uniqueIndex;comment:数据源名称" json:"name"` Type string `gorm:"type:varchar(32);not null;index;comment:类型 jaeger/tempo" json:"type"` URL string `gorm:"type:varchar(512);not null;comment:服务地址" json:"url"` BasicAuth bool `gorm:"default:false;comment:基础认证" json:"basic_auth"` BasicAuthUser string `gorm:"type:varchar(128);comment:认证用户名" json:"basic_auth_user,omitempty"` BasicAuthPass string `gorm:"type:varchar(256);comment:认证密码" json:"basic_auth_pass,omitempty"` SkipTLSVerify bool `gorm:"default:false;comment:跳过TLS验证" json:"skip_tls_verify"` IsDefault bool `gorm:"default:false;index;comment:是否默认" json:"is_default"` Status int `gorm:"default:1;comment:状态 1启用 0禁用" json:"status"` CreatedAt time.Time `gorm:"not null;comment:创建时间" json:"created_at"` UpdatedAt time.Time `gorm:"not null;comment:更新时间" json:"updated_at"` DeletedAt *time.Time `gorm:"index;comment:删除时间" json:"deleted_at,omitempty"` } func (TraceDataSource) TableName() string { return "monitor_trace_datasources" } // CreateTraceDSReq 创建链路追踪数据源请求 type CreateTraceDSReq struct { Name string `json:"name" binding:"required"` Type string `json:"type" binding:"required"` URL string `json:"url" binding:"required"` BasicAuth bool `json:"basic_auth"` BasicAuthUser string `json:"basic_auth_user"` BasicAuthPass string `json:"basic_auth_pass"` SkipTLSVerify bool `json:"skip_tls_verify"` IsDefault bool `json:"is_default"` } // UpdateTraceDSReq 更新链路追踪数据源请求(partial update) type UpdateTraceDSReq struct { Name *string `json:"name"` Type *string `json:"type"` URL *string `json:"url"` BasicAuth *bool `json:"basic_auth"` BasicAuthUser *string `json:"basic_auth_user"` BasicAuthPass *string `json:"basic_auth_pass"` SkipTLSVerify *bool `json:"skip_tls_verify"` IsDefault *bool `json:"is_default"` Status *int `json:"status"` } // TestTraceDSReq 测试连接请求 type TestTraceDSReq struct { URL string `json:"url" binding:"required"` Type string `json:"type"` BasicAuth bool `json:"basic_auth"` BasicAuthUser string `json:"basic_auth_user"` BasicAuthPass string `json:"basic_auth_pass"` SkipTLSVerify bool `json:"skip_tls_verify"` }