Table of Contents

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

kind QueryCommandKind

The kind of relational command.

fingerprint QueryFingerprint

The fingerprint of the normalized command text.

duration TimeSpan

How long the command took.

commandSource string

The EF Core command source, if the provider reported one.

parameterCount int

How many parameters the command declared.

isFailed bool

Whether the command failed.

failureType string

The exception type name when the command failed.

tags IReadOnlyList<string>

Query tags recognized on the command.

stackTraceProvider Func<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

fingerprint is null.