RunLabels
AgentPrism.Abstractions.dllThe limits a run’s attribution must obey, and the single place they are enforced.
public static class RunLabelsInheritance
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”Labels answer “which job was this run made for”. They are a small
string-to-string map, kept deliberately small: a run label is
a query dimension, and an unbounded set of them turns every breakdown query
into a scan over an unbounded key space.
Breaking a limit REJECTS the value; it is never trimmed. A trimmed label set still looks like a complete measurement to whoever reads the report later, and that is worse than an error at the boundary.
Fields
Section titled “Fields”MaxCount
Section titled “ MaxCount”The largest number of labels one run may carry.
public const int MaxCount = 8Field Value
Section titled “Field Value”MaxKeyLength
Section titled “ MaxKeyLength”The largest length of a label key.
public const int MaxKeyLength = 64Field Value
Section titled “Field Value”Remarks
Section titled “Remarks”A key is usable as a breakdown dimension, so it stays short enough to group by.
MaxUserIdLength
Section titled “ MaxUserIdLength”The largest length of a user identity.
public const int MaxUserIdLength = 200Field Value
Section titled “Field Value”Remarks
Section titled “Remarks”The value is stored in an INDEXED column. SQL Server cannot index
nvarchar(max), so every indexed key column in this schema is
bounded at 200 characters; the limit here matches that column.
MaxValueLength
Section titled “ MaxValueLength”The largest length of a label value.
public const int MaxValueLength = 256Field Value
Section titled “Field Value”Remarks
Section titled “Remarks”This is not a free-text store; longer content belongs in the run’s own event stream.
Methods
Section titled “Methods”Freeze(IReadOnlyDictionary<string, string>)
Section titled “ Freeze(IReadOnlyDictionary<string, string>)”Copies a label set into an immutable, ordinally compared dictionary.
public static IReadOnlyDictionary<string, string> Freeze(IReadOnlyDictionary<string, string> labels)Parameters
Section titled “Parameters”labels IReadOnlyDictionary<string, string>
The labels to copy.
Returns
Section titled “Returns”IReadOnlyDictionary<string, string>
A snapshot that later writes to the source cannot change.
Remarks
Section titled “Remarks”The caller’s dictionary may be mutable and may even be a live request object; a run record must not change under the reader after the run ends.
Exceptions
Section titled “Exceptions”labels is null.
Validate(string?, IReadOnlyDictionary<string, string>?)
Section titled “ Validate(string?, IReadOnlyDictionary<string, string>?)”Checks a complete attribution.
public static string? Validate(string? userId, IReadOnlyDictionary<string, string>? labels)Parameters
Section titled “Parameters”userId string?
The user identity, or null.
labels IReadOnlyDictionary<string, string>?
The labels, or null.
Returns
Section titled “Returns”null when the value is acceptable, otherwise a message naming the limit that was broken.
ValidateLabels(IReadOnlyDictionary<string, string>?)
Section titled “ ValidateLabels(IReadOnlyDictionary<string, string>?)”Checks a label set on its own.
public static string? ValidateLabels(IReadOnlyDictionary<string, string>? labels)Parameters
Section titled “Parameters”labels IReadOnlyDictionary<string, string>?
The labels, or null.
Returns
Section titled “Returns”null when the value is acceptable, otherwise a message.
ValidateUserId(string?)
Section titled “ ValidateUserId(string?)”Checks a user identity on its own.
public static string? ValidateUserId(string? userId)Parameters
Section titled “Parameters”userId string?
The user identity, or null.
Returns
Section titled “Returns”null when the value is acceptable, otherwise a message.