Environment.md
PuduLangLog.Enrichers.Environment
type: module path: "@root/src/PuduLangLog/Enrichers/Environment.pudu" fidelity: Active grammar: "[[grammar/pudu]]" depth_score: 0.5 depth_status: MEDIUM tags: [module, enricher] aliases: [PuduLangLog.Enrichers.Environment]
Purpose
[[domain/Enrichment|Enrichers]] describing where an event came from — the machine, the user, the deployment environment, and the process — and one that stores an event's failure as structured data.
Interface
Signatures
export const ENVIRONMENT_VARIABLE: Str = "PUDU_ENVIRONMENT"
export fn machineName() -> Enricher.Enricher
export fn environmentUserName() -> Enricher.Enricher
export fn environmentName(variable: Str) -> Enricher.Enricher
export fn processId() -> Enricher.Enricher
export fn processName() -> Enricher.Enricher
export fn environmentVariable(variable: Str) -> Enricher.Enricher
export fn failureDetail() -> Enricher.EnricherLinkage
- Requires: [[src/PuduLangLog]], [[src/PuduLangLog/Enricher]],
Std.Env,Std.Process,Std.Result. - Consumed by: package users and settings.
Algorithm
machineNamereadsHOSTNAMEorCOMPUTERNAME, falling back to thehostnamecommand.environmentUserNamereadsUSERorUSERNAME;environmentNamereads the named variable,Productionwhen unset or blank.processIdasks a short-lived shell for its parent's identifier, which is this process.- Each value is read once, when the enricher is made, and added unless the event already names it.
failureDetailaddsFailureDetail, the failure as a structure tagged with its kind, holdingKind,Message,Trace, andCauses, or null when there is none.
Negative Logic (Prohibited Paths)
- No enricher runs a command or reads a variable per event.
Edge Cases
- A process identifier that cannot be read is null.
Depth
DEPTH 0.5 (MEDIUM). Tested by test/PuduLangLog/Enrichers/EnvironmentTest.
Grill Log
- Q: Why no thread identifier or process name? A: Pudu exposes neither a thread's identity nor the executable's name; an enricher inventing one would mislead. _Rejected:_ a counter posing as a thread id.
- Q: Why read values once? A: They do not change while a process runs, and reading per event would run a command per event. _Rejected:_ lazy per-event reads.
Referenced by
[[src/PuduLangLog/_MOC]] · [[src/PuduLangLog/Settings/Registry]] · [[subsystems/Pipeline]]
