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

enhancement: user agent 2.1 #3001

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

yenfryherrerafeliz
Copy link
Contributor

This change provides:

  • A builder class for appending metrics
  • Default initialization of a metrics builder within command instantiation
  • Wraps user agent logic into a single middleware class
  • Adds middlewares into the different features from where metrics can be gather, to acomplish this purpose.

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

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

Just an initial pass- had a few comments

@@ -280,6 +280,11 @@ public function __construct(array $args)
if (isset($args['with_resolved'])) {
$args['with_resolved']($config);
}
MetricsBuilder::appendMetricsCaptureMiddleware(
Copy link
Member

Choose a reason for hiding this comment

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

question: do we need to add this (or other static/guaranteed metrics) to our middleware stack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if I understand your question. Can you please explain?

src/AwsClient.php Outdated Show resolved Hide resolved
src/EndpointV2/EndpointV2Middleware.php Outdated Show resolved Hide resolved
src/MetricsBuilder.php Show resolved Hide resolved
src/MetricsBuilder.php Outdated Show resolved Hide resolved
src/MetricsBuilder.php Outdated Show resolved Hide resolved
src/UserAgentMiddleware.php Outdated Show resolved Hide resolved
src/UserAgentMiddleware.php Outdated Show resolved Hide resolved
@yenfryherrerafeliz yenfryherrerafeliz force-pushed the feat_user_agent_2.1 branch 4 times, most recently from 2ee9c21 to e4cd325 Compare November 5, 2024 17:32
This change provides:
- A builder class for appending metrics
- Default initialization of a metrics builder within command instantiation
- Wraps user agent logic into a single middleware class
- Adds middlewares into the different features from where metrics can be gather, to acomplish this purpose.
Copy link
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

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

Looking good, just had a few more comments

src/MetricsBuilder.php Outdated Show resolved Hide resolved
src/MetricsBuilder.php Outdated Show resolved Hide resolved
src/MetricsBuilder.php Outdated Show resolved Hide resolved
src/MetricsBuilder.php Outdated Show resolved Hide resolved
src/Command.php Outdated Show resolved Hide resolved
src/S3/ApplyChecksumMiddleware.php Outdated Show resolved Hide resolved
src/UserAgentMiddleware.php Outdated Show resolved Hide resolved
src/UserAgentMiddleware.php Outdated Show resolved Hide resolved
@yenfryherrerafeliz yenfryherrerafeliz force-pushed the feat_user_agent_2.1 branch 6 times, most recently from cfd5b3f to 1160889 Compare November 12, 2024 14:46
@yenfryherrerafeliz yenfryherrerafeliz force-pushed the feat_user_agent_2.1 branch 3 times, most recently from 7f4bb57 to c8c6ef9 Compare November 12, 2024 15:18
- Move the user agent middleware after the signing step in order to gather signature metrics.
- Add request compression metric gathering.
- Add specific testing for signatures.
- Add specific testing for request compression.
- Add specific testing for s3 encryption clients.
- Add credentials metric gathering logic.
- Add tests for credentials metrics.
- Make existent credentials tests to work with the new field `source`. For example, for tests around profile credentials the source property for credentials MUST be `profile`. The default value for this field is `static`.
src/AwsClient.php Outdated Show resolved Hide resolved
src/CommandInterface.php Outdated Show resolved Hide resolved
src/ClientResolver.php Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

We should probably have some tests/assertions on credential resolution -> source

Copy link
Member

Choose a reason for hiding this comment

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

We might want to move this into a utils subdirectory

Copy link
Member

Choose a reason for hiding this comment

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

and make it final

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 agree with making it final. Not sure about moving it into a sub-directory. I think the level it is is fine, because this is intended to be like a enum with the different credential sources.

src/UserAgentMiddleware.php Outdated Show resolved Hide resolved
src/EndpointV2/EndpointV2Middleware.php Outdated Show resolved Hide resolved
src/UserAgentMiddleware.php Outdated Show resolved Hide resolved
tests/AwsClientTest.php Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

we should have some sort of end-to-end test with a client and set of features and make assertions against the output string

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 think that that already exists in the UserAgentMiddlewareTest implementation. Please let me know if the tests there is not what you refer.

- Use static mapping instead of multiple if/else-ifs.
- Remove the endpoint_id metric tracking since it was removed from the spec.
- Make method's name to be verb based.
- Remove the getMetricsBuilder from the CommandInterface.
- Add tests cases to cover credentials sets the correct source when resolved.
- Fix the sso, sso_legacy, and process metrics. They should be all a profile based metric.
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.

2 participants