Skip to content

feat: add ldms feature#8051

Merged
leandrodamascena merged 3 commits intodevelopfrom
feat/add-ldms
Mar 20, 2026
Merged

feat: add ldms feature#8051
leandrodamascena merged 3 commits intodevelopfrom
feat/add-ldms

Conversation

@leandrodamascena
Copy link
Contributor

@leandrodamascena leandrodamascena commented Mar 20, 2026

Issue number: closes #8050

Summary

Lambda has recently launched a metadata device similar to to the Instance Metadata Service that EC2 has. We should add a utility that allows user to access the data without having explicitly make fetch requests to the IP address where the service lives.

Changes

Add the new utility

User experience

from aws_lambda_powertools import Logger
from aws_lambda_powertools.utilities.metadata import LambdaMetadata, get_lambda_metadata, clear_metadata_cache
from aws_lambda_powertools.utilities.typing import LambdaContext

logger = Logger()


def lambda_handler(event: dict, context: LambdaContext) -> dict:
    metadata: LambdaMetadata = get_lambda_metadata()
    az_id = metadata.availability_zone_id  # e.g., "use1-az1"

    logger.append_keys(az_id=az_id)
    logger.info("Processing request")

    return {"az_id": az_id}

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

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@leandrodamascena leandrodamascena requested a review from a team as a code owner March 20, 2026 16:22
@boring-cyborg boring-cyborg bot added commons documentation Improvements or additions to documentation tests labels Mar 20, 2026
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Mar 20, 2026
@leandrodamascena leandrodamascena changed the title feat: add ldms service feat: add ldms feature Mar 20, 2026
@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 97.22222% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.65%. Comparing base (1047397) to head (8186526).
⚠️ Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...a_powertools/utilities/metadata/lambda_metadata.py 96.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8051   +/-   ##
========================================
  Coverage    96.65%   96.65%           
========================================
  Files          279      282    +3     
  Lines        13703    13775   +72     
  Branches      1091     1096    +5     
========================================
+ Hits         13244    13314   +70     
- Misses         338      339    +1     
- Partials       121      122    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@boring-cyborg boring-cyborg bot added the github-actions Pull requests that update Github_actions code label Mar 20, 2026
@sonarqubecloud
Copy link

@leandrodamascena leandrodamascena merged commit 90fbae6 into develop Mar 20, 2026
16 checks passed
@leandrodamascena leandrodamascena deleted the feat/add-ldms branch March 20, 2026 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commons documentation Improvements or additions to documentation github-actions Pull requests that update Github_actions code size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: Add utility for Lambda Metadata Services

2 participants