diff --git a/BuildFlags.hs b/BuildFlags.hs index 40d5bb29b3..1dba47eafa 100644 --- a/BuildFlags.hs +++ b/BuildFlags.hs @@ -59,5 +59,8 @@ buildFlags = filter (not . null) #endif #ifdef WITH_CRYPTOHASH , "CryptoHash" +#endif +#ifdef WITH_EKG + , "EKG" #endif ] diff --git a/GitAnnex.hs b/GitAnnex.hs index b73cd94162..d6de50d03b 100644 --- a/GitAnnex.hs +++ b/GitAnnex.hs @@ -5,7 +5,7 @@ - Licensed under the GNU GPL version 3 or higher. -} -{-# LANGUAGE CPP #-} +{-# LANGUAGE CPP, OverloadedStrings #-} module GitAnnex where @@ -87,6 +87,9 @@ import qualified Command.XMPPGit import qualified Command.Test import qualified Command.FuzzTest #endif +#ifdef WITH_EKG +import System.Remote.Monitoring +#endif cmds :: [Command] cmds = concat @@ -169,4 +172,8 @@ header :: String header = "git-annex command [option ...]" run :: [String] -> IO () -run args = dispatch True args cmds options [] header Git.CurrentRepo.get +run args = do +#ifdef WITH_EKG + _ <- forkServer "localhost" 4242 +#endif + dispatch True args cmds options [] header Git.CurrentRepo.get diff --git a/debian/changelog b/debian/changelog index 17911cab53..b7a73d3a10 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +git-annex (4.20131107) UNRELEASED; urgency=low + + * Allow optionally configuring git-annex with -fEKG to enable awesome + remote monitoring interfaceat http://localhost:4242/ + + -- Joey Hess Wed, 06 Nov 2013 16:14:14 -0400 + git-annex (4.20131106) unstable; urgency=low * Improve local pairing behavior when two computers both try to start diff --git a/doc/ekg.mdwn b/doc/ekg.mdwn new file mode 100644 index 0000000000..3bbea8614b --- /dev/null +++ b/doc/ekg.mdwn @@ -0,0 +1,14 @@ +You can `cabal configure -fEKG` to build a git-annex that includes +the EKG remote monitoring interface. + +To access the EKG control panel, go to + while a git-annex command is running. + +This EKG build is mostly useful for debugging resource usage problems. + +[[!img ekg.png caption="git-annex webapp startup, and assistant startup scan"]] + +Note that since only one process can open port 4242 at a time, running +more than one git-annex process with EKG support at the same time can +result in some "resource busy (Address already in use)" messages -- but +git-annex will continue to work. diff --git a/doc/ekg/ekg.png b/doc/ekg/ekg.png new file mode 100644 index 0000000000..a8d16a2d81 Binary files /dev/null and b/doc/ekg/ekg.png differ diff --git a/doc/install/cabal.mdwn b/doc/install/cabal.mdwn index 4eac597f16..3270dd0f9b 100644 --- a/doc/install/cabal.mdwn +++ b/doc/install/cabal.mdwn @@ -50,3 +50,9 @@ you want, and use cabal as follows inside its source tree: cabal configure cabal build cabal install --bindir=$HOME/bin + +## EKG + +When building with cabal, you can optionally enable the +[[EKG monitoring interface|ekg]]. This is great for debugging resource +usage problems. diff --git a/git-annex.cabal b/git-annex.cabal index ef0259e7a0..848477c187 100644 --- a/git-annex.cabal +++ b/git-annex.cabal @@ -74,6 +74,10 @@ Flag Quvi Flag CryptoHash Description: Enable use of cryptohash for checksumming +Flag EKG + Description: Enable use of EKG to monitor git-annex as it runs (at http://localhost:4242/) + Default: False + Executable git-annex Main-Is: git-annex.hs Build-Depends: MissingH, hslogger, directory, filepath, @@ -177,6 +181,11 @@ Executable git-annex Build-Depends: aeson CPP-Options: -DWITH_QUVI + if flag(EKG) + Build-Depends: ekg + GHC-Options: -with-rtsopts=-T + CPP-Options: -DWITH_EKG + source-repository head type: git location: git://git-annex.branchable.com/