mirror of
https://github.com/github/semantic.git
synced 2024-12-01 00:33:59 +03:00
Custom logging and statting for http server
This commit is contained in:
parent
3b21774413
commit
985ac4ade9
@ -38,6 +38,7 @@ module Semantic.Task
|
|||||||
-- * Interpreting
|
-- * Interpreting
|
||||||
, runTask
|
, runTask
|
||||||
, runTaskWithOptions
|
, runTaskWithOptions
|
||||||
|
, runTaskWithOptions'
|
||||||
-- * Re-exports
|
-- * Re-exports
|
||||||
, Distribute
|
, Distribute
|
||||||
, Eff
|
, Eff
|
||||||
@ -153,6 +154,23 @@ runTaskWithOptions options task = do
|
|||||||
closeQueue logger
|
closeQueue logger
|
||||||
either (die . displayException) pure result
|
either (die . displayException) pure result
|
||||||
|
|
||||||
|
runTaskWithOptions' :: Options -> AsyncQueue Message Options -> AsyncQueue Stat StatsClient -> TaskEff a -> IO a
|
||||||
|
runTaskWithOptions' options logger statter task = do
|
||||||
|
(result, stat) <- withTiming "run" [] $ do
|
||||||
|
let run :: TaskEff a -> IO (Either SomeException a)
|
||||||
|
run = runM . runError
|
||||||
|
. runTelemetry logger statter
|
||||||
|
. runTraceInTelemetry
|
||||||
|
. runReader options
|
||||||
|
. IO.runFiles
|
||||||
|
. runResolution
|
||||||
|
. runTaskF
|
||||||
|
. runDistribute (run . unwrapTask)
|
||||||
|
run task
|
||||||
|
queue statter stat
|
||||||
|
|
||||||
|
either (die . displayException) pure result
|
||||||
|
|
||||||
runTraceInTelemetry :: Member Telemetry effects => Eff (Trace ': effects) a -> Eff effects a
|
runTraceInTelemetry :: Member Telemetry effects => Eff (Trace ': effects) a -> Eff effects a
|
||||||
runTraceInTelemetry = interpret (\ (Trace str) -> writeLog Debug str [])
|
runTraceInTelemetry = interpret (\ (Trace str) -> writeLog Debug str [])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user