refactor: clean up logger and metric initialization flow

This commit is contained in:
yusing
2025-03-29 02:55:26 +08:00
parent 366c89164f
commit 1c001ed9df
6 changed files with 27 additions and 32 deletions

View File

@@ -35,11 +35,6 @@ type (
var (
clientMap = make(map[string]*SharedClient, 10)
clientMapMu sync.RWMutex
clientOptEnvHost = []client.Opt{
client.WithHostFromEnv(),
client.WithAPIVersionNegotiation(),
}
)
const (
@@ -151,7 +146,10 @@ func NewClient(host string) (*SharedClient, error) {
case "":
return nil, errors.New("empty docker host")
case common.DockerHostFromEnv:
opt = clientOptEnvHost
opt = []client.Opt{
client.WithHostFromEnv(),
client.WithAPIVersionNegotiation(),
}
default:
helper, err := connhelper.GetConnectionHelper(host)
if err != nil {