Skip to content

fix(lambda): bump @aws-lambda-powertools/metrics from 1.18.1 to 2.3.0 in /lambdas #3969

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

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jul 5, 2024

Bumps @aws-lambda-powertools/metrics from 1.18.1 to 2.3.0.

Release notes

Sourced from @​aws-lambda-powertools/metrics's releases.

v2.3.0

Summary

This release improves Logger with (1) a more consistent handling of additional keys, and (2) a new method to reset keys. It also brings improvements to Parser with (1) more accurate API Gateway built-in schemas, and (2) better API reference.

We also fixed a bug with log sampling in Logger, and with the Idempotency decorator not preserving class scope.

🌟 ⭐ Thank you to @​shdq for the work on the Logger improvements.

Working with additional keys in Logger

Docs

We have streamlined the experience for adding, removing, and resetting additional keys in Logger.

Temporary keys

Docs

You can add temporary keys to all future log messages via the appendKeys() method. This is helpful to contextualize log messages emitted within a specific function.

logger-append-keys

We have also added a new resetKeys() method to easily remove any temporary keys you have added, this is useful when you add multiple custom keys conditionally or when you emit canonical or wide logs.

logger-reset-keys

Persistent keys

Docs

You can now also persist keys across Lambda invocations by using the persistentKeys constructor option or the appendPersistentKeys() method.

These keys will now persist even if you call the resetKeys() method.

A common use case is to set keys about your environment or application version, so that you can easily filter logs in CloudWatch Logs.

logger-persistent-keys

The following properties and methods are now marked as deprecated and will be removed in the next major release:

  • persistentLogAttributes constructor option is replaced by persistentKeys
  • addPersistentLogAttributes() and setPersistentLogAttributes() methods are replaced by appendPersistentKeys()
  • removePersistentLogAttributes() method is replaced by removePersistentKeys()

New API Gateway built-in schemas in Parser

Docs

You can now use more accurate schemas for a fine grained validation and parsing, as well as improved type hinting, and code completion support.

... (truncated)

Changelog

Sourced from @​aws-lambda-powertools/metrics's changelog.

2.3.0 (2024-06-27)

