Skip to main content

Community

Connector Improvement: Enhance documentation in Cloud Functions connector

Completed

Please sign in to leave a comment.

Comments

3 comments

  • Official comment

    Thank you Nick,

    I really appreciate your thoughtful responses and providing the example code.

    I'll work to get that added in our general docs.

    Best regards

    Alison

    Hi Nick,

    Thank you for taking the time to share such a detailed and thoughtful feature request.

    Would you be willing to share the code you used to integrate CloudWatch?

    We always strive to make our documents as helpful as possible, that said I think we have enhanced the options for error handling since this post was made.

    Best regards

    Alison

    Hi Alison,

    Thank you for responding to this Feature Request.

    I'm too busy at the moment to share instructions on IAM configuration, but once that configuration is set up, the code to integrate CloudWatch is simple. An example might look like this:

    import json
    import logging

    logger = logging.getLogger()
    logger.setLevel(logging.INFO)

    def lambda_handler(event, context):

    logger.info("Beginning function execution ...")
    #TODO implement
    logger.info("Finishing function execution ...")

    return {
    "statusCode": 200,
    "body": json.dumps("Hello from Lambda!")
    }

    When you invoke the Lambda function for the first time, Cloudwatch will create a log group and a log stream that shows the two log lines written in the function above (assuming that you've configured IAM correctly). From there on out, all other function invocations will provide new log streams in that initially created Cloudwatch log group.

    Best,

    Nick