Revision a26eb290
Added by Lukas Zapletal over 2 years ago
app/services/authorizer_cache.rb | ||
---|---|---|
module AuthorizerCache
|
||
include Foreman::TelemetryHelper
|
||
|
||
def initialize_cache
|
||
@cache = {}
|
||
end
|
||
... | ... | |
|
||
def fetch_collection(subject, permission)
|
||
collection = @cache[cache_key(subject, permission)] = find_collection(subject.class, :permission => permission).pluck(:id)
|
||
telemetry_increment_counter(:authorizer_cache_records_fetched, collection.count, class: subject&.class || :Other)
|
||
Rails.logger.info("Loaded #{collection.size} #{subject.class} records into authorization cache for permission #{permission}, consider skipping caching for this check.") if collection.size > 100000
|
||
collection
|
||
end
|
Also available in: Unified diff
Fixes #34122 - Report disallowed metric labels as other
Signed-off-by: Lukas Zapletal <lzap+git@redhat.com>