Skip to content
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

Improved Prometheus Metrics #439

Merged
merged 3 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## 1.7.5 - 2024-09

- (Dan) Updates the property table ui so the label is clickable
- (Jon) Swapped the `action_dispatch` subscriber for `action_controller` to
allow the `memory_used_mb` and `process_threads` metrics to report correctly
(Dan) Updates the property table ui so the label is clickable
- (Dan) Replaces the buttons for checkboxes on the property tables [GH-431](https://github.com/epimorphics/ukhpi/issues/431)
- (Jon) Exposed `instrument_internal_error(exception)` metric to the
`ExceptionsController` to provide a count of internal errors
Expand Down
4 changes: 4 additions & 0 deletions app/assets/stylesheets/_ukhpi-statistics.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ $graph-colours: (
flex-wrap: wrap;
.checkbox-container {
margin-right: 5px;
cursor: pointer;
input[type="checkbox"] {
cursor: inherit;
}
img {
max-height: 15px;
margin-bottom: -1px;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# frozen_string_literal: true

# Subscribe to :action_dispatch events
class ActionDispatchPrometheusSubscriber < ActiveSupport::Subscriber
attach_to :action_dispatch
# Subscribe to :action_controller events to monitor memory usage and thread status
class ActionControllerPrometheusSubscriber < ActiveSupport::Subscriber
attach_to :action_controller

# rubocop:disable Metrics/AbcSize
# rubocop:disable Metrics/AbcSize, Metrics/MethodLength
def process_action(_event)
mem = GetProcessMem.new
Prometheus::Client.registry
Expand Down Expand Up @@ -56,5 +56,5 @@ def process_action(_event)
}
)
end
# rubocop:enable Metrics/AbcSize
# rubocop:enable Metrics/AbcSize, Metrics/MethodLength
end
4 changes: 4 additions & 0 deletions config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

# Uncomment the following line once ruby is updated to 2.7 or greater to allow
# the use of the puma-metrics plugin as we're using puma 6.0.0 or greater
# plugin :metrics

# Use a custom log formatter to emit Puma log messages in a JSON format
log_formatter do |str|
{
Expand Down