Skip to content

Commit ad32fa6

Browse files
committed
More metrics
1 parent e5e02ed commit ad32fa6

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

kmsauth/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,15 +291,29 @@ def decrypt_token(self, username, token):
291291
if len(self.TOKENS) >= self.token_cache_size:
292292
self.stats.incr('token_cache_eviction')
293293

294+
# Checkpoint 3.5: After stats calls in cache miss
295+
checkpoint_3_5 = (datetime.datetime.utcnow() - time_start).total_seconds() * 1000 # noqa: E501
296+
self.stats.timing('checkpoint_3_5_after_cache_miss_stats', checkpoint_3_5) # noqa: E501
297+
294298
try:
295299
token = base64.b64decode(token)
300+
if self.stats:
301+
# Checkpoint 3.7: After base64 decode
302+
checkpoint_3_7 = (datetime.datetime.utcnow() - time_start).total_seconds() * 1000 # noqa: E501
303+
self.stats.timing('checkpoint_3_7_after_base64_decode', checkpoint_3_7) # noqa: E501
304+
296305
# Ensure normal context fields override whatever is in
297306
# extra_context.
298307
context = copy.deepcopy(self.extra_context)
299308
context['to'] = self.to_auth_context
300309
context['from'] = _from
301310
if version > 1:
302311
context['user_type'] = user_type
312+
313+
if self.stats:
314+
# Checkpoint 3.9: After context setup
315+
checkpoint_3_9 = (datetime.datetime.utcnow() - time_start).total_seconds() * 1000 # noqa: E501
316+
self.stats.timing('checkpoint_3_9_after_context_setup', checkpoint_3_9) # noqa: E501
303317
if self.stats:
304318
with self.stats.timer('kms_decrypt_token'):
305319
data = self.kms_client.decrypt(

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
from setuptools import setup, find_packages
1515

16-
VERSION = "0.6.4.dev5"
16+
VERSION = "0.6.4.dev6"
1717

1818
requirements = [
1919
# Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK)

0 commit comments

Comments
 (0)