mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-07 08:57:12 +00:00
28 lines
677 B
Go
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")
|
|
}
|