github.com/Psiphon-Inc/goarista@v0.0.0-20160825065156-d002785f4c67/cmd/octsdb/text.go (about)

     1  // Copyright (C) 2016  Arista Networks, Inc.
     2  // Use of this source code is governed by the Apache License 2.0
     3  // that can be found in the COPYING file.
     4  
     5  package main
     6  
     7  import "fmt"
     8  
     9  type textDumper struct{}
    10  
    11  func newTextDumper() OpenTSDBConn {
    12  	return textDumper{}
    13  }
    14  
    15  func (t textDumper) Put(d *DataPoint) error {
    16  	var tags string
    17  	if len(d.Tags) != 0 {
    18  		for tag, value := range d.Tags {
    19  			tags += " " + tag + "=" + value
    20  		}
    21  	}
    22  	fmt.Printf("put %s %d %#v%s\n", d.Metric, d.Timestamp, d.Value, tags)
    23  	return nil
    24  }