-
-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose runtime metrics via EKG #2267
Conversation
I am also picking this commit locally to test it, there are some conflicts with master that I needed to fix. |
I'll send a rebase with some new features tonight. EDIT: I have pushed a rebase including the GC metrics, but I didn't have time to look at the WebUI comment |
ghcide/src/Development/IDE/Main.hs
Outdated
Left e -> do | ||
logInfo logger $ T.pack $ | ||
"Unable to bind monitoring server on port " | ||
<> show p <> ":" <> show e |
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.
This is going to happen quite often for me as I usually have multiple instances of HLS running at once. Perhaps we should try a range of ports rather than just fail?
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.
Sounds good, do push a commit if you want this.
ddb673c
to
5faf842
Compare
I have reworked this to abstract monitoring and put it behind a Cabal flag, to avoid acquiring a hard dependency on the |
@@ -30,6 +30,11 @@ flag ghc-patched-unboxed-bytecode | |||
default: False | |||
manual: True | |||
|
|||
flag ekg | |||
description: Enable EKG monitoring of the build graph and other metrics on port 8999 |
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.
The port is configurable, right? Just seems like an odd detail to have here.
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.
Putting it here makes it easy to find :)
311f543
to
6a04ca5
Compare
226a14c
to
f5ce823
Compare
Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
@michaelpj thanks for the review, I think I've addressed all your feedback now and this is ready to go |
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.
Nice!
* Collect metrics and expose an EKG server * register gc metrics locally * getDatabaseKeys * fixups * Abstract monitoring and put EKG behind a Cabal flag * Add CI for the new flag * fix double ifdef * link to GHC docs for eventlogs * log when stopping the EKG server * Allow CPP in modules * Add doc comments * Apply suggestions from code review Co-authored-by: Michael Peyton Jones <me@michaelpj.com> * Compat. with ghc 9.2 * use an ekg-json snapshot that preserves compat. with ghc 8.x * confine CPP to the EKG module Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
* Collect metrics and expose an EKG server * register gc metrics locally * getDatabaseKeys * fixups * Abstract monitoring and put EKG behind a Cabal flag * Add CI for the new flag * fix double ifdef * link to GHC docs for eventlogs * log when stopping the EKG server * Allow CPP in modules * Add doc comments * Apply suggestions from code review Co-authored-by: Michael Peyton Jones <me@michaelpj.com> * Compat. with ghc 9.2 * use an ekg-json snapshot that preserves compat. with ghc 8.x * confine CPP to the EKG module Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
Install a metrics server at port 8000 via EKG with the following metrics:
ghcide.values_count
- count of build results in the storeghcide.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 buildsghcide.dirty_keys_count
- non transitive count of dirty build keysghcide.indexing_pending_count
- count of items in the indexing queueghcide.exports_map_count
- count of identifiers in the exports map.Unfortunately the EKG packages need allow-newer entries for GHC 9. This is also the case for the snap-server packages and dependencies. Since it doesn't look like these are getting resolved in Hackage any time soon, let's hold back on merging this PR for now
Upstream issues: