RunAttributionReader
AgentPrism.Abstractions.dllReads an IRunAttributionContext safely on a recording path.
public static class RunAttributionReaderInheritance
Section titled “Inheritance”Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”Every deep call site must go through this rather than touching the interface directly. Two guarantees are easy to lose and expensive to lose: a consumer implementation reaches into its own identity pipeline and can throw there, and it can return a value it never validated. Neither may take down a run that is already under way — observability does not break functionality. The loud rejection belongs at the boundaries where the value ENTERS (the HTTP endpoint answers 400, AmbientRunAttributionScope.Begin throws).
Methods
Section titled “Methods”Read(IRunAttributionContext?, Action<string, Exception?>?)
Section titled “ Read(IRunAttributionContext?, Action<string, Exception?>?)”Reads the current attribution, surviving a faulty implementation.
public static (string? UserId, IReadOnlyDictionary<string, string>? Labels) Read(IRunAttributionContext? context, Action<string, Exception?>? onFault = null)Parameters
Section titled “Parameters”context IRunAttributionContext?
The attribution context, or null when none is registered.
onFault Action<string, Exception?>?
Called with a description when the value is unusable, so the caller can log it with its own run identity. Never called on the happy path.
Returns
Section titled “Returns”(string? UserId, IReadOnlyDictionary<string, string>? Labels)
The user and a FROZEN copy of the labels, or (null, null) when
there is nothing usable. The copy matters: the caller’s dictionary may be
a live request object, and a run record must not change under whoever
reads it later.