diff --git a/app/apollo/resolvers/cluster.js b/app/apollo/resolvers/cluster.js index 8abdfc3ee..d8c43f11f 100644 --- a/app/apollo/resolvers/cluster.js +++ b/app/apollo/resolvers/cluster.js @@ -579,6 +579,8 @@ const clusterResolvers = { try { logger.info({ req_id, user, org_id, registration }, `${queryName} validating`); + //step where IAM is authorized + context.IAM_PERF = true; await validAuth(me, org_id, ACTIONS.REGISTER, TYPES.CLUSTER, queryName, context); logger.info({ req_id, user, org_id, registration }, `${queryName} validating - authorized`); diff --git a/app/apollo/resolvers/common.js b/app/apollo/resolvers/common.js index 3d3bd3679..f034dd838 100644 --- a/app/apollo/resolvers/common.js +++ b/app/apollo/resolvers/common.js @@ -174,6 +174,9 @@ const validAuth = async (me, org_id, action, type, queryName, context, attrs = n } return; } + + // Debug: Find how long registerCluster() IAM validation takes + const startTime = Date.now(); if (me === null || !(await models.User.isAuthorized(me, org_id, action, type, attrs, context))) { logger.error({req_id, me: whoIs(me), org_id, action, type}, `ForbiddenError - ${queryName}`); if (type === TYPES.RESOURCE){ @@ -183,6 +186,8 @@ const validAuth = async (me, org_id, action, type, queryName, context, attrs = n } } + const endTime = Date.now(); + if( context.IAM_PERF ) logger.info( {req_id, org_id, me, iam_time: endTime - startTime }, 'IAM api call completed' ); }; // a helper function to render clusterInfo for a list of resources