mirror of
https://github.com/github/semantic.git
synced 2024-11-24 08:54:07 +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
|
||||
, runTask
|
||||
, runTaskWithOptions
|
||||
, runTaskWithOptions'
|
||||
-- * Re-exports
|
||||
, Distribute
|
||||
, Eff
|
||||
@ -153,6 +154,23 @@ runTaskWithOptions options task = do
|
||||
closeQueue logger
|
||||
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 = interpret (\ (Trace str) -> writeLog Debug str [])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user