service.go 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. package dto
  2. import (
  3. "go-admin/app/observe/models"
  4. "go-admin/common/dto"
  5. common "go-admin/common/models"
  6. )
  7. type ServiceGetEdgesReq struct {
  8. models.TimeRange
  9. models.WatchLive
  10. AppAlias string `uri:"app_alias" form:"app_alias" json:"app_alias" comment:"应用别名"`
  11. }
  12. type ServiceEdgeRaw struct {
  13. SourceService string `ch:"SourceService"`
  14. TargetService string `ch:"TargetService"`
  15. RequestType string `ch:"RequestType"`
  16. TotalNum uint64 `ch:"TotalNum"`
  17. Qps float64 `ch:"Qps"`
  18. ErrorNum uint64 `ch:"ErrorNum"`
  19. ErrorRate float64 `ch:"ErrorRate"`
  20. DurationAverage float64 `ch:"DurationAverage"`
  21. DurationMedian float64 `ch:"DurationMedian"`
  22. DurationP90 float64 `ch:"DurationP90"`
  23. DurationP99 float64 `ch:"DurationP99"`
  24. Satisfied uint64 `ch:"Satisfied"`
  25. Tolerable uint64 `ch:"Tolerable"`
  26. Frustrated uint64 `ch:"Frustrated"`
  27. Apdex float64 `ch:"Apdex"`
  28. }
  29. type SerivceGraphNodeRaw struct {
  30. ServiceName string `ch:"ServiceName"`
  31. TraceNum uint64 `ch:"TraceNum"`
  32. SpanNum uint64 `ch:"SpanNum"`
  33. SentNum uint64 `ch:"SentNum"`
  34. ReceivedNum uint64 `ch:"ReceivedNum"`
  35. InternalNum uint64 `ch:"InternalNum"`
  36. ErrorNum uint64 `ch:"ErrorNum"`
  37. SdkLang string `ch:"SdkLang"`
  38. Apdex float64 `ch:"Apdex"`
  39. Satisfied uint64 `ch:"satisfied"`
  40. Tolerable uint64 `ch:"tolerable"`
  41. Frustrated uint64 `ch:"frustrated"`
  42. }
  43. type SpanScatterChartReq struct {
  44. models.TimeRange
  45. models.AppPercentileRange
  46. models.HourRange
  47. AppAlias string `form:"app_alias" json:"app_alias"`
  48. ServiceName string `form:"service_name" json:"service_name"`
  49. TraceId string `form:"trace_id" json:"trace_id"` //暂时无用
  50. }
  51. type ServiceSpansReq struct {
  52. models.TimeRange
  53. models.DurationRange
  54. dto.Pagination
  55. AppAlias string `form:"app_alias"`
  56. ServiceName []string `form:"service_name"`
  57. SpanName string `form:"span_name"`
  58. OnlyDatabase bool `form:"only_database"`
  59. OnlyException bool `form:"only_exception"`
  60. TraceId string `form:"trace_id"`
  61. SpanKind string `form:"span_kind"`
  62. SpanAttributeKey string `form:"span_attribute_key"`
  63. SpanAttributeValue string `form:"span_attribute_value"`
  64. RequestMethod string `form:"request_method"`
  65. models.SortInfo
  66. }
  67. type ServiceSpansResp struct {
  68. Datetime string `json:"datetime"`
  69. Timestamp int64 `json:"timestamp"`
  70. TraceId string `json:"trace_id"`
  71. SpanId string `json:"span_id"`
  72. ServiceName string `json:"service_name"`
  73. Method string `json:"method"`
  74. Code string `json:"code"`
  75. Duration float64 `json:"duration"`
  76. }
  77. type ServiceJobGenServiceResp struct {
  78. NodeResult CreateResult
  79. EdgeResult CreateResult
  80. }
  81. type CreateResult struct {
  82. Error string
  83. RowsAffected int64
  84. Total int
  85. }
  86. type ServiceListReq struct {
  87. AppId string `form:"app_id"`
  88. dto.Pagination
  89. }
  90. type ServiceUpdateReq struct {
  91. Id int `uri:"id" comment:"主键id"` // 主键id
  92. AppId int32 `json:"app_id" comment:"应用id"`
  93. Name string `json:"name" comment:"url对应的名称"`
  94. Kind string `json:"kind" comment:"服务主语言类型"`
  95. Type int32 `json:"type" comment:"类型 0.未知 1.对内服务 2.对外服务 3.两者都有"`
  96. common.ControlBy
  97. }
  98. func (s *ServiceUpdateReq) Generate(model *models.ServiceNode) {
  99. if s.Id == 0 {
  100. model.ID = int32(s.Id)
  101. }
  102. model.AppID = s.AppId
  103. model.Name = s.Name
  104. model.Type = s.Type
  105. }
  106. func (s *ServiceUpdateReq) GetId() interface{} {
  107. return s.Id
  108. }
  109. type ServiceListResp struct {
  110. ID int `json:"id"`
  111. Name string `json:"name"`
  112. ServiceName string `json:"service_name"`
  113. AppId int `json:"app_id"`
  114. Type int `json:"type"`
  115. Kind string `json:"kind"`
  116. }
  117. type ServiceListNoAppAliasReq struct {
  118. _ int `form:"_"` // 这个参数的目的是指明从form中获取参数,如果没有这个参数,下面两个结构体不能获取到数据
  119. models.TimeRange
  120. dto.Pagination
  121. }
  122. type ServiceListNoAppAliasResp struct {
  123. ServiceName string `json:"service_name"`
  124. TraceTotal int64 `json:"trace_total"`
  125. SpanTotal int64 `json:"span_total"`
  126. }
  127. type ServiceStatsReq struct {
  128. ID int64 `form:"id"`
  129. ServiceName string `form:"service_name"`
  130. AppAlias string `form:"app_alias"`
  131. models.TimeRange
  132. // dto.Pagination
  133. }
  134. type ServiceStatsResp struct {
  135. ID int64 `json:"id"`
  136. ServiceName string `json:"service_name"`
  137. Total int64 `json:"total"`
  138. Rpm float64 `json:"rpm"`
  139. ErrorNum int64 `json:"error_num"`
  140. ErrorRate float64 `json:"error_rate"`
  141. Max float64 `json:"max"`
  142. Avg float64 `json:"avg"`
  143. Quantiles Quantiles `json:"quantiles"` // 分位数统计信息
  144. }
  145. type ServiceDigitsReq struct {
  146. AppAlias string `form:"app_alias"`
  147. ServiceName string `form:"service_name"`
  148. }
  149. type ServiceDigitsResp struct {
  150. Span float64
  151. Trace float64
  152. Http float64
  153. Rpc float64
  154. DB float64
  155. Error float64
  156. }
  157. type ServiceComponentStats struct {
  158. Component string
  159. Total int64
  160. ReceivedNum int64
  161. SentNum int64
  162. ErrorNum int64
  163. }