-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: true up internal metrics collection for post-SRA middleware (…
- Loading branch information
Showing
10 changed files
with
150 additions
and
42 deletions.
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