fixed an issue of missing parameters to fmt.Errorf()

fixed the name composition for prometheus
This commit is contained in:
2025-02-24 10:34:22 +09:00
parent 5c2695e46b
commit 97885bcae1
5 changed files with 32 additions and 4 deletions

View File

@ -1,6 +1,7 @@
package hodu
import "runtime"
import "strings"
import "github.com/prometheus/client_golang/prometheus"
type ClientCollector struct {
@ -15,7 +16,8 @@ type ClientCollector struct {
func NewClientCollector(client *Client) ClientCollector {
var prefix string
prefix = client.Name() + "_"
// prometheus doesn't like a dash. change it to an underscore
prefix = strings.ReplaceAll(client.Name(), "-", "_") + "_"
return ClientCollector{
client: client,