Skip to content

Commit

Permalink
Riemann output: remove some of the object referencing/dereferencing
Browse files Browse the repository at this point in the history
  • Loading branch information
sparrc committed Nov 18, 2015
1 parent a8294c2 commit 1677dc4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions outputs/riemann/riemann.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Riemann struct {
URL string
Transport string

client raidman.Client
client *raidman.Client
}

var sampleConfig = `
Expand All @@ -31,7 +31,7 @@ func (r *Riemann) Connect() error {
return err
}

r.client = *c
r.client = c
return nil
}

Expand Down Expand Up @@ -68,10 +68,9 @@ func (r *Riemann) Write(points []*client.Point) error {
return nil
}

func buildEvent(p *client.Point) raidman.Event {
host := p.Tags()["host"]

if len(host) == 0 {
func buildEvent(p *client.Point) *raidman.Event {
host, ok := p.Tags()["host"]
if !ok {
hostname, err := os.Hostname()
if err != nil {
host = "unknown"
Expand All @@ -86,7 +85,7 @@ func buildEvent(p *client.Point) raidman.Event {
Metric: p.Fields()["value"],
}

return *event
return event
}

func init() {
Expand Down

0 comments on commit 1677dc4

Please sign in to comment.