1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Move time into the Telemetry module.

This commit is contained in:
Rob Rix 2018-04-04 11:24:15 -04:00
parent ca87d9cff9
commit e6c5d5d2d5
2 changed files with 6 additions and 6 deletions

View File

@ -92,12 +92,6 @@ readBlobPairs = send . ReadBlobPairs
writeToOutput :: Member TaskF effs => Either Handle FilePath -> B.ByteString -> Eff effs ()
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'.
parse :: Member TaskF effs => Parser term -> Blob -> Eff effs term
parse parser = send . Parse parser

View File

@ -21,6 +21,12 @@ writeLog level message pairs = send (WriteLog level message pairs)
writeStat :: Member Telemetry effs => Stat -> Eff effs ()
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.
type LogQueue = AsyncQueue Message Options