Bug Fixes

  • idempotency: preserve scope of decorated class (#2693) (22ec1f0)
  • logger: reset log level after sampling refresh (#2673) (618faec)

Features

2.2.0 (2024-06-13)

Bug Fixes

  • idempotency: deep sort payload during hashing (#2570) (6765f35)
  • parser: handle API Gateway Test UI sourceIp (#2531) (cd6c512)

Features

  • batch: add option to continue processing other group IDs on failure in SqsFifoPartialProcessor (#2590) (a615c24)

2.1.1 (2024-05-14)

Bug Fixes

  • parser: lambda function url cognitoIdentity and principalOrgId nullable (#2430) (3c3e393)
  • parser: set APIGatewayProxyEventSchema body and query string keys to be nullable (#2465) (7ce5b3c)
  • parser: set etag optional for delete object notifications (#2429) (100e223)

2.1.0 (2024-04-17)

... (truncated)

Upgrade guide

Sourced from @​aws-lambda-powertools/metrics's upgrade guide.


title: Upgrade guide description: Guide to update between major Powertools for AWS Lambda (TypeScript) versions

End of support v1

!!! warning "On March 13th, 2024, Powertools for AWS Lambda (TypeScript) v1 entered maintenance mode, and will reach end-of-life on September 1st, 2024. If you are still using v1, we strongly recommend you to read our upgrade guide and update to the latest version."

Given our commitment to all of our customers using Powertools for AWS Lambda (TypeScript), we will keep npm v1 releases and documentation 1.x versions to prevent any disruption.

Migrate from v1 to v2

V2 is focused on official support for ESM (ECMAScript modules). We've made other minimal breaking changes to make your transition to v2 as smooth as possible.

Quick summary

Area Change Code change required
ESM support Added ESM support via dual CommonJS and ESM bundling, enabling top-level await and tree-shaking. -
Middy.js Updated import path for Middy.js middlewares to leverage subpath exports - i.e. @aws-lambda-powertools/tracer/middleware. Yes
Types imports Updated import path for TypeScript types to leverage subpath exports - i.e. @aws-lambda-powertools/logger/types. Yes
Logger Changed log sampling to dynamically switch log level to DEBUG on a percentage of requests. -
Logger Updated custom log formatter to include standard as well as persistent keys. Yes
Logger Removed ContextExamples from @aws-lambda-powertools/commons package. Yes
Logger and Tracer Removed deprecated createLogger and createTracer helper functions in favor of direct instantiation. Yes

First steps

Before you start, we suggest making a copy of your current working project or create a new git branch.

  1. Upgrade Node.js to v18 or higher, Node.js v20 is recommended.
  2. Ensure that you have the latest Powertools for AWS Lambda (TypeScript) version via Lambda Layer or npm.
  3. Review the following sections to confirm whether they apply to your codebase.

ESM support

With support for ES Modules in v2, you can now use import instead of require syntax.

This is especially useful when you want to run asynchronous code during the initialization phase by using top-level await.

import { getSecret } from '@aws-lambda-powertools/parameters/secrets';
// This code will run during the initialization phase of your Lambda function
const myApiKey = await getSecret('my-api-key', { transform: 'json' });
export const handler = async (_event: unknown, _context: unknown) => {
</tr></table>

... (truncated)

Commits
  • b1cd636 chore(ci): bump version to 2.3.0 (#2698)
  • d1284bf docs(logger): rework working with keys doc sections (#2696)
  • f1cdb15 chore(deps): bump the aws-sdk group across 1 directory with 4 updates (#2689)
  • ab84af7 chore(deps-dev): bump tsx from 4.15.6 to 4.15.7 (#2684)
  • 22ec1f0 fix(idempotency): preserve scope of decorated class (#2693)
  • 266b19c chore(deps-dev): bump aws-sdk from 2.1645.0 to 2.1648.0 (#2690)
  • 3a5d72e chore(deps): bump @​types/node from 20.14.6 to 20.14.9 (#2691)
  • 64115c6 docs(parser): add api docs (#2685)
  • b3bc1f0 feat(parser): enhance API Gateway schemas (#2665)
  • 5634566 chore(deps-dev): bump typedoc-plugin-missing-exports from 2.2.0 to 2.3.0 (#2655)
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [@aws-lambda-powertools/metrics](https://github.com/aws-powertools/powertools-lambda-typescript) from 1.18.1 to 2.3.0.
- [Release notes](https://github.com/aws-powertools/powertools-lambda-typescript/releases)
- [Changelog](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/CHANGELOG.md)
- [Upgrade guide](https://github.com/aws-powertools/powertools-lambda-typescript/blob/main/docs/upgrade.md)
- [Commits](aws-powertools/powertools-lambda-typescript@v1.18.1...v2.3.0)

---
updated-dependencies:
- dependency-name: "@aws-lambda-powertools/metrics"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
@dependabot dependabot bot added dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Jul 5, 2024
@npalm npalm closed this Jul 5, 2024
Copy link
Contributor Author

dependabot bot commented on behalf of github Jul 5, 2024

OK, I won't notify you again about this release, but will get in touch when a new version is available. If you'd rather skip all updates until the next major or minor version, let me know by commenting @dependabot ignore this major version or @dependabot ignore this minor version. You can also ignore all major, minor, or patch releases for a dependency by adding an ignore condition with the desired update_types to your config file.

If you change your mind, just re-open this PR and I'll resolve any conflicts on it.

@dependabot dependabot bot deleted the dependabot/npm_and_yarn/lambdas/aws-lambda-powertools/metrics-2.3.0 branch July 5, 2024 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant