stop logging stats in adheres_to_policy

refs CORE-2538

test plan
 - specs should pass

Change-Id: I09ffd6982be803294b7d70c1e485d999a01352ea
Reviewed-on: https://gerrit.instructure.com/186260
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
This commit is contained in:
Rob Orton 2019-02-19 14:44:47 -07:00
parent d7b5e1de7f
commit e430f35de0
3 changed files with 29 additions and 35 deletions

View File

@ -15,7 +15,6 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.add_dependency 'rails', ">= 3.2"
spec.add_dependency 'canvas_statsd', "~> 2.0"
spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"

View File

@ -42,9 +42,9 @@ module AdheresToPolicy
if value.nil?
if block_given?
how_it_got_it = :generated
elapsed = Benchmark.realtime do
start_time = Time.now
value = yield
end
elapsed = Time.now - start_time
Thread.current[:last_cache_generate] = elapsed # so we can record it in the logs
self.write(key, value, use_rails_cache: use_rails_cache)
end

View File

@ -16,8 +16,6 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
require 'canvas_statsd'
module AdheresToPolicy
module InstanceMethods
# Public: Gets the requested rights granted to a user.
@ -244,7 +242,6 @@ module AdheresToPolicy
permission_cache_key_for(user, session, sought_right),
use_rails_cache: use_rails_cache
) do
CanvasStatsd::BlockTracking.track("adheres_to_policy.#{sought_right_cookie}", category: :adheres_to_policy) do
conditions = self.class.policy.conditions[sought_right]
next false unless conditions
@ -253,9 +250,9 @@ module AdheresToPolicy
# grants us the sought_right.
conditions.any? do |condition|
condition_applies = false
elapsed_time = Benchmark.realtime do
start_time = Time.now
condition_applies = condition.applies?(self, user, session)
end
elapsed_time = Time.now - start_time
if condition_applies
# Since the condition is true we can loop through all the rights
@ -281,8 +278,6 @@ module AdheresToPolicy
end
end
end
end
CanvasStatsd::Statsd.instance&.increment("adheres_to_policy.#{sought_right_cookie}.#{how_it_got_it}")
value
ensure