Pulse/internal/mock/truenas_metrics_identity.go
rcourtman faefe6edc8 Remove 198 unreachable Go functions
Dead-code sweep. Functions flagged unreachable by golang.org/x/tools/cmd/deadcode
and confirmed unused across pulse, pulse-enterprise, pulse-pro and pulse-mobile by
adversarial cross-repo verification. Cross-module reachability was checked
explicitly (only pkg/ exported symbols are importable by other modules; internal/
packages and _test.go files are not). go build, go vet and test-compile all pass.
2026-06-03 12:29:37 +01:00

38 lines
934 B
Go

package mock
import (
"strings"
"github.com/rcourtman/pulse-go-rewrite/internal/truenas"
)
func TrueNASPoolMetricID(hostname string, pool string) string {
return TrueNASScopedMetricID(hostname, "pool:"+strings.TrimSpace(pool))
}
func TrueNASDatasetMetricID(hostname string, dataset string) string {
return TrueNASScopedMetricID(hostname, "dataset:"+strings.TrimSpace(dataset))
}
func TrueNASAppMetricID(hostname string, app truenas.App) string {
appID := strings.TrimSpace(app.ID)
if appID == "" {
appID = strings.TrimSpace(app.Name)
}
if appID == "" {
return ""
}
return TrueNASScopedMetricID(hostname, "app:"+appID)
}
func TrueNASScopedMetricID(hostname string, sourceID string) string {
hostname = strings.TrimSpace(hostname)
sourceID = strings.TrimSpace(sourceID)
if hostname == "" {
return sourceID
}
if sourceID == "" {
return "system:" + hostname
}
return "system:" + hostname + "/" + sourceID
}