Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

571 B
Raw Blame
package memory

import (
	"strconv"
	"sync/atomic"
	"time"
)

// nextSequencedID mints prefix + local wall-clock second + "-" + the next value
// of seq. Each sequence is package-level and shared by every store in the
// process, including one store per tenant monitor, so it must stay atomic.
// The suffix never wraps, so one sequence never repeats an ID within a process
// however many IDs share a second.
func nextSequencedID(prefix string, seq *atomic.Int64) string {
	return prefix + time.Now().Format("20060102150405") + "-" + strconv.FormatInt(seq.Add(1), 10)
}