mirror of
https://github.com/open-telemetry/opentelemetry-python-contrib.git
synced 2025-07-31 22:23:12 +08:00
21 lines
437 B
Python
21 lines
437 B
Python
import mongoengine
|
|
|
|
from .trace import WrappedConnect
|
|
from ...utils.deprecation import deprecated
|
|
|
|
# Original connect function
|
|
_connect = mongoengine.connect
|
|
|
|
|
|
def patch():
|
|
setattr(mongoengine, 'connect', WrappedConnect(_connect))
|
|
|
|
|
|
def unpatch():
|
|
setattr(mongoengine, 'connect', _connect)
|
|
|
|
|
|
@deprecated(message='Use patching instead (see the docs).', version='1.0.0')
|
|
def trace_mongoengine(*args, **kwargs):
|
|
return _connect
|