-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- clear logging format - fix #557
- Loading branch information
Showing
14 changed files
with
116 additions
and
188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
83 changes: 0 additions & 83 deletions
83
plugins/PY/pinpointPy/Fastapi/_MotorMongo/motorCommandPlugins.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,8 @@ | |
# ------------------------------------------------------------------------------ | ||
|
||
import importlib | ||
import warnings | ||
|
||
from pinpointPy.Fastapi.PinTranscation import PinTransaction, PinStarlettePlugin | ||
from pinpointPy.Fastapi.AsyCommonPlugin import CommonPlugin | ||
from pinpointPy.Fastapi.AsyCommon import AsyncTraceContext | ||
|
@@ -38,8 +40,15 @@ def __monkey_patch(*args, **kwargs): | |
monkey_patch() | ||
|
||
|
||
def async_monkey_patch_for_pinpoint(AioRedis=True, MotorMongo=True, httpx=True): | ||
__monkey_patch(_aioredis=AioRedis, _MotorMongo=MotorMongo, _httpx=httpx) | ||
def async_monkey_patch_for_pinpoint(AioRedis=True, httpx=True): | ||
__monkey_patch(_aioredis=AioRedis, _httpx=httpx) | ||
|
||
|
||
def asyn_monkey_patch_for_pinpoint( | ||
AioRedis=True, httpx=True): | ||
warnings.warn( | ||
"deprecated try to use `async_monkey_patch_for_pinpoint`", DeprecationWarning) | ||
async_monkey_patch_for_pinpoint(AioRedis, httpx) | ||
|
||
|
||
def use_starlette_context(): | ||
|
@@ -48,5 +57,5 @@ def use_starlette_context(): | |
|
||
__version__ = '0.0.2' | ||
__author__ = '[email protected]' | ||
__all__ = ['async_monkey_patch_for_pinpoint', 'use_starlette_context', 'PinPointMiddleWare', | ||
__all__ = ['async_monkey_patch_for_pinpoint', 'asyn_monkey_patch_for_pinpoint', 'use_starlette_context', 'PinPointMiddleWare', | ||
'CommonPlugin', 'PinTransaction', 'PinHeader', 'GenPinHeader', 'PinStarlettePlugin'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,27 +26,14 @@ | |
def monkey_patch(): | ||
|
||
try: | ||
from pymongo.collection import Collection | ||
from .MongoClientPlugin import MongoClientPlugin | ||
Interceptors = [ | ||
Interceptor(Collection, 'find', MongoClientPlugin), | ||
# Interceptor(Collection, 'insert', MongoClientPlugin), | ||
# Interceptor(Collection, 'update', MongoClientPlugin), | ||
Interceptor(Collection, 'update_many', MongoClientPlugin), | ||
Interceptor(Collection, 'delete_one', MongoClientPlugin), | ||
Interceptor(Collection, 'delete_many', MongoClientPlugin), | ||
Interceptor(Collection, 'insert_many', MongoClientPlugin), | ||
Interceptor(Collection, 'insert_one', MongoClientPlugin), | ||
] | ||
|
||
for interceptor in Interceptors: | ||
interceptor.enable() | ||
|
||
from pymongo import monitoring | ||
from .MongoClientPlugin import CommandLogger | ||
monitoring.register(CommandLogger()) | ||
except ImportError as e: | ||
get_logger().info(f'exception at {e}') | ||
|
||
|
||
__all__ = ['monkey_patch'] | ||
|
||
__version__ = '0.0.2' | ||
__version__ = '0.0.4' | ||
__author__ = '[email protected]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.