Pulse/internal/api/deprecation_metrics.go
2026-03-18 16:06:30 +00:00

28 lines
677 B
Go

package api
import (
"sync"
"time"
"github.com/rs/zerolog/log"
)
const legacyHostAliasLogInterval = 15 * time.Minute
var legacyHostAliasLastLogged sync.Map
func noteLegacyHostAliasUsage(aliasPath string) {
recordDeprecatedAPIUsage("host_agent_api_alias", aliasPath)
now := time.Now()
if lastRaw, ok := legacyHostAliasLastLogged.Load(aliasPath); ok {
if last, ok := lastRaw.(time.Time); ok && now.Sub(last) < legacyHostAliasLogInterval {
return
}
}
legacyHostAliasLastLogged.Store(aliasPath, now)
log.Warn().
Str("path", aliasPath).
Msg("Deprecated Unified Agent compatibility alias used; upgrade agents to canonical /api/agents/agent/* endpoints")
}