-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Additional metrics collection #3099
Changes from 5 commits
a4cd361
70351d5
5e8cafd
0cdb3dd
856caf2
b5eba79
43d2f21
d0f22b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,11 +44,27 @@ module {{module_name}} | |
context[:auth_scheme] = | ||
Aws::Endpoints.resolve_auth_scheme(context, endpoint) | ||
|
||
@handler.call(context) | ||
with_endpoint_metric(context.config) do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find these a little clunky. Two thoughts on making it a little easier -
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it's pretty clunky especially as these add. I think we want to keep a single mechanism (thread local) but probably this can just take an array and we build the array and block call with it. |
||
with_sigv4a_metric(context[:auth_scheme]) do | ||
@handler.call(context) | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
def with_endpoint_metric(config, &block) | ||
return block.call if config.regional_endpoint | ||
|
||
Aws::Plugins::UserAgent.metric('ENDPOINT_OVERRIDE', &block) | ||
end | ||
|
||
def with_sigv4a_metric(auth_scheme, &block) | ||
return block.call unless auth_scheme && auth_scheme['name'] == 'sigv4a' | ||
|
||
Aws::Plugins::UserAgent.metric('SIGV4A_SIGNING', &block) | ||
end | ||
|
||
def apply_endpoint_headers(context, headers) | ||
headers.each do |key, values| | ||
value = values | ||
|
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.
Why is this being removed?
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 have this in the account id change that was reviewed by us .. but I decided to carry it forward here - it's really just a syntax change. Is it incorrect? I think Endpoint is ALWAYS present in rules is it not? In the switch case below, it is switching on built in, and on SDK::Endpoint, we do the same check that was previously in the mustache template - check regional endpoint and either nil or endpoint.
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 don't think it MUST be present in the rules, but the code we have for constructing the SDK::Endpoint parameter is already conditional, so I agree this is fine, I just wanted to check.
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.
Even if Endpoint isn't guaranteed to exist, I think it's still functionally equivalent, since the switch case looks for Endpoint anyway.