mirror of
https://github.com/github/semantic.git
synced 2024-12-22 22:31:36 +03:00
Move time into the Telemetry module.
This commit is contained in:
parent
ca87d9cff9
commit
e6c5d5d2d5
@ -92,12 +92,6 @@ readBlobPairs = send . ReadBlobPairs
|
|||||||
writeToOutput :: Member TaskF effs => Either Handle FilePath -> B.ByteString -> Eff effs ()
|
writeToOutput :: Member TaskF effs => Either Handle FilePath -> B.ByteString -> Eff effs ()
|
||||||
writeToOutput path = send . WriteToOutput path
|
writeToOutput path = send . WriteToOutput path
|
||||||
|
|
||||||
-- | A task which measures and stats the timing of another task.
|
|
||||||
time :: Members '[Telemetry, IO] effs => String -> [(String, String)] -> Eff effs output -> Eff effs output
|
|
||||||
time statName tags task = do
|
|
||||||
(a, stat) <- withTiming statName tags task
|
|
||||||
a <$ writeStat stat
|
|
||||||
|
|
||||||
-- | A task which parses a 'Blob' with the given 'Parser'.
|
-- | A task which parses a 'Blob' with the given 'Parser'.
|
||||||
parse :: Member TaskF effs => Parser term -> Blob -> Eff effs term
|
parse :: Member TaskF effs => Parser term -> Blob -> Eff effs term
|
||||||
parse parser = send . Parse parser
|
parse parser = send . Parse parser
|
||||||
|
@ -21,6 +21,12 @@ writeLog level message pairs = send (WriteLog level message pairs)
|
|||||||
writeStat :: Member Telemetry effs => Stat -> Eff effs ()
|
writeStat :: Member Telemetry effs => Stat -> Eff effs ()
|
||||||
writeStat stat = send (WriteStat stat)
|
writeStat stat = send (WriteStat stat)
|
||||||
|
|
||||||
|
-- | A task which measures and stats the timing of another task.
|
||||||
|
time :: Members '[Telemetry, IO] effs => String -> [(String, String)] -> Eff effs output -> Eff effs output
|
||||||
|
time statName tags task = do
|
||||||
|
(a, stat) <- withTiming statName tags task
|
||||||
|
a <$ writeStat stat
|
||||||
|
|
||||||
|
|
||||||
-- | A queue for logging.
|
-- | A queue for logging.
|
||||||
type LogQueue = AsyncQueue Message Options
|
type LogQueue = AsyncQueue Message Options
|
||||||
|
Loading…
Reference in New Issue
Block a user