Method Record
- Namespace
- QueryGuard
- Assembly
- QueryGuard.Core.dll
Record(QueryCommandKind, QueryFingerprint, TimeSpan, string?, int, bool, string?, IReadOnlyList<string>?, Func<string?>?)
Records one observed command and assigns it a sequence number.
public QueryRecord? Record(QueryCommandKind kind, QueryFingerprint fingerprint, TimeSpan duration, string? commandSource = null, int parameterCount = 0, bool isFailed = false, string? failureType = null, IReadOnlyList<string>? tags = null, Func<string?>? stackTraceProvider = null)
Parameters
kindQueryCommandKindThe kind of relational command.
fingerprintQueryFingerprintThe fingerprint of the normalized command text.
durationTimeSpanHow long the command took.
commandSourcestringThe EF Core command source, if the provider reported one.
parameterCountintHow many parameters the command declared.
isFailedboolWhether the command failed.
failureTypestringThe exception type name when the command failed.
tagsIReadOnlyList<string>Query tags recognized on the command.
stackTraceProviderFunc<string>Produces a raw stack trace, invoked only when stack-trace capture is enabled and this is the first occurrence of the fingerprint in this session. Passing a callback rather than a string is what keeps the default configuration free: with capture off, nothing is walked, formatted, or allocated.
Returns
- QueryRecord
The created record, or null when the session is already completed.
Remarks
A late record is dropped rather than throwing. This runs on the application's command path, and QueryGuard's contract is that observing never changes behavior: throwing here would turn a diagnostics race into an application failure. The drop is counted in DroppedRecordCount so it is visible rather than silent.
Exceptions
- ArgumentNullException
fingerprintis null.