1""" 2tags for common error attributes 3""" 4 5import traceback 6 7from ddtrace.constants import ERROR_MSG 8from ddtrace.constants import ERROR_STACK 9from ddtrace.constants import ERROR_TYPE 10from ddtrace.internal.utils.deprecation import deprecated 11from ddtrace.internal.utils.deprecation import deprecation 12 13 14__all__ = [ERROR_MSG, ERROR_TYPE, ERROR_STACK] 15 16deprecation( 17 name="ddtrace.ext.errors", 18 message=( 19 "Use `ddtrace.constants` module instead. " 20 "Shorthand error constants will be removed. Use ERROR_MSG, ERROR_TYPE, and ERROR_STACK instead." 21 ), 22 version="1.0.0", 23) 24 25# shorthand for ERROR constants to be removed in v1.0-----^ 26MSG = ERROR_MSG 27TYPE = ERROR_TYPE 28STACK = ERROR_STACK 29 30 31@deprecated("This method and module will be removed altogether", "1.0.0") 32def get_traceback(tb=None, error=None): 33 t = None 34 if error: 35 t = type(error) 36 lines = traceback.format_exception(t, error, tb, limit=20) 37 return "\n".join(lines) 38