Files
telemetry/identifiable.go

33 lines
800 B
Go
Raw Normal View History

package telemetry
import (
"runtime/debug"
"code.nochebuena.dev/einherjar/contracts/observability"
)
// Module identifies this package to observability systems.
// telemetry bootstraps before the launcher and is not registered as a lifecycle
// component. Register Module manually with any version registry if needed.
var Module observability.Identifiable = &moduleID{}
type moduleID struct{}
const modulePath = "code.nochebuena.dev/einherjar/telemetry"
func (m *moduleID) ModulePath() string { return modulePath }
func (m *moduleID) ModuleVersion() string {
if info, ok := debug.ReadBuildInfo(); ok {
for _, dep := range info.Deps {
if dep.Path == modulePath {
return dep.Version
}
}
if info.Main.Path == modulePath {
return info.Main.Version
}
}
return "(devel)"
}