Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GetNewSession function to cache credentials session correctly. Fixes #441 #442

Merged
merged 7 commits into from
Jan 19, 2022

Conversation

LalitLab
Copy link
Contributor

Integration test logs

Logs
Add passing integration test logs here

Example query results

Results
Add example SQL query results here (please include the input queries as well)

@LalitLab LalitLab self-assigned this Jan 19, 2022
@rajlearner17 rajlearner17 linked an issue Jan 19, 2022 that may be closed by this pull request
Copy link
Contributor

@cbruno10 cbruno10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@LalitTurbot Please see comments

azure/service.go Outdated
@@ -49,6 +50,7 @@ func GetNewSession(ctx context.Context, d *plugin.QueryData, tokenAudience strin
return cachedData.(*Session), nil
}
}
logger.Info("Auth session not found in cache")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be info level, or debug instead? I don't know if we want to see this all the time in the logs.

azure/service.go Outdated
@@ -153,7 +155,9 @@ func GetNewSession(ctx context.Context, d *plugin.QueryData, tokenAudience strin

// Get the subscription ID and tenant ID for "GRAPH" token audience
case "CLI":
logger.Info("GetNewSession__", "Get session authorizer from Azure CLI")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly here, should this be debug level instead?

azure/service.go Outdated
authorizer, err = auth.NewAuthorizerFromCLIWithResource(resource)
// authorizer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this comment mean?

azure/service.go Outdated

if err != nil {
logger.Debug("GetNewSession__", "NewAuthorizerFromCLIWithResource error", err)
logger.Error("GetNewSession__", "Get token from Azure CLI error", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What level do we usually use, Warn or Error, for these types of messages?

azure/service.go Outdated
d.ConnectionManager.Cache.SetWithTTL(cacheKey, sess, time.Until(*sess.Expires))
logger.Info("Session saved in cache with expiry in", "minutes", (time.Until(*sess.Expires)).Minutes())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to my other questions above, should this line and the one below it be debug level?

@cbruno10 cbruno10 merged commit 505431e into main Jan 19, 2022
@cbruno10 cbruno10 deleted the issue-441 branch January 19, 2022 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix GetNewSession function to cache credentials session correctly
2 participants