Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Add ENABLE_BROKER_STATS to broker.conf #6389

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 4 additions & 0 deletions broker/conf/broker.conf
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,7 @@ MIN_NODE_DISK_BUFFER="5"

# Additional rubygems (space seperated) that will be loaded in the broker's Gemfile.
# ADDITIONAL_RUBYGEMS=""

# Enables logging of stats like current request id,
# heap memory, #objects, #symbols for the broker process.
ENABLE_BROKER_STATS="false"
1 change: 1 addition & 0 deletions broker/config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
:broker_stats_enabled => conf.get_bool("ENABLE_BROKER_STATS", "false"),
}

config.auth = {
Expand Down
1 change: 1 addition & 0 deletions broker/config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
:broker_stats_enabled => conf.get_bool("ENABLE_BROKER_STATS", "false"),
}

config.auth = {
Expand Down
1 change: 1 addition & 0 deletions broker/config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
:auth_user_lookup_only => conf.get_bool("AUTH_USER_LOOKUP_ONLY", false),
:auth_user_lookup_fail_msg => conf.get("AUTH_USER_LOOKUP_FAIL_MESSAGE", "This cluster is configured for user lookup only. Please contact your system administrator for provisioning your user account."),
:min_node_disk_buffer => (conf.get("MIN_NODE_DISK_BUFFER", "5")).to_i
:broker_stats_enabled => conf.get_bool("ENABLE_BROKER_STATS", "false"),
}

config.auth = {
Expand Down
13 changes: 13 additions & 0 deletions controller/lib/openshift/controller/api_responses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def render_error(status, msg, err_code=nil, field=nil, msg_type=nil, messages=ni
end
@analytics_tracker.track_event(event_name, @domain, @application, {'request_path' => request.fullpath, 'request_method' => request.method, 'status_code' => status, 'error_code' => err_code, 'error_field' => field})
end
log_broker_stats(request.uuid)
respond_with reply, :status => reply.status
end

Expand Down Expand Up @@ -225,6 +226,7 @@ def render_success(status, type, data, message=nil, result=nil ,extra_messages=n
else
log_action(action_log_tag, status, true, message, log_args)
end
log_broker_stats(request.uuid)
respond_with reply
end

Expand Down Expand Up @@ -277,6 +279,17 @@ def extract_node_messages(ex, code=nil, message=nil, field=nil)
end
[code, message, messages]
end

def log_broker_stats(request_uuid)
if Rails.configuration.openshift[:broker_stats_enabled]
stats = Hash.new
stats[:request_id] = request_uuid
stats[:gc_stat] = GC::stat
stats[:count_objects] = ObjectSpace.count_objects
stats[:count_objects][:T_SYMBOL] = Symbol.all_symbols.size
Rails.logger.info("BROKER_STATS => #{stats.to_json}")
end
end
end
end
end