Skip to content

Commit

Permalink
Merge pull request open-falcon#1 from nieanan/master
Browse files Browse the repository at this point in the history
add model.nodata
  • Loading branch information
laiwei committed Oct 22, 2015
2 parents 6c2c250 + 13da58d commit 42c1665
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions model/nodata.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package model

import (
"fmt"
"github.com/open-falcon/common/utils"
ttime "github.com/toolkits/time"
)

type NodataItem struct {
Counter string `json:"counter"`
Ts int64 `json:"ts"`
FStatus string `json:"fstatus"`
FTs int64 `json:"fts"`
}

func (this *NodataItem) String() string {
return fmt.Sprintf("{NodataItem counter:%s ts:%s fecthStatus:%s fetchTs:%s}",
this.Counter, ttime.FormatTs(this.Ts), this.FStatus, ttime.FormatTs(this.FTs))
}

type NodataConfig struct {
Id int `json:"id"`
Name string `json:"name"`
ObjType string `json:"objType"`
Endpoint string `json:"endpoint"`
Metric string `json:"metric"`
Tags map[string]string `json:"tags"`
Type string `json:"type"`
Step int64 `json:"step"`
Mock float64 `json:"mock"`
}

func NewNodataConfig(id int, name string, objType string, endpoint string, metric string, tags map[string]string, dstype string, step int64, mock float64) *NodataConfig {
return &NodataConfig{id, name, objType, endpoint, metric, tags, dstype, step, mock}
}

func (this *NodataConfig) String() string {
return fmt.Sprintf("{NodataConfig id:%d, name:%s, objType:%s, endpoint:%s, metric:%s, tags:%s, type:%s, step:%d, mock:%f}",
this.Id, this.Name, this.ObjType, this.Endpoint, this.Metric, utils.SortedTags(this.Tags), this.Type, this.Step, this.Mock)
}

0 comments on commit 42c1665

Please sign in to comment.