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

Update GetSessionToken error logging #127

Merged
merged 2 commits into from
Nov 14, 2022

Conversation

toddtreece
Copy link
Member

No description provided.

@CLAassistant
Copy link

CLAassistant commented Nov 14, 2022

CLA assistant check
All committers have signed the CLA.

@toddtreece toddtreece changed the base branch from main to 11172022_Release November 14, 2022 21:48
_, err := c.writerService()
if err != nil {
return nil, err
if c.tokenRoleWriter != "" {
Copy link
Member Author

Choose a reason for hiding this comment

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

failing early if the writer role is not configured

@@ -534,31 +534,26 @@ func (c *twinMakerClient) GetSessionToken(ctx context.Context, duration time.Dur
}

func (c *twinMakerClient) GetWriteSessionToken(ctx context.Context, duration time.Duration, workspaceId string) (*sts.Credentials, error) {
_, err := c.writerService()
Copy link
Member Author

Choose a reason for hiding this comment

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

is this writerService call needed? it seems like GetWriteSessionToken handles assuming the role

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think. This was just mirroring the other getsession function really.

// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
log.DefaultLogger.Error("error getting session token", "code", aerr.Code(), "error", aerr)
Copy link
Member Author

Choose a reason for hiding this comment

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

@haweston i updated this to use the grafana plugin SDK logger. it seems like having the code might be useful info in all cases where the info is available, so i added a code field

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay, yeah that's definitely better.

@toddtreece toddtreece merged commit dcdd616 into 11172022_Release Nov 14, 2022
@toddtreece toddtreece deleted the toddtreece/log-updates branch November 14, 2022 22:24
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.

None yet

3 participants