logging.exception does not create entry in exceptions table
Chưa có ai nhận issue này.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
When logging.exception("Simple Exception") then it should show up in the exceptions table in App Insights. It only shows up when it is explicitly raised.
If we want to show 403,404 as an "exception from the app's point of view" and correlate with requests etc currently the app insights will only show failures that explicitly raised an exception. If a valid HttpResponse is sent with 403, it will be shown as successful request because the function executed successfully. But from the app's point of view, if it needs a simple correlation between requests/traces and exceptions, the workaround is to use logging.exception and assign it a error for ease of querying.
But the logging.exception when used outside of a try/catch context in Python functions does not log the exception inside exceptions table in app insights.
Here is a sample code that can be used to test this:
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
logging.exception("Before exception logging")
try:
raise ValueError("Oops. something went wrong")
except ValueError as err:
logger.exception("Simple exception logging:" + str(err))
#raise #HTTP 500 kill -> failed.
In this sample "Before exception logging" statement does not show up in the exceptions table
traces
| where message contains "Before"
exceptions
| where message contains "Before"
Overall this would have been an easier stopgap method to correlate exceptions in Python as it does not have a provision to override the custom telemetry model offered by App Insights.
- Ngôn ngữ chính
- Python
- Star
- 357
- Fork
- 117
- Merge trung bình
- 9 ngày 27 phút
- Pull request đã merge (30 ngày)
- 3
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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 Azure/azure-functions-python-worker
-
[Bug] ASGI cookie conversion serializes an absent Domain attribute and breaks __Host- cookiesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
Azure/azure-functions-python-worker#1908 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Azure/azure-functions-python-worker#1906 · 1 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
Tất cả issue của Azure/azure-functions-python-worker
Issue tương tự
-
bug status/needs-triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
prowler-cloud/prowler#12887 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area: desktop platform: macos priority: p3 status: ready type: enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
use-agent-os/agent-os#3484 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
open-telemetry/opentelemetry-python-contrib#5113 · 2 bình luận · 2 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
external
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
langchain-ai/docs#6255 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày