|
1 | 1 | {-# LANGUAGE DeriveAnyClass #-}
|
2 | 2 | {-# LANGUAGE DeriveGeneric #-}
|
| 3 | +{-# LANGUAGE DerivingStrategies #-} |
3 | 4 | {-# LANGUAGE FlexibleContexts #-}
|
4 | 5 | {-# LANGUAGE GADTs #-}
|
5 | 6 | {-# LANGUAGE MultiParamTypeClasses #-}
|
|
8 | 9 | {-# LANGUAGE TypeApplications #-}
|
9 | 10 | {-# LANGUAGE UndecidableInstances #-}
|
10 | 11 |
|
11 |
| -module Cardano.Node.Startup where |
| 12 | +module Cardano.Node.Startup |
| 13 | + ( module Cardano.Node.Startup |
| 14 | + , module Cardano.Logging.Types.NodeInfo |
| 15 | + , module Cardano.Logging.Types.NodeStartupInfo |
| 16 | + ) where |
12 | 17 |
|
13 | 18 | import qualified Cardano.Api as Api
|
14 | 19 |
|
15 | 20 | import Cardano.Git.Rev (gitRev)
|
16 | 21 | import Cardano.Ledger.Shelley.Genesis (sgSystemStart)
|
17 | 22 | import Cardano.Logging
|
| 23 | +import Cardano.Logging.Types.NodeInfo (NodeInfo (..)) |
| 24 | +import Cardano.Logging.Types.NodeStartupInfo (NodeStartupInfo (..)) |
18 | 25 | import Cardano.Network.PeerSelection.PeerTrustable (PeerTrustable (..))
|
19 | 26 | import Cardano.Node.Configuration.POM (NodeConfiguration (..), ncProtocol)
|
20 | 27 | import Cardano.Node.Configuration.Socket
|
@@ -43,15 +50,12 @@ import Ouroboros.Network.Subscription.Ip (IPSubscriptionTarget (..))
|
43 | 50 |
|
44 | 51 | import Prelude
|
45 | 52 |
|
46 |
| -import Control.DeepSeq (NFData) |
47 |
| -import Data.Aeson (FromJSON, ToJSON) |
48 | 53 | import Data.Map.Strict (Map)
|
49 | 54 | import Data.Monoid (Last (..))
|
50 | 55 | import Data.Text (Text, pack)
|
51 | 56 | import Data.Time.Clock (NominalDiffTime, UTCTime)
|
52 | 57 | import Data.Version (showVersion)
|
53 | 58 | import Data.Word (Word64)
|
54 |
| -import GHC.Generics (Generic) |
55 | 59 | import Network.HostName (getHostName)
|
56 | 60 | import qualified Network.Socket as Socket
|
57 | 61 |
|
@@ -132,13 +136,15 @@ data StartupTrace blk =
|
132 | 136 | | LedgerPeerSnapshotLoaded (WithOrigin SlotNo)
|
133 | 137 | | MovedTopLevelOption String
|
134 | 138 |
|
135 |
| -data EnabledBlockForging = EnabledBlockForging |
136 |
| - | DisabledBlockForging |
137 |
| - | NotEffective |
138 |
| - -- ^ one needs to send `SIGHUP` after consensus |
139 |
| - -- initialised itself (especially after replying all |
140 |
| - -- blocks). |
141 |
| - deriving (Eq, Show) |
| 139 | +data EnabledBlockForging |
| 140 | + = EnabledBlockForging |
| 141 | + | DisabledBlockForging |
| 142 | + | NotEffective |
| 143 | + -- ^ one needs to send `SIGHUP` after consensus |
| 144 | + -- initialised itself (especially after replying all |
| 145 | + -- blocks). |
| 146 | + deriving stock |
| 147 | + (Eq, Show) |
142 | 148 |
|
143 | 149 | data BasicInfoCommon = BasicInfoCommon {
|
144 | 150 | biConfigPath :: FilePath
|
@@ -170,37 +176,6 @@ data BasicInfoNetwork = BasicInfoNetwork {
|
170 | 176 | , niIpProducers :: IPSubscriptionTarget
|
171 | 177 | }
|
172 | 178 |
|
173 |
| -data NodeInfo = NodeInfo |
174 |
| - { niName :: Text |
175 |
| - , niProtocol :: Text |
176 |
| - , niVersion :: Text |
177 |
| - , niCommit :: Text |
178 |
| - , niStartTime :: UTCTime |
179 |
| - , niSystemStartTime :: UTCTime |
180 |
| - } deriving (Eq, Generic, ToJSON, FromJSON, Show) |
181 |
| - |
182 |
| -deriving instance (NFData NodeInfo) |
183 |
| - |
184 |
| -instance MetaTrace NodeInfo where |
185 |
| - namespaceFor NodeInfo {} = |
186 |
| - Namespace [] ["NodeInfo"] |
187 |
| - severityFor (Namespace _ ["NodeInfo"]) _ = |
188 |
| - Just Info |
189 |
| - severityFor _ns _ = |
190 |
| - Nothing |
191 |
| - documentFor (Namespace _ ["NodeInfo"]) = Just |
192 |
| - "Basic information about this node collected at startup\ |
193 |
| - \\n\ |
194 |
| - \\n _niName_: Name of the node. \ |
195 |
| - \\n _niProtocol_: Protocol which this nodes uses. \ |
196 |
| - \\n _niVersion_: Software version which this node is using. \ |
197 |
| - \\n _niStartTime_: Start time of this node. \ |
198 |
| - \\n _niSystemStartTime_: How long did the start of the node took." |
199 |
| - documentFor _ns = |
200 |
| - Nothing |
201 |
| - allNamespaces = [ Namespace [] ["NodeInfo"]] |
202 |
| - |
203 |
| - |
204 | 179 | -- | Prepare basic info about the node. This info will be sent to 'cardano-tracer'.
|
205 | 180 | prepareNodeInfo
|
206 | 181 | :: NodeConfiguration
|
@@ -261,32 +236,3 @@ prepareNodeInfo nc (SomeConsensusProtocol whichP pForInfo) tc nodeStartTime = do
|
261 | 236 |
|
262 | 237 | hostName <- getHostName
|
263 | 238 | return (pack (hostName <> suffix))
|
264 |
| - |
265 |
| --- | This information is taken from 'BasicInfoShelleyBased'. It is required for |
266 |
| --- 'cardano-tracer' service (particularly, for RTView). |
267 |
| -data NodeStartupInfo = NodeStartupInfo { |
268 |
| - suiEra :: Text |
269 |
| - , suiSlotLength :: NominalDiffTime |
270 |
| - , suiEpochLength :: Word64 |
271 |
| - , suiSlotsPerKESPeriod :: Word64 |
272 |
| - } deriving (Eq, Generic, ToJSON, FromJSON, Show) |
273 |
| - |
274 |
| -deriving instance (NFData NodeStartupInfo) |
275 |
| - |
276 |
| -instance MetaTrace NodeStartupInfo where |
277 |
| - namespaceFor NodeStartupInfo {} = |
278 |
| - Namespace [] ["NodeStartupInfo"] |
279 |
| - severityFor (Namespace _ ["NodeStartupInfo"]) _ = |
280 |
| - Just Info |
281 |
| - severityFor _ns _ = |
282 |
| - Nothing |
283 |
| - documentFor (Namespace _ ["NodeStartupInfo"]) = Just |
284 |
| - "Startup information about this node, required for RTView\ |
285 |
| - \\n\ |
286 |
| - \\n _suiEra_: Name of the current era. \ |
287 |
| - \\n _suiSlotLength_: Slot length, in seconds. \ |
288 |
| - \\n _suiEpochLength_: Epoch length, in slots. \ |
289 |
| - \\n _suiSlotsPerKESPeriod_: KES period length, in slots." |
290 |
| - documentFor _ns = |
291 |
| - Nothing |
292 |
| - allNamespaces = [ Namespace [] ["NodeStartupInfo"]] |
0 commit comments