-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle duplicate prometheus metrics registrations (#192)
Handle adding prometheus metrics in the same way that honeycomb metrics class works. Surprised that no one else has run into this! Another thing we could do here in addition to this: we could append the dataset that the sampler is for to the metrics so that they should all be unique
- Loading branch information
Showing
2 changed files
with
36 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// +build all race | ||
|
||
package metrics | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/honeycombio/refinery/config" | ||
"github.com/honeycombio/refinery/logger" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestMultipleRegistrations(t *testing.T) { | ||
p := &PromMetrics{ | ||
Logger: &logger.MockLogger{}, | ||
Config: &config.MockConfig{}, | ||
} | ||
|
||
err := p.Start() | ||
|
||
assert.NoError(t, err) | ||
|
||
p.Register("test", "counter") | ||
|
||
p.Register("test", "counter") | ||
} |