AWS Lambda
AWS Lambda is autoinstrumented!
Just add our code snippet to the top of your function’s entrypoint and you’re good to go.
Install the Python client
pip install iudex
Create a write-only API key 🔑
Click settings in the top left corner of the IUDEX dashboard and create a write-only API key.
Add IUDEX into your app 🚀
Add the following code to the very top of your function’s entrypoint file (e.g. process_upload.py
).
from iudex import instrument
instrument(
service_name="YOUR_SERVICE_NAME", # Highly encouraged
iudex_api_key="WRITE_ONLY_IUDEX_KEY", # Only ever commit your WRITE ONLY key
github_url="GITHUB_URL_TO_YOUR_REPO", # Optional, this sets up code linking
env="prod", # Optional, dev, local, etc
)
# ^ Must run above all imports
Set up Slack alerts 📣
Click the Slack logo in the top right of the dashboard and follow the prompts.
Note: you must have admin permissions to add apps to your workspace.
Create a log 🪵
Add code to emit a log in your app. You can use print
or Python’s logging
module.
import logging
logger = logging.getLogger(__name__)
...
logger.info("Hello IUDEX!", extra={"iudex.slack_channel_id": "YOUR_SLACK_CHANNEL_ID"})
(In Slack, open the channel and click its name in the top left, then find its ID at the bottom of the dialog.)
Then simply run your Lambda
function as usual to emit the log.
Verify 🧐
You should see the log in Slack and in your IUDEX dashboard log view.
Go in-depth 👉
Check out more in-depth guides on how to get the most out of IUDEX for your stack.