graphql-python / graphql-python/graphql-core-legacy

Exceptions in subscriptions is not logging

Đang mở
#280 2 bình luận 1 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Python
Star
372
Fork
175
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hello!

I've just found that exceptions in subscriptions are not logging, but the message of an exceptions returns to client.

```python
class OrderBookSubscription(graphene.ObjectType):
order_book = graphene.Field(
OrderBook,
pair_id=graphene.Int(required=True)
)

@classmethod
async def resolve_order_book(cls, root, info, pair_id):
listener = info.context['not exists key']
```

Request:
```json
{"id":"3","type":"start","payload":{"variables":{"pairId":11},"extensions":{},"operationName":"OrderBookWS","query":"subscription OrderBookWS($pairId: Int!) {\n orderBook(pairId: $pairId) {\n buy {\n price\n volume\n share\n __typename\n }\n sell {\n price\n volume\n share\n __typename\n }\n spread\n __typename\n }\n}\n"}}
```

Response:
```json
{"id": "3", "type": "data", "payload": {"data": {"orderBook": null}, "errors": [{"message": "'not exists key'"}]}}
{"id": "3", "type": "complete"}
```

Logs:
```
======== Running on http://0.0.0.0:8080 ========
(Press CTRL+C to quit)
2020-07-08 12:06:15,070 - Rx - DEBUG - CurrentThreadScheduler.schedule(state=None)
2020-07-08 12:06:15,072 - Rx - DEBUG - CurrentThreadScheduler.schedule(state=None)
2020-07-08 12:06:15,072 - Rx - DEBUG - CurrentThreadScheduler.schedule(state=None)
```

Also i've found exception handler, in which need to log the exception.
https://github.com/graphql-python/graphql-core-legacy/blob/master/graphql/execution/executors/asyncio_utils.py#L28

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu với graphql/execution/executors/asyncio_utils.py tại trình xử lý ngoại lệ được liên kết trong issue, sau đó tái hiện ví dụ OrderBookSubscription với khóa context bị thiếu. Xác nhận rằng ngoại lệ được ghi log trong khi phản hồi subscription vẫn báo lỗi cho client.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
api, backend
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.