AWS Lambda Adapter: Expose aws_request_id and log_stream_name in SlackRequestHandler context
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu tại slack_bolt/adapter/aws_lambda/handler.py, nơi SlackRequestHandler ánh xạ context của AWS Lambda vào bolt_req.context. Xác minh việc điền context hiện có và cung cấp aws_request_id cùng log_stream_name bên cạnh các giá trị Lambda khác; hoàn tất khi cả hai key đều khả dụng trong quá trình xử lý request của Bolt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I would like to add two parameters from the AWS Lambda context into the BoltRequest context in AWS :
- aws_request_id
- log_stream_name
These parameters are useful for manual logging and are accessible directly from the context variable within lambda_handler(event, context) function when not in Bolt framework. I would like to also make them available in Bolt framework. Proposed code mirrors how bolt_req.context is currently populated in AWS Lambda adapter handler:
$ git diff
diff --git a/slack_bolt/adapter/aws_lambda/handler.py b/slack_bolt/adapter/aws_lambda/handler.py
index 1ba44dd..ba3e183 100644
--- a/slack_bolt/adapter/aws_lambda/handler.py
+++ b/slack_bolt/adapter/aws_lambda/handler.py
@@ -55,7 +55,11 @@ class SlackRequestHandler:
bolt_req = to_bolt_request(event)
# https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
aws_lambda_function_name = context.function_name
+ aws_request_id = context.aws_request_id
+ log_stream_name = context.log_stream_name
bolt_req.context["aws_lambda_function_name"] = aws_lambda_function_name
+ bolt_req.context["aws_request_id"] = aws_request_id
+ bolt_req.context["log_stream_name"] = log_stream_name
bolt_req.context["aws_lambda_invoked_function_arn"] = context.invoked_function_arn
bolt_req.context["lambda_request"] = event
bolt_resp = self.app.dispatch(bolt_req)
I am open to implementing this feature myself if there is desire to add it to bolt-python.
Category (place an x in each of the [ ])
- slack_bolt.App and/or its core components
- slack_bolt.async_app.AsyncApp and/or its core components
- Adapters in slack_bolt.adapter
- Others
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
- Ngôn ngữ chính
- Python
- Star
- 1.3k
- Fork
- 288
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 10
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của slackapi/bolt-python
-
docs enhancement server-side
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
slackapi/bolt-python#1576 · 1 bình luận ·
-
auto-triage-skip bug security semver:major
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
slackapi/bolt-python#1447 · 9 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 65/100
slackapi/bolt-python#1472 · 1 bình luận · 1 reaction ·
-
auto-triage-skip enhancement
slackapi/bolt-python#1346 · 2 bình luận · 1 người được giao ·
Tất cả issue của slackapi/bolt-python
Issue tương tự
-
Add: hunch Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
AbdelStark/awesome-typesafe#104 ·
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
DiamondLightSource/dodal#2211 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
openml/openml-python#1749 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
sipyourdrink-ltd/bernstein#6191 ·