Skip to content

Commit

Permalink
fix: panic for unknown topic metric (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
321pranay authored May 24, 2024
1 parent 7546d5c commit 8fe2652
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion metrics/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func getCounterMap() map[string]CounterVec {
Help: "Number of events received in requests"}, []string{"conn_group", "event_type"})
counters["kafka_unknown_topic_failure_total"] = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "kafka_unknown_topic_failure_total",
Help: "Number of delivery failure caused by topic does not exist in kafka."}, []string{"topic", "event_type"})
Help: "Number of delivery failure caused by topic does not exist in kafka."}, []string{"topic", "event_type", "conn_group"})
counters["batches_read_total"] = prometheus.NewCounterVec(prometheus.CounterOpts{
Name: "batches_read_total",
Help: "Request count"}, []string{"status", "reason", "conn_group"})
Expand Down
4 changes: 2 additions & 2 deletions metrics/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ func (promSuite *PrometheusTestSuite) Test_Prometheus_Counter_Working() {
mockCounter1 := mockCounter{}
mockCounter2 := mockCounter{}
callArg1 := int64(35)
labels1 := map[string]string{"topic": "test", "event_type": "abc"}
promLabels1 := prometheus.Labels{"topic": "test", "event_type": "abc"}
labels1 := map[string]string{"topic": "test", "event_type": "abc", "conn_group": "--default--"}
promLabels1 := prometheus.Labels{"topic": "test", "event_type": "abc", "conn_group": "--default--"}
labels2 := map[string]string{"status": "success", "reason": "unknown", "conn_group": "abc"}
promLabels2 := prometheus.Labels{"status": "success", "reason": "unknown", "conn_group": "abc"}
var err error
Expand Down

0 comments on commit 8fe2652

Please sign in to comment.