mirror of
https://github.com/typeable/bloodhound.git
synced 2024-08-16 11:50:34 +03:00
Don't bother parsing JVM version numbers either
This commit is contained in:
parent
7ba70bff4b
commit
088ef73f82
@ -9,6 +9,7 @@ module Bloodhound.Import
|
||||
, showText
|
||||
, deleteSeveral
|
||||
, oPath
|
||||
, tshow
|
||||
) where
|
||||
|
||||
import Control.Applicative as X (Alternative (..), optional)
|
||||
|
@ -1421,12 +1421,17 @@ data NodeJVMInfo = NodeJVMInfo {
|
||||
, nodeJVMVMVersion :: VMVersion
|
||||
-- ^ JVM doesn't seme to follow normal version conventions
|
||||
, nodeJVMVMName :: Text
|
||||
, nodeJVMVersion :: VersionNumber
|
||||
, nodeJVMVersion :: JVMVersion
|
||||
, nodeJVMPID :: PID
|
||||
} deriving (Eq, Show)
|
||||
|
||||
-- | Handles quirks in the way JVM versions are rendered (1.7.0_101 -> 1.7.0.101)
|
||||
newtype JVMVersion = JVMVersion { unJVMVersion :: VersionNumber }
|
||||
-- | We cannot parse JVM version numbers and we're not going to try.
|
||||
newtype JVMVersion =
|
||||
JVMVersion { unJVMVersion :: Text }
|
||||
deriving (Eq, Show)
|
||||
|
||||
instance FromJSON JVMVersion where
|
||||
parseJSON = withText "JVMVersion" (pure . JVMVersion)
|
||||
|
||||
data JVMMemoryInfo = JVMMemoryInfo {
|
||||
jvmMemoryInfoDirectMax :: Bytes
|
||||
@ -2240,14 +2245,9 @@ instance FromJSON NodeJVMInfo where
|
||||
<*> o .: "vm_vendor"
|
||||
<*> o .: "vm_version"
|
||||
<*> o .: "vm_name"
|
||||
<*> (unJVMVersion <$> o .: "version")
|
||||
<*> o .: "version"
|
||||
<*> o .: "pid"
|
||||
|
||||
instance FromJSON JVMVersion where
|
||||
parseJSON (String t) =
|
||||
JVMVersion <$> parseJSON (String (T.replace "_" "." t))
|
||||
parseJSON v = JVMVersion <$> parseJSON v
|
||||
|
||||
instance FromJSON JVMMemoryInfo where
|
||||
parseJSON = withObject "JVMMemoryInfo" parse
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user