Table of Contents

Class QueryObservability

Namespace
CL.MySQL2.Services
Assembly
CL.MySQL2.dll

Process-wide sink for query lifecycle notifications. Query pipelines call the lightweight Record* methods without needing an CodeLogic.Core.Events.IEventBus instance passed through. The library wires the sink to CodeLogic's event bus at init time.

public static class QueryObservability
Inheritance
QueryObservability
Inherited Members

Methods

Configure(IEventBus?, ILogger?)

Bind this sink to CodeLogic's event bus. Called by MySQL2Library.

public static void Configure(IEventBus? events, ILogger? logger)

Parameters

events IEventBus
logger ILogger

RecordCacheHit(string, string, string)

public static void RecordCacheHit(string connectionId, string tableName, string cacheKey)

Parameters

connectionId string
tableName string
cacheKey string

RecordCacheMiss(string, string, string)

public static void RecordCacheMiss(string connectionId, string tableName, string cacheKey)

Parameters

connectionId string
tableName string
cacheKey string

RecordExecuted(string, string, long, int, bool)

Fire QueryExecutedEvent; always, regardless of speed.

public static void RecordExecuted(string connectionId, string sql, long elapsedMs, int rowCount, bool cacheHit)

Parameters

connectionId string
sql string
elapsedMs long
rowCount int
cacheHit bool

RecordN1(string, string, int)

public static void RecordN1(string connectionId, string template, int count)

Parameters

connectionId string
template string
count int

RecordSlow(string, string, long, string?)

Fire SlowQueryEvent and log. explainJson is only included when the per-DB CaptureExplainOnSlowQuery flag is on and the caller has fetched the plan.

public static void RecordSlow(string connectionId, string sql, long elapsedMs, string? explainJson = null)

Parameters

connectionId string
sql string
elapsedMs long
explainJson string