-
Notifications
You must be signed in to change notification settings - Fork 653
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
internal: true up internal metrics collection for post-SRA middleware #2642
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"id": "ce369d28-a259-4b29-aa49-cd801c4ff959", | ||
"type": "bugfix", | ||
"description": "Adjust internal metrics collection for revised authentication workflow.", | ||
"modules": [ | ||
"." | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package middleware | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics" | ||
"github.com/aws/aws-sdk-go-v2/internal/sdk" | ||
"github.com/aws/smithy-go/middleware" | ||
) | ||
|
||
func timeGetIdentity(stack *middleware.Stack) error { | ||
if err := stack.Finalize.Insert(getIdentityStart{}, "GetIdentity", middleware.Before); err != nil { | ||
return err | ||
} | ||
if err := stack.Finalize.Insert(getIdentityEnd{}, "GetIdentity", middleware.After); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
type getIdentityStart struct{} | ||
|
||
func (m getIdentityStart) ID() string { return "getIdentityStart" } | ||
|
||
func (m getIdentityStart) HandleFinalize( | ||
ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, | ||
) ( | ||
out middleware.FinalizeOutput, md middleware.Metadata, err error, | ||
) { | ||
mctx := metrics.Context(ctx) | ||
mctx.Data().GetIdentityStartTime = sdk.NowTime() | ||
return next.HandleFinalize(ctx, in) | ||
} | ||
|
||
type getIdentityEnd struct{} | ||
|
||
func (m getIdentityEnd) ID() string { return "getIdentityEnd" } | ||
|
||
func (m getIdentityEnd) HandleFinalize( | ||
ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, | ||
) ( | ||
out middleware.FinalizeOutput, md middleware.Metadata, err error, | ||
) { | ||
mctx := metrics.Context(ctx) | ||
mctx.Data().GetIdentityEndTime = sdk.NowTime() | ||
return next.HandleFinalize(ctx, in) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package middleware | ||
|
||
import ( | ||
"context" | ||
|
||
"github.com/aws/aws-sdk-go-v2/aws/middleware/private/metrics" | ||
"github.com/aws/aws-sdk-go-v2/internal/sdk" | ||
"github.com/aws/smithy-go/middleware" | ||
) | ||
|
||
func timeSigning(stack *middleware.Stack) error { | ||
if err := stack.Finalize.Insert(signingStart{}, "Signing", middleware.Before); err != nil { | ||
return err | ||
} | ||
if err := stack.Finalize.Insert(signingEnd{}, "Signing", middleware.After); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
type signingStart struct{} | ||
|
||
func (m signingStart) ID() string { return "signingStart" } | ||
|
||
func (m signingStart) HandleFinalize( | ||
ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, | ||
) ( | ||
out middleware.FinalizeOutput, md middleware.Metadata, err error, | ||
) { | ||
mctx := metrics.Context(ctx) | ||
attempt, err := mctx.Data().LatestAttempt() | ||
if err != nil { | ||
return out, md, err | ||
} | ||
|
||
attempt.SignStartTime = sdk.NowTime() | ||
return next.HandleFinalize(ctx, in) | ||
} | ||
|
||
type signingEnd struct{} | ||
|
||
func (m signingEnd) ID() string { return "signingEnd" } | ||
|
||
func (m signingEnd) HandleFinalize( | ||
ctx context.Context, in middleware.FinalizeInput, next middleware.FinalizeHandler, | ||
) ( | ||
out middleware.FinalizeOutput, md middleware.Metadata, err error, | ||
) { | ||
mctx := metrics.Context(ctx) | ||
attempt, err := mctx.Data().LatestAttempt() | ||
if err != nil { | ||
return out, md, err | ||
} | ||
|
||
attempt.SignEndTime = sdk.NowTime() | ||
return next.HandleFinalize(ctx, in) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need a bit more context as to why are we removing these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's no longer a per-attempt metric with the SRA auth refactor - credential (abstractly referred to now as identity) retrieval happened as part of the signing process in the now-deprecated sigv4 middleware, as part of an attempt lifecycle. Now it's its own middleware (
GetIdentity
) separate from signing and before the retry middleware i.e. before the attempt loop starts.Long-term I think we do want to pull the start of the retry loop further back but that's out of scope for now.