Prelude
The Datadog APM Python team is happy to announce the release of v1.0.0 of ddtrace.
The first commit to the library was made on June 20, 2016. Nearly sixty minor releases later, the library has grown immensely. The library now includes over 60 integrations for libraries. Moreover, the library has expanded out from tracing to support the Continuous Profiler and CI Visibility.
Our motivations for this major version release were:
- Clarify and simplify the public API.
- Introduce a versioning policy.
- Provide users a painless upgrade path.
Upgrading and deprecation warnings
Before upgrading, we recommend resolving any deprecation warnings raised in your application. The messages for the deprecation warnings include the version when the API will be changed or removed.
As of v0.59.0, you can enable warning filters for ddtrace library deprecations.
For those using pytest
, add a filter for the ddtrace.DDTraceDeprecationWarning
warning category:
pytest -W "error::ddtrace.DDTraceDeprecationWarning" tests.py
Otherwise, you must set the environment variable DD_TRACE_RAISE_DEPRECATIONWARNING
which will configure the warning filter:
DD_TRACE_RAISE_DEPRECATIONWARNING=1 python app.py
Before v0.59.0, you can still enable all deprecation warnings and filter the application or tests logs for deprecations specific the ddtrace
library:
$ python -Wall app.py
# or
$ PYTHONWARNINGS=all python app.py
Summary of 0.x deprecations
Note | Affected |
---|---|
Removed | DATADOG_*
|
Removed | DATADOG_SERVICE_NAME
|
Disabled, Deprecated | DD_CALL_BASIC_CONFIG
|
Removed | DD_LOGGING_RATE_LIMIT
|
Removed | DD_SERVICE_NAME
|
Removed | DD_TRACER_PARTIAL_FLUSH_ENABLED
|
Removed | DD_TRACER_PARTIAL_FLUSH_MIN_SPANS
|
Removed | ddtrace.Tracer.debug_logging
|
Removed | ddtrace.Tracer.get_call_context
|
Removed | ddtrace.Tracer.tags
|
Removed | ddtrace.Tracer.writer
|
Removed | ddtrace.Tracer.__call__
|
Removed | ddtrace.Tracer.global_excepthook
|
Removed | ddtrace.Tracer.log
|
Removed | ddtrace.Tracer.priority_sampler
|
Removed | ddtrace.Tracer.sampler
|
Removed | ddtrace.Tracer.set_service_info
|
Removed | ddtrace.Span.tracer
|
Removed | ddtrace.Span.__init__(tracer=)
|
Removed | ddtrace.Span.meta
|
Removed | ddtrace.Span.metrics
|
Removed | ddtrace.Span.set_meta
|
Removed | ddtrace.Span.set_metas
|
Removed | ddtrace.Span.pprint
|
Removed | ddtrace.Pin.app
|
Removed | ddtrace.Pin.app_type
|
Removed | ddtrace.context.Context.clone
|
Removed | ddtrace.compat
|
Removed | ddtrace.contrib.util
|
Removed | ddtrace.encoding
|
Removed | ddtrace.ext.SpanTypes
|
Removed | ddtrace.ext.errors
|
Removed | ddtrace.ext.priority
|
Removed | ddtrace.ext.system
|
Removed | ddtrace.helpers.get_correlation_ids
|
Removed | ddtrace.http
|
Removed | ddtrace.monkey
|
Removed | ddtrace.propagation.utils
|
Removed | ddtrace.Sampler.default_sampler
|
Removed | ddtrace.settings.Config.HTTPServerConfig
|
Removed | ddtrace.util
|
Removed | ddtrace.utils
|
Removed | ddtrace.contrib.cassandra.get_traced_cassandra
|
Removed | ddtrace.contrib.celery.patch_task
|
Removed | ddtrace.contrib.celery.unpatch_task
|
Removed | ddtrace.contrib.mongoengine.trace_mongoengine
|
Removed | ddtrace.contrib.mysql.get_traced_mysql_connection
|
Removed | ddtrace.contrib.psycopg.connection_factory
|
Removed | ddtrace.contrib.requests.legacy
|
Removed | ddtrace.contrib.sqlite3.connection_factory
|
New Features
- HTTP connections for trace payloads to the agent will be reused when possible.
Upgrade Notes
- The deprecated attribute
ddtrace.Sampler.default_sampler
is removed. - Default value of
DD_CALL_BASIC_CONFIG
was updated fromTrue
toFalse
. Calllogging.basicConfig()
to configure logging in your application. ddtrace.settings.Config.HTTPServerConfig
is removed.- cassandra:
get_traced_cassandra
is removed. Useddtrace.patch(cassandra=True)
orddtrace.patch_all()
instead. - celery:
ddtrace.contrib.celery.patch_task
is removed. Useddtrace.patch(celery=True)
orddtrace.patch_all()
instead. - celery:
ddtrace.contrib.celery.unpatch_task
is removed. Useddtrace.contrib.celery.unpatch()
instead. ddrace.context.Context.clone
is removed. This is no longer needed since the tracer now supports asynchronous frameworks out of the box.- The deprecated module
ddtrace.contrib.util
is removed. - The deprecated module
ddtrace.compat
is removed. - The deprecated module
ddtrace.encoding
is removed. - The deprecated modules
ddtrace.http
andddtrace.http.headers
are removed. Useddtrace.contrib.trace_utils.set_http_meta
to store request and response headers on a span. - Remove deprecated
ddtrace.install_excepthook
. - Remove deprecated
ddtrace.uninstall_excepthook
. - The deprecated module
ddtrace.monkey
is removed. Useddtrace.patch
orddtrace.patch_all
instead. - The deprecated module
ddtrace.propagation.utils
is removed. - The deprecated module
ddtrace.utils
and its submodules are removed:ddtrace.utils.attr
ddtrace.utils.attrdict
ddtrace.utils.cache
ddtrace.utils.config
ddtrace.utils.deprecation
ddtrace.utils.formats
ddtrace.utils.http
ddtrace.utils.importlib
ddtrace.utils.time
ddtrace.utils.version
ddtrace.utils.wrappers
ddtrace.Tracer.sampler
is removed.ddtrace.Tracer.priority_sampler
is removed.ddtrace.Tracer.tags
is removed. Use the environment variableDD_TAGS
to set the global tags instead.ddtrace.Tracer.log
was removed.- The deprecated module
ddtrace.ext.errors
is removed. Use theddtrace.constants
module instead:from ddtrace.constants import ERROR_MSG from ddtrace.constants import ERROR_STACK from ddtrace.constants import ERROR_TYPE
- The deprecated module
ddtrace.ext.priority
is removed. Use theddtrace.constants
module instead for setting sampling priority tags:from ddtrace.constants import USER_KEEP from ddtrace.constants import USER_REJECT
- The deprecated module
ddtrace.ext.system
is removed. Useddtrace.constants.PID
instead. - The deprecated method
ddtrace.helpers.get_correlation_ids
is removed. Useddtrace.Tracer.get_log_correlation_context()
instead. - The legacy environment variables
DD_SERVICE_NAME
andDATADOG_SERVICE_NAME
are removed. UseDD_SERVICE
instead. - mongoengine: The deprecated method
ddtrace.contrib.mongoengine.trace_mongoengine
is removed. Useddtrace.patch(mongoengine=True)
orddtrace.patch()
instead. - mysql: The deprecated method
ddtrace.contrib.mysql.get_traced_mysql_connection
is removed. Useddtrace.patch(mysql=True)
orddtrace.patch_all()
instead. Pin.app
is removed.Pin.app_type
is removed.- psycopg:
ddtrace.contrib.psycopg.connection_factory
is removed. Useddtrace.patch(psycopg=True)
orddtrace.patch_all()
instead. - requests: The legacy distributed tracing configuration is removed. Use
ddtrace.config.requests[‘distributed_tracing’]
instead. ddtrace.Span.meta
is removed. Useddtrace.Span.get_tag()
andddtrace.Span.set_tag()
instead.ddtrace.Span.metrics
is removed. Useddtrace.Span.get_metric()
andddtrace.Span.set_metric()
instead.ddtrace.Span.pprint
is removed.Span.tracer
is removed.- The deprecated tracer argument is removed from
ddtrace.Span.__init__()
. - sqlite3:
ddtrace.contrib.sqlite3.connection_factory
is removed. Useddtrace.patch(sqlite3=True)
orddtrace.patch_all()
instead. - Remove deprecated attribute
ddtrace.Tracer.debug_logging
. Set the logging level for theddtrace.tracer
logger instead:import logging log = logging.getLogger("ddtrace.tracer") log.setLevel(logging.DEBUG)
ddtrace.Tracer.__call__
is removed.ddtrace.Tracer.global_excepthook
is removed.ddtrace.Tracer.get_call_context
is removed. Useddtrace.Tracer.current_trace_context()
instead.ddtrace.Tracer.set_service_info
is removed.ddtrace.Tracer.writer
is removed. To force flushing of buffered traces to the agent, useddtrace.Tracer.flush()
instead.- The environment variables prefixed with
DATADOG_
are removed. Use environment variables prefixed withDD_
instead. - The environment variable
DD_LOGGING_RATE_LIMIT
is removed. UseDD_TRACE_LOGGING_RATE
instead. - The environment variable
DD_TRACER_PARTIAL_FLUSH_ENABLED
is removed. UseDD_TRACE_PARTIAL_FLUSH_ENABLED
instead. - The environment variable
DD_TRACER_PARTIAL_FLUSH_MIN_SPANS
is removed. UseDD_TRACE_PARTIAL_FLUSH_MIN_SPANS
instead. ddtrace.util
is removed.ddtrace.ext.SpanTypes
is no longer anEnum
. UseSpanTypes.TYPE
instead ofSpanTypes.TYPE.value
.Tracer.write
has been removed.- Removed deprecated middleware
ddtrace.contrib.flask.middleware.py:TraceMiddleware
. Useddtrace.patch_all()
orddtrace.patch()
instead. - Removed deprecated function
ddtrace.contrib.pymongo.patch.py:trace_mongo_client
. Useddtrace.patch_all()
orddtrace.patch()
instead. - Removed deprecated function
ddtrace.contrib.pymysql.tracers.py:get_traced_pymysql_connection
. Useddtrace.patch_all()
orddtrace.patch()
instead. - Removed deprecated function
ddtrace.contrib.redis.tracers.py:get_traced_redis
. Useddtrace.patch_all()
orddtrace.patch()
instead. - Removed deprecated function
ddtrace.contrib.redis.tracers.py:get_traced_redis_from
. Useddtrace.patch_all()
orddtrace.patch()
instead.
Deprecation Notes
DD_CALL_BASIC_CONFIG
is deprecated.
Bug Fixes
- tracing/internal: fix encoding of propagated internal tags.