package dto import ( "go-admin/app/observe/models" "go-admin/common/dto" common "go-admin/common/models" "strconv" "strings" ) type UrlMappingListResp struct { Id int `json:"id"` AppId string `json:"app_id"` AppAlias string `json:"app_alias"` Name string `json:"name"` Method string `json:"method"` Url string `json:"url"` Level string `json:"level"` IsPerfectMatch string `json:"is_perfect_match"` Type string `json:"type"` Module string `json:"module"` Summary string `json:"summary"` ServiceName string `json:"service_name"` ServiceNameCN string `json:"service_name_cn"` Favor string `json:"favor"` UrlMappingBaseStats DurationStats DurationStats `json:"duration_stats"` } type DurationStats struct { Time []string `json:"time"` P50 []float64 `json:"p50"` P90 []float64 `json:"p90"` P99 []float64 `json:"p99"` // Max []float64 `json:"max"` // Min []float64 `json:"min"` // Avg []float64 `json:"avg"` } type DurationStat struct { Time string `json:"time"` Max float64 `json:"max"` Avg float64 `json:"avg"` P50 float64 `json:"p50"` P90 float64 `json:"p90"` P99 float64 `json:"p99"` // Min float64 `json:"min"` } type UrlMappingBaseStats struct { Kind string `json:"kind"` Total int64 `json:"total"` Rpm float64 `json:"rpm"` ErrorNum int64 `json:"error_num"` ErrorRate float64 `json:"error_rate"` Max float64 `json:"max"` Min float64 `json:"min"` Avg float64 `json:"avg"` P50 float64 `json:"p50"` P90 float64 `json:"p90"` P99 float64 `json:"p99"` } type UrlMappingDetailStats struct { Kind string `json:"kind"` StartMinute string `json:"start_minute"` Total int64 `json:"total"` ErrorNum int64 `json:"error_num"` Max float64 `json:"max"` Min float64 `json:"min"` Avg float64 `json:"avg"` P50 float64 `json:"p50"` P90 float64 `json:"p90"` P99 float64 `json:"p99"` } type UrlMappingGetPageReq struct { AppId string `form:"app_id"` Url string `form:"url"` ServiceName string `form:"service_name"` Level string `form:"level"` dto.Pagination `search:"-"` models.TimeRange // Favor string `form:"favor"` // UrlMappingOrder } type UrlMappingOrder struct { Id string `form:"idOrder" search:"type:order;column:id;table:ot_url_mapping"` AppId string `form:"appIdOrder" search:"type:order;column:app_id;table:ot_url_mapping"` Name string `form:"nameOrder" search:"type:order;column:name;table:ot_url_mapping"` Url string `form:"urlOrder" search:"type:order;column:url;table:ot_url_mapping"` Type string `form:"typeOrder" search:"type:order;column:type;table:ot_url_mapping"` Module string `form:"moduleOrder" search:"type:order;column:module;table:ot_url_mapping"` Summary string `form:"summaryOrder" search:"type:order;column:summary;table:ot_url_mapping"` Favor string `form:"favorOrder" search:"type:order;column:favor;table:ot_url_mapping"` CreatedAt string `form:"createdAtOrder" search:"type:order;column:created_at;table:ot_url_mapping"` UpdatedAt string `form:"updatedAtOrder" search:"type:order;column:updated_at;table:ot_url_mapping"` DeletedAt string `form:"deletedAtOrder" search:"type:order;column:deleted_at;table:ot_url_mapping"` CreateBy string `form:"createByOrder" search:"type:order;column:create_by;table:ot_url_mapping"` UpdateBy string `form:"updateByOrder" search:"type:order;column:update_by;table:ot_url_mapping"` models.TimeRange } func (m *UrlMappingGetPageReq) GetNeedSearch() interface{} { return *m } type UrlMappingInsertReq struct { Id int `json:"-" comment:"主键id"` // 主键id AppId string `json:"app_id" comment:"应用id"` Name string `json:"name" comment:"url对应的名称"` Url string `json:"url" comment:"url"` Type string `json:"type" comment:"类型 0未知 1内部 2外部"` Module string `json:"module" comment:"所属模块"` Summary string `json:"summary" comment:"简要描述"` Favor string `json:"favor" comment:"收藏, 0未收藏 1已收藏"` common.ControlBy } func (s *UrlMappingInsertReq) Generate(model *models.UrlMapping) { if s.Id == 0 { model.ID = int64(s.Id) } appId, _ := strconv.Atoi(s.AppId) types, _ := strconv.Atoi(s.Type) favor, _ := strconv.Atoi(s.Favor) model.AppId = int64(appId) model.Name = s.Name model.Url = s.Url model.Type = int32(types) model.Module = s.Module model.Summary = s.Summary model.Favor = int32(favor) model.CreateBy = int64(s.CreateBy) // 添加这而,需要记录是被谁创建的 } func (s *UrlMappingInsertReq) GetId() interface{} { return s.Id } type UrlMappingUpdateReq struct { Id int `uri:"id" comment:"主键id"` // 主键id AppId string `json:"app_id" comment:"应用id"` Name string `json:"name" comment:"url对应的名称"` Url string `json:"url" comment:"url"` Type string `json:"type" comment:"类型 0未知 1内部 2外部"` Module string `json:"module" comment:"所属模块"` Summary string `json:"summary" comment:"简要描述"` Favor string `json:"favor" comment:"收藏, 0未收藏 1已收藏"` common.ControlBy } func (s *UrlMappingUpdateReq) Generate(model *models.UrlMapping) { if s.Id == 0 { model.ID = int64(s.Id) } appId, _ := strconv.Atoi(s.AppId) types, _ := strconv.Atoi(s.Type) favor, _ := strconv.Atoi(s.Favor) model.AppId = int64(appId) model.Name = s.Name // model.Url = s.Url // url不可修改 model.Type = int32(types) model.Module = s.Module model.Summary = s.Summary model.Favor = int32(favor) model.CreateBy = int64(s.CreateBy) } func (s *UrlMappingUpdateReq) GetId() interface{} { return s.Id } // OtUrlMappingGetReq 功能获取请求参数 type UrlMappingGetReq struct { Id int `uri:"id"` } func (s *UrlMappingGetReq) GetId() interface{} { return s.Id } // UrlMappingGetDetailReq 获取业务映射详情列表参数 type UrlMappingGetDetailReq struct { dto.Pagination `search:"-"` models.TimeRange // Id int `form:"id"` AppId int `form:"app_id"` Kind string `form:"kind"` // 字段已废弃, 使用Route代替 Route string `form:"route"` Method string `form:"method"` ServiceName string `form:"service_name"` OnlyError string `form:"only_error"` // 为保持与其它地方一致,此处废弃 OnlyException bool `form:"only_exception"` models.DurationRange models.SortInfo } type UrlMappingGetDetailResp struct { Datetime string `json:"datetime"` Timestamp int64 `json:"timestamp"` // 时间 Route string `json:"route"` // 匹配到的具体的uri Target string `json:"target"` // 匹配到的具体的uri,包括后面的参数 URL string `json:"url"` // 匹配到的完整的URL Flavor string `json:"flavor"` // http协议, 如1.1 Host string `json:"host"` // http host Method string `json:"method"` // http方法,如GET、POST StatusCode int64 `json:"status_code"` // http 状态码 Message string `json:"message"` // 信息,通常为错误信息 TraceID string `json:"trace_id"` // TraceId SpanID string `json:"span_id"` // SpanId ServiceName string `json:"service_name"` // 服务名 Duration int64 `json:"duration"` // 耗时 // SpanDetail *models.Trace `json:"span_detail"` } // OtUrlMappingDeleteReq 功能删除请求参数 type UrlMappingDeleteReq struct { Ids string `uri:"ids"` } type UrlMappingGetResp struct { AppId string `json:"app_id" comment:"应用id"` Name string `json:"name" comment:"url对应的名称"` Url string `json:"url" comment:"url"` Type string `json:"type" comment:"类型 0未知 1内部 2外部"` Module string `json:"module" comment:"所属模块"` Summary string `json:"summary" comment:"简要描述"` Favor string `json:"favor" comment:"收藏, 0未收藏 1已收藏"` } func (s *UrlMappingDeleteReq) GetIds() []string { ids := strings.Split(s.Ids, ",") return ids } type UrlMappingFavorReq struct { Id int `uri:"id"` Favor string `json:"favor"` } type UrlMappingSankeyReq struct { AppId string `form:"app_id"` models.AppPercentileRange models.TimeRange } type UrlMappingSankeyResp struct { Nodes []SankeyNode `json:"nodes"` Links []SankeyLink `json:"links"` } type SankeyNode struct { Name string `json:"name"` } type SankeyLink struct { Source string `json:"source"` Target string `json:"target"` Value int `json:"value"` } type UrlMappingGetFavorsReq struct { AppId string `form:"app_id"` models.TimeRange } type UrlMappingQualityReq struct { AppId string `form:"app_id"` UrlType string `form:"url_type"` // 类型 0未知 1内部 2外部 models.TimeRange } type UrlMappingQualityResp struct { Buckets []string `json:"buckets"` Current CountsQuantileIndexes `json:"current"` Previous CountsQuantileIndexes `json:"previous"` } type CountsQuantileIndexes struct { Counts []float64 `json:"counts"` QuantileIndexes map[string]int `json:"quantile_indexes"` } type UrlMappingErrorsReq struct { AppId string `form:"app_id"` UrlType string `form:"url_type"` // 类型 0未知 1内部 2外部 TimeType string `form:"time_type"` // minute hour day TimeValue int `form:"time_value"` // 数字,与time type相关联 TimeBase int `form:"time_base"` // 时间基础,时间戳,以该时间为基础,统计TimeValue+TimeType时间段 } type UrlMappingErrorsResp struct { Times []string `json:"times"` Totals []int64 `json:"totals"` } type UrlMappingSlowTopReq struct { AppId string `form:"app_id"` models.TimeRange Limit uint8 `form:"limit"` } type UrlMappingSlowTopResp struct { AppAlias string `json:"-"` Name string `json:"name"` Route string `json:"route"` Method string `json:"method"` ServiceName string `json:"service_name"` ServiceNameCN string `json:"service_name_cn"` ErrorRate float64 `json:"error_rate"` Duration float64 `json:"duration"` DurationStats DurationStats `json:"duration_stats"` } type UrlMappingSubDigitsReq struct { ID int64 `form:"id"` AppAlias string `form:"app_alias"` models.TimeRange } type UrlMappingSubDigitsResp struct { Total int64 `json:"total"` ErrorRate float64 `json:"error_rate"` QPM float64 `json:"qpm"` MedianDuration float64 `json:"median_duration"` MaxDuration float64 `json:"max_duration"` } type UrlMappingSubListReq struct { // ID int64 `form:"id"` AppAlias string `form:"app_alias"` ServiceName string `form:"service_name"` Url string `form:"url"` BizHash string `form:"biz_hash"` models.TimeRange dto.Pagination `search:"-"` } type UrlMappingSubListResp struct { ID int64 `json:"id"` Name string `json:"name"` Route string `json:"route"` Method string `json:"method"` ServiceName string `json:"service_name"` ServiceNameCN string `json:"service_name_cn"` Favor int `json:"favor"` Module string `json:"module"` Summary string `json:"summary"` AppAlias string `json:"app_alias"` Total int64 `json:"total"` ErrorRate float64 `json:"error_rate"` DurationStats DurationStats `json:"duration_stats"` } type UrlMappingChartReq struct { models.TimeRange AppAlias string `form:"app_alias"` ServiceName string `form:"service_name"` Method string `form:"method"` Route string `form:"route"` Type string `form:"type"` // request_trend 请求量; latency 时延; status_trend 状态请求量 } type UrlMappingChartResp struct { Times []string `json:"times"` Values map[string][]float64 `json:"values"` } type UrlMappingBaseInfoReq struct { AppAlias string `form:"app_alias"` ServiceName string `form:"service_name"` Url string `form:"url"` Method string `form:"method"` } type UrlMappingBaseInfoResp struct { ID int64 `json:"id"` Route string `json:"route"` Method string `json:"method"` AppAlias string `json:"app_alias"` AppName string `json:"app_name"` ServiceName string `json:"service_name"` ServiceNameCn string `json:"service_name_cn"` // BizID int64 `json:"biz_id"` // BizNodeID int64 `json:"biz_node_id"` } type UrlMappingMatchReq struct { AppAlias string `form:"app_alias"` ServiceName string `form:"service_name"` Url string `form:"url"` Method string `form:"method"` dto.Pagination } type UrlMappingMatchResp struct { AppAlias string `form:"app_alias"` ServiceName string `form:"service_name"` Route string `form:"route"` Method string `form:"method"` }