refactor: remove useless code

This commit is contained in:
710leo 2021-08-12 17:41:57 +08:00
parent 42fc0527cb
commit 509e1ef00a
5 changed files with 0 additions and 262 deletions

View File

@ -1,19 +1,5 @@
package vos
// type History struct {
// Key string `json:"-"` // 用于计算event的hashid
// Metric string `json:"metric"` // 指标名
// Tags map[string]string `json:"tags,omitempty"` // endpoint/counter
// Granularity int `json:"-"` // alarm补齐数据时需要
// Points []*HistoryData `json:"points"` // 现场值
// }
// type HistoryData struct {
// Timestamp int64 `json:"timestamp"`
// Value JsonFloat `json:"value"`
// Extra string `json:"extra"`
// }
type HistoryPoints struct {
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
@ -30,31 +16,3 @@ type HistoryDataS []*HPoint
func (r HistoryDataS) Len() int { return len(r) }
func (r HistoryDataS) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
func (r HistoryDataS) Less(i, j int) bool { return r[i].Timestamp < r[j].Timestamp }
// func RRDData2HistoryData(datas []*RRDData) []*HistoryData {
// count := len(datas)
// historyDatas := make([]*HistoryData, 0, count)
// for i := count - 1; i >= 0; i-- {
// historyData := &HistoryData{
// Timestamp: datas[i].Timestamp,
// Value: datas[i].Value,
// }
// historyDatas = append(historyDatas, historyData)
// }
// return historyDatas
// }
// func HistoryData2RRDData(datas []*HistoryData) []*RRDData {
// count := len(datas)
// rrdDatas := make([]*RRDData, 0, count)
// for i := count - 1; i >= 0; i-- {
// data := &RRDData{
// Timestamp: datas[i].Timestamp,
// Value: datas[i].Value,
// }
// rrdDatas = append(rrdDatas, data)
// }
// return rrdDatas
// }

View File

@ -1,36 +0,0 @@
package vos
// type TsdbQueryResponse struct {
// Start int64 `json:"start"`
// End int64 `json:"end"`
// Endpoint string `json:"endpoint"`
// Nid string `json:"nid"`
// Counter string `json:"counter"`
// DsType string `json:"dstype"`
// Step int `json:"step"`
// Values []*RRDData `json:"values"`
// }
// type RRDData struct {
// Timestamp int64 `json:"timestamp"`
// Value JsonFloat `json:"value"`
// }
// type RRDValues []*RRDData
// func (r RRDValues) Len() int { return len(r) }
// func (r RRDValues) Swap(i, j int) { r[i], r[j] = r[j], r[i] }
// func (r RRDValues) Less(i, j int) bool { return r[i].Timestamp < r[j].Timestamp }
// func NewRRDData(ts int64, val float64) *RRDData {
// return &RRDData{Timestamp: ts, Value: JsonFloat(val)}
// }
// func (rrd *RRDData) String() string {
// return fmt.Sprintf(
// "<RRDData:Value:%v TS:%d %v>",
// rrd.Value,
// rrd.Timestamp,
// time.Unix(rrd.Timestamp, 0).Format("2006-01-02 15:04:05"),
// )
// }

View File

@ -1,7 +0,0 @@
package vos
// type Message struct {
// Tos []string `json:"tos"`
// Subject string `json:"subject"`
// Content string `json:"content"`
// }

View File

@ -122,38 +122,6 @@ func (m *MetricPoint) Tidy(now int64) error {
return nil
}
// func DictedTagstring(s string) map[string]string {
// if i := strings.Index(s, " "); i != -1 {
// s = strings.Replace(s, " ", "", -1)
// }
// rmap := make(map[string]string)
// if s == "" {
// return rmap
// }
// tags := strings.Split(s, ",")
// for _, tag := range tags {
// pair := strings.SplitN(tag, "=", 2)
// if len(pair) != 2 {
// continue
// }
// if pair[0] == "" {
// continue
// }
// if pair[1] == "" {
// rmap[pair[0]] = "nil"
// } else {
// rmap[pair[0]] = pair[1]
// }
// }
// return rmap
// }
func DictedTagList(tags []string) map[string]string {
rmap := make(map[string]string)
if len(tags) == 0 {

View File

@ -1,145 +0,0 @@
package vos
// type QueryData struct {
// Start int64 `json:"start"`
// End int64 `json:"end"`
// ConsolFunc string `json:"consolFunc"`
// Endpoints []string `json:"endpoints"`
// Nids []string `json:"nids"`
// Counters []string `json:"counters" description:"metric/tags"`
// Step int `json:"step"`
// DsType string `json:"dstype"`
// }
// type QueryDataForUI struct {
// Start int64 `json:"start"`
// End int64 `json:"end"`
// Metric string `json:"metric"`
// Endpoints []string `json:"endpoints"`
// Nids []string `json:"nids"`
// Tags []string `json:"tags"`
// Step int `json:"step"`
// DsType string `json:"dstype"`
// GroupKey []string `json:"groupKey"` //聚合维度
// AggrFunc string `json:"aggrFunc" description:"sum,avg,max,min"` //聚合计算
// ConsolFunc string `json:"consolFunc" description:"AVERAGE,MIN,MAX,LAST"`
// Comparisons []int64 `json:"comparisons"` //环比多少时间
// }
// type QueryDataForUIResp struct {
// Start int64 `json:"start"`
// End int64 `json:"end"`
// Endpoint string `json:"endpoint"`
// Nid string `json:"nid"`
// Counter string `json:"counter"`
// DsType string `json:"dstype"`
// Step int `json:"step"`
// Values []*RRDData `json:"values"`
// Comparison int64 `json:"comparison"`
// }
// type QueryDataResp struct {
// Data []*TsdbQueryResponse
// Msg string
// }
// judge 数据层 必须
// func (req *QueryData) Key() string {
// return req.Endpoints[0] + "/" + req.Counters[0]
// }
// func (resp *TsdbQueryResponse) Key() string {
// return resp.Endpoint + "/" + resp.Counter
// }
// type EndpointsRecv struct {
// Endpoints []string `json:"endpoints"`
// Nids []string `json:"nids"`
// Start int64 `json:"start" description:"inclusive"`
// End int64 `json:"end" description:"exclusive"`
// StartInclusive time.Time `json:"-"`
// EndExclusive time.Time `json:"-"`
// }
// func (p *EndpointsRecv) Validate() (err error) {
// p.StartInclusive, p.EndExclusive, err = timeRangeValidate(p.Start, p.End)
// return
// }
// type MetricResp struct {
// Metrics []string `json:"metrics"`
// }
// type EndpointMetricRecv struct {
// Endpoints []string `json:"endpoints"`
// Nids []string `json:"nids"`
// Metrics []string `json:"metrics"`
// Start int64 `json:"start" description:"inclusive"`
// End int64 `json:"end" description:"exclusive"`
// StartInclusive time.Time `json:"-"`
// EndExclusive time.Time `json:"-"`
// }
// func (p *EndpointMetricRecv) Validate() (err error) {
// p.StartInclusive, p.EndExclusive, err = timeRangeValidate(p.Start, p.End)
// return
// }
// type IndexTagkvResp struct {
// Endpoints []string `json:"endpoints"`
// Nids []string `json:"nids"`
// Metric string `json:"metric"`
// Tagkv []*TagPair `json:"tagkv"`
// }
// type CludeRecv struct {
// Endpoints []string `json:"endpoints"`
// Nids []string `json:"nids"`
// Metric string `json:"metric"`
// Include []*TagPair `json:"include"`
// Exclude []*TagPair `json:"exclude"`
// Start int64 `json:"start" description:"inclusive"`
// End int64 `json:"end" description:"exclusive"`
// StartInclusive time.Time `json:"-"`
// EndExclusive time.Time `json:"-"`
// }
// func (p *CludeRecv) Validate() (err error) {
// p.StartInclusive, p.EndExclusive, err = timeRangeValidate(p.Start, p.End)
// return
// }
// type XcludeResp struct {
// Endpoint string `json:"endpoint"`
// Nid string `json:"nid"`
// Metric string `json:"metric"`
// Tags []string `json:"tags"`
// Step int `json:"step"`
// DsType string `json:"dstype"`
// }
// type IndexByFullTagsRecv struct {
// Endpoints []string `json:"endpoints"`
// Nids []string `json:"nids"`
// Metric string `json:"metric"`
// Tagkv []TagPair `json:"tagkv"`
// Start int64 `json:"start" description:"inclusive"`
// End int64 `json:"end" description:"exclusive"`
// StartInclusive time.Time `json:"-"`
// EndExclusive time.Time `json:"-"`
// }
// func (p *IndexByFullTagsRecv) Validate() (err error) {
// p.StartInclusive, p.EndExclusive, err = timeRangeValidate(p.Start, p.End)
// return
// }
// type IndexByFullTagsResp struct {
// Endpoints []string `json:"endpoints"`
// Nids []string `json:"nids"`
// Metric string `json:"metric"`
// Tags []string `json:"tags"`
// Step int `json:"step"`
// DsType string `json:"dstype"`
// Count int `json:"count"`
// }