Documentation
¶
Overview ¶
Package userid exposes the persistent UUID identifying this cagent installation. The value is stored in `$configDir/user-uuid`, generated lazily on first use, and shared across cagent runs on the same machine.
It is consumed both by telemetry (as the `user_uuid` event property) and by the HTTP transport (as the `X-Cagent-Id` header on gateway-bound requests) so that the gateway can correlate calls made by the same cagent install without having to invent a new identifier.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
func Get() string
Get returns the persistent UUID identifying this cagent installation.
On the first call it tries to read the value from `$configDir/user-uuid`; if the file does not exist, is empty, or cannot be read, a fresh UUID is generated and persisted (best effort). The result is cached in memory for the lifetime of the process so subsequent calls do not touch the filesystem.
func ResetForTests ¶
func ResetForTests()
ResetForTests clears the in-memory cache. Tests in any package that rely on a deterministic config dir override should call this after paths.SetConfigDir to force the next Get call to re-read from disk.
Types ¶
This section is empty.