diff --git a/bench/Main.hs b/bench/Main.hs index b034b10983..a832242b2b 100644 --- a/bench/Main.hs +++ b/bench/Main.hs @@ -202,8 +202,6 @@ buildHls Cabal root out = actionBracket liftIO $ writeFile projectLocal $ unlines ["package haskell-language-server" ," ghc-options: -eventlog -rtsopts" - ,"package ghcide" - ," flags: +ekg" ] return projectLocalExists) (\projectLocalExists -> do diff --git a/cabal.project b/cabal.project index 85abe2914e..e2b5c04dc1 100644 --- a/cabal.project +++ b/cabal.project @@ -42,32 +42,3 @@ constraints: -- We want to be able to benefit from the performance optimisations -- in the future, thus: TODO: remove this flag. bitvec -simd - --- This is benign and won't affect our ability to release to Hackage, --- because we only depend on `ekg-json` when a non-default flag --- is turned on. --- DELETE MARKER FOR CI --- centos7 has an old version of git which cabal doesn't --- support. We delete these lines in gitlab ci to workaround --- this issue, as this is not necessary to build our binaries. -source-repository-package - type:git - location: https://github.com/pepeiborra/ekg-json - tag: 7a0af7a8fd38045fd15fb13445bdcc7085325460 --- END DELETE - -if impl(ghc >= 9.1) - -- ekg packagess are old and unmaintained, but we - -- don't rely on them for the mainline build, so - -- this is okay - allow-newer: - ekg-json:base, - ekg-wai:time, - ekg-core:ghc-prim - -if impl(ghc >= 9.7) - -- ekg packagess are old and unmaintained, but we - -- don't rely on them for the mainline build, so - -- this is okay - allow-newer: - ekg-core:text, diff --git a/docs/contributing/contributing.md b/docs/contributing/contributing.md index b4043c5dc3..c38ce0421d 100644 --- a/docs/contributing/contributing.md +++ b/docs/contributing/contributing.md @@ -198,17 +198,6 @@ See the [tutorial](./plugin-tutorial.md) on writing a plugin in HLS. ## Measuring, benchmarking and tracing -### Metrics - -When ghcide is built with the `ekg` flag, HLS opens a metrics server on port 8999 exposing GC and ghcide metrics. The ghcide metrics currently exposed are: - -- `ghcide.values_count` - count of build results in the store -- `ghcide.database_count` - count of build keys in the store (these two would be the same in the absence of GC) -- `ghcide.build_count` - build count. A key is GC'ed if it is dirty and older than 100 builds -- `ghcide.dirty_keys_count` - non transitive count of dirty build keys -- `ghcide.indexing_pending_count` - count of items in the indexing queue -- `ghcide.exports_map_count` - count of identifiers in the exports map. - ### Benchmarks If you are touching performance sensitive code, take the time to run a differential diff --git a/ghcide/exe/Arguments.hs b/ghcide/exe/Arguments.hs index f1be07dbcb..627c041970 100644 --- a/ghcide/exe/Arguments.hs +++ b/ghcide/exe/Arguments.hs @@ -20,7 +20,6 @@ data Arguments = Arguments ,argsVerbose :: Bool ,argsCommand :: Command ,argsConservativeChangeTracking :: Bool - ,argsMonitoringPort :: Int } getArguments :: IdePlugins IdeState -> IO Arguments @@ -43,7 +42,6 @@ arguments plugins = Arguments <*> switch (short 'd' <> long "verbose" <> help "Include internal events in logging output") <*> (commandP plugins <|> lspCommand <|> checkCommand) <*> switch (long "conservative-change-tracking" <> help "disable reactive change tracking (for testing/debugging)") - <*> option auto (long "monitoring-port" <> metavar "PORT" <> value 8999 <> showDefault <> help "Port to use for EKG monitoring (if the binary is built with EKG)") where checkCommand = Check <$> many (argument str (metavar "FILES/DIRS...")) lspCommand = LSP <$ flag' True (long "lsp" <> help "Start talking to an LSP client") diff --git a/ghcide/exe/Main.hs b/ghcide/exe/Main.hs index b9e3637068..a563f3532b 100644 --- a/ghcide/exe/Main.hs +++ b/ghcide/exe/Main.hs @@ -18,7 +18,6 @@ import Development.IDE.Core.Rules (mainRule) import qualified Development.IDE.Core.Rules as Rules import Development.IDE.Core.Tracing (withTelemetryLogger) import qualified Development.IDE.Main as IDEMain -import qualified Development.IDE.Monitoring.EKG as EKG import qualified Development.IDE.Monitoring.OpenTelemetry as OpenTelemetry import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde import Development.IDE.Types.Options @@ -148,5 +147,5 @@ main = withTelemetryLogger $ \telemetryLogger -> do , optRunSubset = not argsConservativeChangeTracking , optVerifyCoreFile = argsVerifyCoreFile } - , IDEMain.argsMonitoring = OpenTelemetry.monitoring <> EKG.monitoring logger argsMonitoringPort + , IDEMain.argsMonitoring = OpenTelemetry.monitoring } diff --git a/ghcide/ghcide.cabal b/ghcide/ghcide.cabal index 6bdc3c9c86..16aeaa06de 100644 --- a/ghcide/ghcide.cabal +++ b/ghcide/ghcide.cabal @@ -28,13 +28,6 @@ source-repository head type: git location: https://github.com/haskell/haskell-language-server.git -flag ekg - description: - Enable EKG monitoring of the build graph and other metrics on port 8999 - - default: False - manual: True - flag pedantic description: Enable -Werror default: False @@ -178,7 +171,6 @@ library Development.IDE.LSP.Server Development.IDE.Main Development.IDE.Main.HeapStats - Development.IDE.Monitoring.EKG Development.IDE.Monitoring.OpenTelemetry Development.IDE.Plugin Development.IDE.Plugin.Completions @@ -218,13 +210,6 @@ library ghc-options: -Werror - if flag(ekg) - build-depends: - , ekg-core - , ekg-wai - - cpp-options: -DMONITORING_EKG - flag test-exe description: Build the ghcide-test-preprocessor executable default: True diff --git a/ghcide/src/Development/IDE/Main.hs b/ghcide/src/Development/IDE/Main.hs index 2359b4a18a..a05ab88e2a 100644 --- a/ghcide/src/Development/IDE/Main.hs +++ b/ghcide/src/Development/IDE/Main.hs @@ -65,7 +65,6 @@ import Development.IDE.LSP.LanguageServer (runLanguageServer, import qualified Development.IDE.LSP.LanguageServer as LanguageServer import Development.IDE.Main.HeapStats (withHeapStats) import qualified Development.IDE.Main.HeapStats as HeapStats -import qualified Development.IDE.Monitoring.EKG as EKG import qualified Development.IDE.Monitoring.OpenTelemetry as OpenTelemetry import Development.IDE.Plugin (Plugin (pluginHandlers, pluginModifyDynflags, pluginRules)) import Development.IDE.Plugin.HLS (asGhcIdePlugin) @@ -259,7 +258,7 @@ defaultArguments recorder logger plugins = Arguments -- the language server tests without the redirection. putStr " " >> hFlush stdout return newStdout - , argsMonitoring = OpenTelemetry.monitoring <> EKG.monitoring logger 8999 + , argsMonitoring = OpenTelemetry.monitoring } diff --git a/ghcide/src/Development/IDE/Monitoring/EKG.hs b/ghcide/src/Development/IDE/Monitoring/EKG.hs deleted file mode 100644 index 26414fdf04..0000000000 --- a/ghcide/src/Development/IDE/Monitoring/EKG.hs +++ /dev/null @@ -1,49 +0,0 @@ -{-# LANGUAGE CPP #-} -module Development.IDE.Monitoring.EKG(monitoring) where - -import Development.IDE.Types.Monitoring (Monitoring (..)) -import Ide.Logger (Logger) - -#ifdef MONITORING_EKG -import Control.Concurrent (killThread) -import Control.Concurrent.Async (async, waitCatch) -import Control.Monad (forM_) -import Data.Text (pack) -import Ide.Logger (logInfo) -import qualified System.Metrics as Monitoring -import qualified System.Remote.Monitoring.Wai as Monitoring - --- | Monitoring using EKG -monitoring :: Logger -> Int -> IO Monitoring -monitoring logger port = do - store <- Monitoring.newStore - Monitoring.registerGcMetrics store - let registerCounter name read = Monitoring.registerCounter name read store - registerGauge name read = Monitoring.registerGauge name read store - start = do - server <- do - let startServer = Monitoring.forkServerWith store "localhost" port - -- this can fail if the port is busy, throwing an async exception back to us - -- to handle that, wrap the server thread in an async - mb_server <- async startServer >>= waitCatch - case mb_server of - Right s -> do - logInfo logger $ pack $ - "Started monitoring server on port " <> show port - return $ Just s - Left e -> do - logInfo logger $ pack $ - "Unable to bind monitoring server on port " - <> show port <> ":" <> show e - return Nothing - return $ forM_ server $ \s -> do - logInfo logger "Stopping monitoring server" - killThread $ Monitoring.serverThreadId s - return $ Monitoring {..} - -#else - -monitoring :: Logger -> Int -> IO Monitoring -monitoring _ _ = mempty - -#endif