bolty-0.1.0.0: src/Database/Bolty/Logging.hs
-- | Query logging types for observability.
module Database.Bolty.Logging
( QueryLog(..)
) where
import Data.Int (Int64)
import Data.Kind (Type)
import qualified Data.HashMap.Lazy as H
import qualified Data.Text as T
import Data.PackStream.Ps (Ps)
-- | Information about a completed query, passed to the 'queryLogger' callback.
type QueryLog :: Type
data QueryLog = QueryLog
{ qlCypher :: !T.Text
-- ^ The Cypher query text.
, qlParameters :: !(H.HashMap T.Text Ps)
-- ^ The query parameters (empty map if none).
, qlRowCount :: !Int
-- ^ Number of result records returned.
-- Server-reported timing
, qlServerFirst :: !Int64
-- ^ @t_first@: milliseconds until the first record was available on the server.
, qlServerLast :: !Int64
-- ^ @t_last@: milliseconds until the last record was consumed on the server.
-- Client-measured timing
, qlClientTime :: !Double
-- ^ Wall-clock milliseconds for the full round-trip (RUN send to PULL complete),
-- measured with 'GHC.Clock.getMonotonicTimeNSec'. Includes network latency,
-- serialization, and deserialization overhead.
}
deriving stock (Show)