aws-powertools / powertools-lambda

MIT No Attribution
73 stars 4 forks source link

Expand on the Projects `Readme.md` / Quickstart #58

Closed michaelbrewer closed 2 years ago

michaelbrewer commented 3 years ago

What were you initially searching for in the docs?

A quick start guide on the GitHub main page for AWS Lambda Powertools

Is this related to an existing part of the documentation? Please share a link

Describe how we could make it clearer

Add a basic getting started guide with a couple simple examples for logger, tracer and maybe metrics. Once a developer got a taste of the library, they can still visit the full documentation site.

If you have a proposed update, please share it here

from aws_lambda_powertools import Logger, Tracer
from aws_lambda_powertools.logging import correlation_paths
from aws_lambda_powertools.event_handler.api_gateway import ApiGatewayResolver

tracer = Tracer()
logger = Logger()
app = ApiGatewayResolver()

@app.get("/hello")
@tracer.capture_method
def get_hello_universe():
    return {"message": "hello universe"}

@logger.inject_lambda_context(correlation_id_path=correlation_paths.API_GATEWAY_REST)
@tracer.capture_lambda_handler
def lambda_handler(event, context):
    return app.resolve(event, context)
heitorlessa commented 3 years ago

Great idea actually. perhaps we should go back to the idea of having an examples folder with every utility using a dummy example (e.g. payments, booking) along with Infra.

heitorlessa commented 3 years ago

Agreed that Michal would be looking at it cc @mploski

michaelbrewer commented 3 years ago

As an example Chalice has quite a nice readme https://github.com/aws/chalice

heitorlessa commented 2 years ago

This is now released as part of 1.24.1 ;) https://github.com/awslabs/aws-lambda-powertools-python/releases/tag/v1.24.1

michaelbrewer commented 2 years ago

one thing missing is still a bit more of a taster on the github landing page (aka the actual readme), but this tutorial is really cool