Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Publisher ¶
type Publisher struct{}
Publisher implements canary.Publisher, and is our gateway for delivering canary.Measurement data to STDOUT.
func (*Publisher) Publish ¶
func (p *Publisher) Publish(m sensor.Measurement) (err error)
Publish takes a canary.Measurement and emits data to STDOUT.
Example ¶
url, _ := sampler.NewJsonURL("http://www.canary.io")
target := sampler.Target{
URL: *url,
}
t1, _ := time.Parse(time.RFC3339, "2014-12-28T00:00:00Z")
t2, _ := time.Parse(time.RFC3339, "2014-12-28T00:00:01Z")
sample := sampler.Sample{
TimeStart: t1,
TimeEnd: t2,
StatusCode: 200,
}
p := New()
p.Publish(sensor.Measurement{
Target: target,
Sample: sample,
IsOK: true,
StateCount: 2,
})
Output: 2014-12-28T00:00:01Z http://www.canary.io 200 1000.000000 true 2
Click to show internal directories.
Click to hide internal directories.