This repository has been archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 631
[CSL-1585] Namespace cardano EKG metrics #1464
Merged
adinapoli-iohk
merged 6 commits into
master
from
alfredo/csl-1585-correctly-namespace-ekg-metrics
Sep 1, 2017
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
f12bd50
[CSL-1585] Namespace cardano EKG metrics
adinapoli-iohk ecb03dd
[CSL-1585] Various EKG improvements.
adinapoli-iohk a928322
Swap μ for microseconds in ekg metric names
adinapoli-iohk a32c641
[CSL-1585] Use proper version of timewarp
adinapoli-iohk 6f5b0ff
[CSL-1585] Drop redundant lang extension
adinapoli-iohk 3a6d2f5
[CSL-1585] Address code review feedback
adinapoli-iohk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,7 @@ | |
|
||
module Pos.Util.Monitor ( | ||
|
||
setupMonitor | ||
, startMonitor | ||
startMonitor | ||
, stopMonitor | ||
|
||
) where | ||
|
@@ -16,40 +15,14 @@ import Control.Monad.IO.Class | |
import Mockable.Class | ||
import qualified Mockable.Metrics as Metrics | ||
import Node | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imports should be qualified or contain explicit import list, according to style-guide. |
||
import Pos.System.Metrics.Constants (withCardanoNamespace) | ||
import Node.Util.Monitor (registerMetrics) | ||
import Pos.System.Metrics.Constants (cardanoNamespace) | ||
import qualified System.Metrics as Monitoring | ||
import qualified System.Metrics.Distribution as Monitoring.Distribution | ||
import qualified System.Remote.Monitoring.Wai as Monitoring | ||
|
||
import Universum | ||
|
||
-- | Put time-warp related metrics into an EKG store. | ||
-- You must indicate how to run the monad into IO, so that EKG can produce | ||
-- the metrics (it works in IO). | ||
setupMonitor | ||
:: ( Mockable Metrics.Metrics m | ||
, Metrics.Distribution m ~ Monitoring.Distribution.Distribution | ||
, MonadIO m | ||
) | ||
=> (forall t . m t -> IO t) | ||
-> Node m | ||
-> Monitoring.Store | ||
-> m Monitoring.Store | ||
setupMonitor lowerIO node store = do | ||
liftIO $ flip (Monitoring.registerGauge (withCardanoNamespace "handlers.initiated_remotely")) store $ lowerIO $ do | ||
stats <- nodeStatistics node | ||
Metrics.readGauge (stRunningHandlersRemote stats) | ||
liftIO $ flip (Monitoring.registerGauge (withCardanoNamespace "handlers.initiated_locally")) store $ lowerIO $ do | ||
stats <- nodeStatistics node | ||
Metrics.readGauge (stRunningHandlersLocal stats) | ||
liftIO $ flip (Monitoring.registerDistribution (withCardanoNamespace "handlers.finished_normally.elapsed_time_microseconds")) store $ lowerIO $ do | ||
stats <- nodeStatistics node | ||
liftIO $ Monitoring.Distribution.read (stHandlersFinishedNormally stats) | ||
liftIO $ flip (Monitoring.registerDistribution (withCardanoNamespace "handlers.finished_exceptionally.elapsed_time_microseconds")) store $ lowerIO $ do | ||
stats <- nodeStatistics node | ||
liftIO $ Monitoring.Distribution.read (stHandlersFinishedExceptionally stats) | ||
return store | ||
|
||
startMonitor | ||
:: ( Mockable Metrics.Metrics m | ||
, Metrics.Distribution m ~ Monitoring.Distribution.Distribution | ||
|
@@ -61,8 +34,8 @@ startMonitor | |
-> m Monitoring.Server | ||
startMonitor port lowerIO node = do | ||
store <- liftIO Monitoring.newStore | ||
store' <- setupMonitor lowerIO node store | ||
liftIO $ Monitoring.registerGcMetrics store' | ||
registerMetrics (Just cardanoNamespace) lowerIO node store | ||
liftIO $ Monitoring.registerGcMetrics store | ||
server <- liftIO $ Monitoring.forkServerWith store "127.0.0.1" port | ||
liftIO . putStrLn $ "Forked EKG server on port " ++ show port | ||
return server | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need
ekgStore'
any more. It was only there because the oldsetupMonitor
returned a possibly modified store, and no it doesn't, so there's no need to name the result.