Documentation ¶
Overview ¶
The stathat package makes it easy to post any values to your StatHat account.
Index ¶
- Variables
- func PostCount(statKey, userKey string, count int) error
- func PostCountOne(statKey, userKey string) error
- func PostCountTime(statKey, userKey string, count int, timestamp int64) error
- func PostEZCount(statName, ezkey string, count int) error
- func PostEZCountOne(statName, ezkey string) error
- func PostEZCountTime(statName, ezkey string, count int, timestamp int64) error
- func PostEZValue(statName, ezkey string, value float64) error
- func PostEZValueTime(statName, ezkey string, value float64, timestamp int64) error
- func PostValue(statKey, userKey string, value float64) error
- func PostValueTime(statKey, userKey string, value float64, timestamp int64) error
- func WaitUntilFinished(timeout time.Duration) bool
- type Reporter
- func (r *Reporter) PostCount(statKey, userKey string, count int) error
- func (r *Reporter) PostCountOne(statKey, userKey string) error
- func (r *Reporter) PostCountTime(statKey, userKey string, count int, timestamp int64) error
- func (r *Reporter) PostEZCount(statName, ezkey string, count int) error
- func (r *Reporter) PostEZCountOne(statName, ezkey string) error
- func (r *Reporter) PostEZCountTime(statName, ezkey string, count int, timestamp int64) error
- func (r *Reporter) PostEZValue(statName, ezkey string, value float64) error
- func (r *Reporter) PostEZValueTime(statName, ezkey string, value float64, timestamp int64) error
- func (r *Reporter) PostValue(statKey, userKey string, value float64) error
- func (r *Reporter) PostValueTime(statKey, userKey string, value float64, timestamp int64) error
- func (r *Reporter) WaitUntilFinished(timeout time.Duration) bool
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultReporter = NewReporter(100000, 10, nil)
DefaultReporter is the default instance of *Reporter.
var Verbose = false
The Verbose flag determines if the package should write verbose output to stdout.
Functions ¶
func PostCountOne ¶
Using the classic API, posts a count of 1 to a stat using DefaultReporter.
func PostCountTime ¶
Using the classic API, posts a count to a stat using DefaultReporter at a specific time.
func PostEZCount ¶
Using the EZ API, posts a count to a stat using DefaultReporter.
func PostEZCountOne ¶
Using the EZ API, posts a count of 1 to a stat using DefaultReporter.
Example ¶
log.Printf("starting example") stathat.Verbose = true err := stathat.PostEZCountOne("go example test run", "patrick@stathat.com") if err != nil { log.Printf("error posting ez count one: %v", err) return } ok := stathat.WaitUntilFinished(5 * time.Second) if ok { fmt.Println("ok") }
Output: ok
func PostEZCountTime ¶
Using the EZ API, posts a count to a stat at a specific time using DefaultReporter.
func PostEZValue ¶
Using the EZ API, posts a value to a stat using DefaultReporter.
func PostEZValueTime ¶
Using the EZ API, posts a value to a stat at a specific time using DefaultReporter.
func PostValueTime ¶
Using the classic API, posts a value to a stat at a specific time using DefaultReporter.
func WaitUntilFinished ¶
Wait for all stats to be sent, or until timeout. Useful for simple command- line apps to defer a call to this in main()
Types ¶
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter is a StatHat client that can report stat values/counts to the servers.
func NewReporter ¶
func NewReporter(bufferSize, poolSize int, transport http.RoundTripper) *Reporter
NewReporter returns a new Reporter. You must specify the channel bufferSize and the goroutine poolSize. You can pass in nil for the transport and it will use the default http transport.
func (*Reporter) PostCountOne ¶
Using the classic API, posts a count of 1 to a stat.
func (*Reporter) PostCountTime ¶
Using the classic API, posts a count to a stat at a specific time.
func (*Reporter) PostEZCount ¶
Using the EZ API, posts a count to a stat.
func (*Reporter) PostEZCountOne ¶
Using the EZ API, posts a count of 1 to a stat.
func (*Reporter) PostEZCountTime ¶
Using the EZ API, posts a count to a stat at a specific time.
func (*Reporter) PostEZValue ¶
Using the EZ API, posts a value to a stat.
func (*Reporter) PostEZValueTime ¶
Using the EZ API, posts a value to a stat at a specific time.
func (*Reporter) PostValueTime ¶
Using the classic API, posts a value to a stat at a specific time.