Skip to content
This repository has been archived by the owner on Aug 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #8 from wavefrontHQ/sliu/fix-prefix-issue
Browse files Browse the repository at this point in the history
fix prefix issue
  • Loading branch information
vikramraman authored Jul 26, 2018
2 parents 75f94d7 + 7e28f73 commit 539b183
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func writeSingleMetricToDirect(c *WavefrontConfig, name string, metric interface
var points []string
key := EncodeKey(name, tags)

if c.Prefix != "" {
if !strings.HasSuffix(c.Prefix, ".") {
c.Prefix = strings.Join([]string{c.Prefix, "."}, "")
}
points = appendMetric(metric, key, c, points)
Expand All @@ -30,7 +30,7 @@ func writeRegistryAndFlushToDirect(c *WavefrontConfig) error {
var points []string
var retErr error // the last encountered error

if c.Prefix != "" {
if !strings.HasSuffix(c.Prefix, ".") {
c.Prefix = strings.Join([]string{c.Prefix, "."}, "")
}
c.Registry.Each(func(key string, metric interface{}) {
Expand Down
4 changes: 2 additions & 2 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func writeRegistryAndFlushToProxy(c *WavefrontConfig) error {
}
defer conn.Close()
w := bufio.NewWriter(conn)
if c.Prefix != "" {
if !strings.HasSuffix(c.Prefix, ".") {
c.Prefix = strings.Join([]string{c.Prefix, "."}, "")
}
c.Registry.Each(func(key string, metric interface{}) {
Expand All @@ -38,7 +38,7 @@ func writeSingleMetricToProxy(c *WavefrontConfig, name string, metric interface{
w := bufio.NewWriter(conn)

key := EncodeKey(name, tags)
if c.Prefix != "" {
if !strings.HasSuffix(c.Prefix, ".") {
c.Prefix = strings.Join([]string{c.Prefix, "."}, "")
}
WriteMetricAndFlush(w, metric, key, now, c)
Expand Down

0 comments on commit 539b183

Please sign in to comment.