Skip to content

Commit 1c8a770

Browse files
authored
Merge pull request #652 from input-output-hk/js/labels
Label threads
2 parents dfce339 + 425734f commit 1c8a770

File tree

9 files changed

+26
-12
lines changed

9 files changed

+26
-12
lines changed

iohk-monitoring/iohk-monitoring.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: iohk-monitoring
2-
version: 0.2.1.1
2+
version: 0.2.1.2
33
synopsis: logging, benchmarking and monitoring framework
44
-- description:
55
license: Apache-2.0

iohk-monitoring/src/Cardano/BM/Backend/Switchboard.lhs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import Data.Aeson (FromJSON, ToJSON)
4444
import Data.Maybe (isJust)
4545
import Data.Text (Text)
4646
import qualified Data.Text.IO as TIO
47+
import GHC.Conc (labelThread, myThreadId)
4748
import GHC.IO.Exception (BlockedIndefinitelyOnSTM)
4849
import qualified Katip as K
4950
import System.IO (stderr)
@@ -234,7 +235,9 @@ realizeSwitchboard cfg = do
234235
res <- mapM processItem nlis
235236
when (and res) $ qProc
236237
in
237-
Async.async qProc
238+
Async.async $ do
239+
myThreadId >>= flip labelThread "Switchboard dispatcher (iohk-monitoring)"
240+
qProc
238241
239242
#ifdef PERFORMANCE_TEST_QUEUE
240243
let qSize = 1000000

plugins/backend-aggregation/lobemo-backend-aggregation.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.0
22
name: lobemo-backend-aggregation
3-
version: 0.1.0.2
3+
version: 0.1.0.3
44
synopsis: provides a backend implementation to aggregate traced values
55
-- description:
66
homepage: https://github.com/input-output-hk/iohk-monitoring-framework

plugins/backend-aggregation/src/Cardano/BM/Backend/Aggregation.lhs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import Data.Aeson (FromJSON, ToJSON)
3131
import qualified Data.HashMap.Strict as HM
3232
import Data.Text (Text, pack)
3333
import qualified Data.Text.IO as TIO
34+
import GHC.Conc (labelThread, myThreadId)
3435
import System.IO (stderr)
3536
3637
import Cardano.BM.Backend.ProcessQueue (processQueue)
@@ -147,7 +148,9 @@ spawnDispatcher :: Configuration
147148
spawnDispatcher conf aggMap aggregationQueue basetrace =
148149
let trace = Trace.appendName "#aggregation" basetrace
149150
in
150-
Async.async $ qProc trace aggMap
151+
Async.async $ do
152+
myThreadId >>= flip labelThread "Aggregation dispatcher (lobemo-backend-aggregation)"
153+
qProc trace aggMap
151154
where
152155
{-@ lazy qProc @-}
153156
qProc trace aggregatedMap =

plugins/backend-ekg/lobemo-backend-ekg.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.0
22
name: lobemo-backend-ekg
3-
version: 0.2.0.0
3+
version: 0.2.0.1
44
synopsis: provides a backend implementation to EKG
55
-- description:
66
homepage: https://github.com/input-output-hk/iohk-monitoring-framework

plugins/backend-ekg/src/Cardano/BM/Backend/EKGView.lhs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import Data.String (fromString)
3636
import Data.Text (Text, pack, stripPrefix)
3737
import qualified Data.Text.IO as TIO
3838
import Data.Version (showVersion)
39+
import GHC.Conc (labelThread, myThreadId)
3940
4041
import System.IO (stderr)
4142
import qualified System.Metrics.Gauge as Gauge
@@ -344,7 +345,9 @@ spawnDispatcher :: Configuration
344345
-> Trace.Trace IO a
345346
-> IO (Async.Async ())
346347
spawnDispatcher config evqueue _sbtrace ekgtrace =
347-
Async.async $ qProc
348+
Async.async $ do
349+
myThreadId >>= flip labelThread "Dispatcher EKGView (lobemo-backend-ekg)"
350+
qProc
348351
where
349352
{-@ lazy qProc @-}
350353
qProc :: IO ()

plugins/backend-ekg/src/Cardano/BM/Backend/Prometheus.lhs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import Data.Text (Text)
2929
import qualified Data.Text as T
3030
import Data.Text.Encoding (encodeUtf8)
3131
import Data.Text.Read (double)
32+
import GHC.Conc (labelThread, myThreadId)
3233
import GHC.Generics
3334
import Network.HTTP.Types (status200)
3435
import qualified Network.Wai as Wai
@@ -72,12 +73,14 @@ instance A.ToJSON Number where
7273
7374
spawnPrometheus :: Wai.Server -> Warp.HostPreference -> Int -> Maybe Text -> IO (Async.Async ())
7475
spawnPrometheus ekg host port prometheusOutput =
75-
Async.async $ Warp.runSettings settings site
76-
76+
Async.async $ do
77+
myThreadId >>= flip labelThread "Prometheus (lobemo-backend-ekg)"
78+
Warp.runSettings settings site
79+
7780
where
7881
settings :: Warp.Settings
7982
settings = Warp.setPort port . Warp.setHost host $ Warp.defaultSettings
80-
83+
8184
site :: Wai.Application
8285
site _request respond = do
8386
-- We ignore the request and simple respond with the data.

plugins/backend-monitoring/lobemo-backend-monitoring.cabal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 2.0
22
name: lobemo-backend-monitoring
3-
version: 0.1.0.2
3+
version: 0.1.0.3
44
synopsis: provides a backend implementation for monitoring
55
-- description:
66
homepage: https://github.com/input-output-hk/iohk-monitoring-framework
@@ -76,4 +76,3 @@ test-suite tests
7676
void,
7777
yaml, libyaml
7878
ghc-options: -Wall -Werror
79-

plugins/backend-monitoring/src/Cardano/BM/Backend/Monitoring.lhs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import Data.Maybe (catMaybes)
3434
import Data.Text (Text, pack)
3535
import qualified Data.Text.IO as TIO
3636
import GHC.Clock (getMonotonicTimeNSec)
37+
import GHC.Conc (labelThread, myThreadId)
3738
import System.IO (stderr)
3839
3940
import Cardano.BM.Backend.LogBuffer
@@ -159,7 +160,9 @@ spawnDispatcher :: TBQ.TBQueue (Maybe (LogObject a))
159160
-> Monitor a
160161
-> IO (Async.Async ())
161162
spawnDispatcher mqueue config sbtrace monitor =
162-
Async.async (initMap >>= qProc)
163+
Async.async (do
164+
myThreadId >>= flip labelThread "Monitoring dispatcher (lobemo-backend-monitoring)"
165+
initMap >>= qProc)
163166
where
164167
{-@ lazy qProc @-}
165168
qProc state =

0 commit comments

Comments
 (0)