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

Additional metrics collection #3099

Merged
merged 8 commits into from
Sep 11, 2024
Merged

Additional metrics collection #3099

merged 8 commits into from
Sep 11, 2024

Conversation

mullermp
Copy link
Contributor

@mullermp mullermp commented Sep 6, 2024

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

  1. To make sure we include your contribution in the release notes, please make sure to add description entry for your changes in the "unreleased changes" section of the CHANGELOG.md file (at corresponding gem). For the description entry, please make sure it lives in one line and starts with Feature or Issue in the correct format.

  2. For generated code changes, please checkout below instructions first:
    https://github.com/aws/aws-sdk-ruby/blob/version-3/CONTRIBUTING.md

Thank you for your contribution!

Copy link
Contributor

@jterapin jterapin left a comment

Choose a reason for hiding this comment

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

LGTM ✨

@@ -42,10 +42,6 @@ def initialize(options)

# @return [Array<EndpointParameter>]
attr_reader :parameters

def has_endpoint_built_in?
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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 -

  1. For many metric cases (like these), its scoped within a single request. We can add these metrics to the context instead of to a thread local. That way, they do not need to a call a block and pop the metric off. This both lets do conditional metrics more easily and avoids having to wrap the handler call, which isn't really necessary for these. (Note: I'm suggesting a second way to set metrics - scoped only to the request. Not replacing the thread local, which I know we need for other cases).

  2. If we do not want to support multiple places/scopes metrics can be added, then we can have with_metric take an array of metrics, and allow that array to be empty. That will let us easily support conditional metrics and multiple ones.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

@mullermp mullermp merged commit 1869c67 into version-3 Sep 11, 2024
31 checks passed
@mullermp mullermp deleted the extra-metrics branch September 11, 2024 16:57
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.

3 participants