Skip to content

Commit

Permalink
chore(metrics): Added more metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Malinowski authored and Edward Malinowski committed Jun 26, 2024
1 parent 8a84593 commit f61b6b0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 8 deletions.
7 changes: 1 addition & 6 deletions fence/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,7 @@ def set_flask_session_values(user):
current_app.scoped_session().add(user)
current_app.scoped_session().commit()

from fence.metrics import (
login_counter,
fence_login_counter,
google_login_counter,
ras_login_counter,
)
from fence.metrics import login_counter

login_counter.inc()

Expand Down
2 changes: 2 additions & 0 deletions fence/blueprints/login/fence_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def get(self):
)
self.post_login()

from fence.metrics import fence_login_counter

fence_login_counter.inc()

if config["REGISTER_USERS_ON"]:
Expand Down
4 changes: 2 additions & 2 deletions fence/blueprints/login/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ def __init__(self):


class GoogleCallback(DefaultOAuth2Callback):
from fence.metrics import google_login_counter

def __init__(self):
super(GoogleCallback, self).__init__(
idp_name=IdentityProvider.google, client=flask.current_app.google_client
Expand All @@ -28,6 +26,8 @@ def get(self):
+ "/link/google/callback?code={}".format(flask.request.args.get("code"))
)

from fence.metrics import google_login_counter

google_login_counter.inc()

return super(GoogleCallback, self).get()
2 changes: 2 additions & 0 deletions fence/blueprints/login/ras.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ def post_login(self, user=None, token_result=None, id_from_idp=None):
expires,
)

from fence.metrics import ras_login_counter

ras_login_counter.inc()

flask.current_app.ras_client.store_refresh_token(
Expand Down

0 comments on commit f61b6b0

Please sign in to comment.