childe / gohangout

使用 golang 模仿的 Logstash。用于消费 Kafka 数据,处理后写入 ES、Clickhouse 等。
MIT License
1.01k stars 234 forks source link

--worker 大于1的时候,prometheus panic #195

Closed childe closed 1 year ago

childe commented 1 year ago
build/gohangout --config t.yaml --prometheus 127.0.0.1:10000 -worker 3
panic: duplicate metrics collector registration attempted

goroutine 37 [running]:
github.com/prometheus/client_golang/prometheus.(*Registry).MustRegister(0x140002c1378?, {0x1400031a540?, 0x1, 0x0?})
    /usr/local/lib/go/pkg/mod/github.com/prometheus/client_golang@v1.12.1/prometheus/registry.go:403 +0x84
github.com/prometheus/client_golang/prometheus/promauto.Factory.NewCounter({{0x100b81710?, 0x140002bc460?}}, {{0x140002c1378, 0x6}, {0x0, 0x0}, {0x14000138e40, 0x14}, {0x1400014a5d0, 0x23}, ...})
    /usr/local/lib/go/pkg/mod/github.com/prometheus/client_golang@v1.12.1/prometheus/promauto/auto.go:265 +0xf4
github.com/prometheus/client_golang/prometheus/promauto.NewCounter(...)
    /usr/local/lib/go/pkg/mod/github.com/prometheus/client_golang@v1.12.1/prometheus/promauto/auto.go:168
github.com/childe/gohangout/topology.GetPromCounter(0x140002e23c0?)
    /usr/local/lib/go/src/github.com/childe/gohangout/topology/prom_counter.go:19 +0x13c
github.com/childe/gohangout/topology.NewFilterBox(0x140002e8ea0)
    /usr/local/lib/go/src/github.com/childe/gohangout/topology/filter.go:36 +0x48
github.com/childe/gohangout/topology.BuildFilterBoxes(0x0?, 0x100b75478)
    /usr/local/lib/go/src/github.com/childe/gohangout/topology/filter.go:138 +0x210
github.com/childe/gohangout/input.(*InputBox).buildTopology(0x140002f8a10, 0x2)
    /usr/local/lib/go/src/github.com/childe/gohangout/input/input_box.go:108 +0xe0
github.com/childe/gohangout/input.(*InputBox).beat(0x140002f8a10, 0x0?)
    /usr/local/lib/go/src/github.com/childe/gohangout/input/input_box.go:66 +0x24
created by github.com/childe/gohangout/input.(*InputBox).Beat
    /usr/local/lib/go/src/github.com/childe/gohangout/input/input_box.go:135 +0x80