Skip to content

Conversation

@aajtodd
Copy link
Contributor

@aajtodd aajtodd commented Aug 26, 2021

Issue #

fixes #181

Description of changes

Read AWS_EXECUTION_ENV instead of manually setting a hard coded value.

Scope

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

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

@aajtodd aajtodd requested review from ianbotsf and kggilmer August 26, 2021 13:41
* The execution environment of the SDK user. This is automatically set in certain environments by the underlying AWS service.
* For example, AWS Lambda will automatically specify a runtime indicating that the SDK is being used within Lambda.
*/
public object AwsExecutionEnv : AwsSdkSetting<String>("AWS_EXECUTION_ENV", "aws.executionEnvironment")
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Is the JVM property aws.executionEnvironment actually set by any AWS runtimes?

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 looked for an answer but came up with nothing.

Comment on lines -136 to +138
Platform.getenv("AWS_LAMBDA_FUNCTION_NAME")?.let {
ExecutionEnvMetadata("lambda")
Platform.getenv(AwsSdkSetting.AwsExecutionEnv.environmentVariable)?.let {
ExecutionEnvMetadata(it)
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: Is Platform.getenv the right abstraction for getting SDK settings? If we're going to support settings that could come from an environment variable and (optionally on JVM) a system property, then we should typically use an abstraction that handles fetching both.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only reason I didn't is because of the KMP considerations. I can circle back if you think we should implement it now though.

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 we need to implement it now but if we don't we should probably have a task to do so, especially if we think the SDK property implementation may be different on other platforms (e.g., in-browser JS where we're not reading from "environment variables" but something else).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created #300

@aajtodd aajtodd merged commit 9e015c7 into main Aug 26, 2021
@aajtodd aajtodd deleted the fix-user-agent-exec-env branch August 26, 2021 15:41
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.

user agent exec-env should use AWS_EXECUTION_ENV

3 participants