Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add removal warning for legacy lambda provider #9203

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

Merged
merged 4 commits into from
Sep 26, 2023

Conversation

joe4dev
Copy link
Member

@joe4dev joe4dev commented Sep 21, 2023

Motivation

  • With 1.3, the new Lambda v2 provider became available as opt-in.
  • With 1.4 (ish), the legacy v1 provider was deprecated and we encouraged users to opt-in to our new Lambda v2 provider.
  • With 2.0, the new lambda provider v2 became the default implementation Switch to new Lambda provider implementation #6724.
  • With 2.3, we add removal warnings in the old v1 provider (this PR). We also ship the Lambda invocation loop rework Lambda invocation loop rework #8970 (re-write of data plane).
  • With 3.0 the old (v1) provider will be removed completely.

Changes

Add a log warning when the legacy Lambda v1 provider is used. Only logged during initialization (on_after_init) for people using the legacy Lambda service.

Discussion

Pro-active warnings at LocalStack startup:

  • Do we want to prominently warn about deprecated environment values such as PROVIDER_OVERRIDE_LAMBDA=v1 at the startup of LocalStack? We currently do not support this with EnvVarDeprecation. I drafted an EnvVarValueDeprecation in a26c77375 but reverted it because it needs further updates in the logging message and telemetry if we even need this.
  • I guess we would mainly use it for (important) provider deprecation warnings (e.g., S3, Lambda).
  • It would help customers to see the warning right at the startup rather than potentially miss it somewhere in the logs when the provider gets loaded lazily.

Consistency: Trying to align the language for the deprecations and removals of s3, lambda, stepfunctions /cc

Initial attempt for a utility to collect deprecations for specific values of environment variables.
@joe4dev joe4dev added this to the 2.3 milestone Sep 21, 2023
@joe4dev joe4dev self-assigned this Sep 21, 2023
@joe4dev joe4dev requested a review from dfangl as a code owner September 21, 2023 18:42
@@ -303,6 +303,22 @@ def log_deprecation_warnings(deprecations: Optional[List[EnvVarDeprecation]] = N
affected_deprecations = collect_affected_deprecations(deprecations)
log_env_warning(affected_deprecations)

provider_override_lambda = os.environ.get("PROVIDER_OVERRIDE_LAMBDA")
if provider_override_lambda and provider_override_lambda in ["v1", "legacy"]:
Copy link
Member Author

Choose a reason for hiding this comment

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

Do we want/need this prominently at startup?

Screenshot 2023-09-21 at 20 43 08

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. The Lambda team discussed this makes sense for Lambda given the substantial difference. We want to highlight this and push users to adopt v2 or raise any blocking issues.

Copy link
Member Author

Choose a reason for hiding this comment

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

Notice that the language differs from the lazily loaded message. This message is aligned to the regular LS-startup deprecation warnings.

@joe4dev joe4dev added the semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases label Sep 21, 2023
@coveralls
Copy link

Coverage Status

coverage: 82.93% (-0.01%) from 82.94% when pulling bbf21dd on lambda-v1-removal-warnings into 623e383 on master.

@github-actions
Copy link

LocalStack Community integration with Pro

       2 files  ±0         2 suites  ±0   1h 14m 52s ⏱️ - 1m 53s
2 217 tests ±0  1 721 ✔️ ±0  496 💤 ±0  0 ±0 
2 218 runs  ±0  1 721 ✔️ ±0  497 💤 ±0  0 ±0 

Results for commit bbf21dd. ± Comparison against base commit 623e383.

Copy link
Member

@dfangl dfangl left a comment

Choose a reason for hiding this comment

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

LGTM! But why do we have the warning twice?

@joe4dev
Copy link
Member Author

joe4dev commented Sep 25, 2023

LGTM! But why do we have the warning twice?

The warning upon LS startup is much more present and appears right next to other important deprecation warnings.
The warning upon lazy provider loading often gets lost in the logs. I guess we could consider skipping this one then 🤔 At least we are extra clear about it and get it covered for every old provider initialization.

@joe4dev joe4dev merged commit 9d020b1 into master Sep 26, 2023
@joe4dev joe4dev deleted the lambda-v1-removal-warnings branch September 26, 2023 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: minor Non-breaking changes which can be included in minor releases, but not in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants