Skip to content

Commit

Permalink
recomend to allways set Label
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Moskalev committed Dec 30, 2023
1 parent 4840ce4 commit e0498a6
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
.idea
/.idea
/.vscode
.DS_STORE
.DS_Store
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import (

ctx := context.Background()
cfg := sarama.NewConfig()
err := saramaprom.ExportMetrics(ctx, cfg.MetricRegistry, saramaprom.Options{})
err := saramaprom.ExportMetrics(ctx, cfg.MetricRegistry, saramaprom.Options{
Label: "some name to distinguish between different sarama instances",
})
```

Posible options:
Expand All @@ -38,7 +40,9 @@ type Options struct {
Namespace string
Subsystem string

// Label specifies value of "label" label. Default "".
// Label specifies value of "label" label. It is recomended
// to always set the label to avoid collisions between sarama
// instances. Default "".
Label string

// FlushInterval specifies interval between updating metrics. Default 1s.
Expand Down
4 changes: 3 additions & 1 deletion saramaprom.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ type Options struct {
Namespace string
Subsystem string

// Label specifies value of "label" label. Default "".
// Label specifies value of "label" label. It is recomended
// to always set the label to avoid collisions between sarama
// instances. Default "".
Label string

// FlushInterval specifies interval between updating metrics. Default 1s.
Expand Down
3 changes: 1 addition & 2 deletions saramaprom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import (
"testing"
"time"

"github.com/iimos/saramaprom"
"github.com/prometheus/client_golang/prometheus"
"github.com/rcrowley/go-metrics"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/iimos/saramaprom"
)

func TestMetricCreation(t *testing.T) {
Expand Down

0 comments on commit e0498a6

Please sign in to comment.