本文整理汇总了Golang中github.com/ryandotsmith/l2met/bucket.Id.Name方法的典型用法代码示例。如果您正苦于以下问题:Golang Id.Name方法的具体用法?Golang Id.Name怎么用?Golang Id.Name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/ryandotsmith/l2met/bucket.Id
的用法示例。
在下文中一共展示了Id.Name方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: handleHkRouter
func (p *parser) handleHkRouter(t *tuple) error {
if string(p.lr.Header().Procid) != routerPrefix {
return nil
}
id := new(bucket.Id)
id.Resolution = p.Resolution()
id.Time = p.Time()
id.User = p.User()
id.Pass = p.Pass()
id.Source = p.ld.Source()
id.Units = t.Units()
switch t.Name() {
case "bytes":
id.Name = p.Prefix("router.bytes")
case "connect":
id.Name = p.Prefix("router.connect")
case "service":
id.Name = p.Prefix("router.service")
default:
return nil
}
val, err := t.Float64()
if err != nil {
return err
}
p.out <- &bucket.Bucket{Id: id, Vals: []float64{val}}
return nil
}
示例2: testBucket
func testBucket(name, source, user, pass string, t time.Time, res time.Duration, vals []float64) *bucket.Bucket {
id := new(bucket.Id)
id.Name = name
id.Source = source
id.User = user
id.Pass = pass
id.Time = t.Truncate(res)
id.Resolution = res
return &bucket.Bucket{Id: id, Vals: vals}
}
示例3: buildId
func (p *parser) buildId(id *bucket.Id, t *tuple) {
id.Resolution = p.Resolution()
id.Time = p.Time()
id.Auth = p.Auth()
id.ReadyAt = id.Time.Add(id.Resolution).Truncate(id.Resolution)
id.Name = p.Prefix(t.Name())
id.Units = t.Units()
id.Source = p.SourcePrefix(p.ld.Source())
return
}
示例4: buildId
func (p *parser) buildId(id *bucket.Id, t *tuple) {
id.Resolution = p.Resolution()
id.Time = p.Time()
id.User = p.User()
id.Pass = p.Pass()
id.Name = p.Prefix(t.Name())
id.Units = t.Units()
id.Source = p.ld.Source()
return
}
示例5: handleHkRouter
func (p *parser) handleHkRouter(t *tuple) error {
if string(p.lr.Header().Procid) != routerPrefix {
return nil
}
id := new(bucket.Id)
p.buildId(id, t)
id.Type = "measurement"
switch t.Name() {
case "bytes":
id.Name = p.Prefix("router.bytes")
case "connect":
id.Name = p.Prefix("router.connect")
case "service":
id.Name = p.Prefix("router.service")
default:
return nil
}
val, err := t.Float64()
if err != nil {
return err
}
p.out <- &bucket.Bucket{Id: id, Vals: []float64{val}}
return nil
}
示例6: handlMeasurements
func (p *parser) handlMeasurements(t *tuple) error {
if !strings.HasPrefix(t.Name(), measurePrefix) {
return nil
}
id := new(bucket.Id)
id.Resolution = p.Resolution()
id.Time = p.Time()
id.User = p.User()
id.Pass = p.Pass()
id.Name = p.Prefix(t.Name())
id.Units = t.Units()
id.Source = p.ld.Source()
val, err := t.Float64()
if err != nil {
return err
}
p.out <- &bucket.Bucket{Id: id, Vals: []float64{val}}
return nil
}