-
Notifications
You must be signed in to change notification settings - Fork 457
chore(logging): remove DD_CALL_BASIC_CONFIG #6612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Yun-Kim
merged 27 commits into
yunkim/remove-deprecated-items
from
yunkim/remove-dd-call-basic-config
Sep 1, 2023
Merged
chore(logging): remove DD_CALL_BASIC_CONFIG #6612
Yun-Kim
merged 27 commits into
yunkim/remove-deprecated-items
from
yunkim/remove-dd-call-basic-config
Sep 1, 2023
Conversation
This file contains hidden or 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
16 tasks
e8861a2
to
c852461
Compare
9d5c0b5
to
3b71d19
Compare
majorgreys
reviewed
Aug 8, 2023
BenchmarksBenchmark execution time: 2023-08-31 17:43:46 Comparing candidate commit be1315f in PR branch Found 8 performance improvements and 8 performance regressions! Performance is the same for 88 metrics, 0 unstable metrics. scenario:flasksimple-appsec-telemetry
scenario:flasksimple-tracer
scenario:iastpropagation-no-propagation
scenario:otelspan-add-metrics
scenario:otelspan-add-tags
scenario:otelspan-start-finish
scenario:samplingrules-high_match
scenario:sethttpmeta-obfuscation-disabled
scenario:sethttpmeta-obfuscation-worst-case-explicit-query
scenario:span-add-tags
scenario:span-start-finish
scenario:span-start-finish-telemetry
scenario:span-start-finish-traceid128
scenario:tracer-large
scenario:tracer-medium
scenario:tracer-small
|
Includes: - pinning images and package dependencies in CircleCI - removing stale `master` branch - dropping pylons framework test - updating versioning documentation - drop Python < 3.7 as supported on setup.py - removing pylons/boto from CI suitespec - release note for 2.0
c852461
to
2b1be4e
Compare
d81b90f
to
79847db
Compare
Instead of calling loggging.basicConfig(), we instead now configure the ddtrace level logger at module startup (no longer at sitecustomize.py or tracer startup) to add a stdout Streamhandler (or file logger) to avoid interfering with root-level logger configurations. Note that we still configure logging injection at sitecustomize.py and tracer startup since that requires logging to be patched.
79847db
to
32d2252
Compare
8d282dc
to
53ac887
Compare
3df6aa0
to
6dd797c
Compare
9db3d20
to
3adb946
Compare
cbc6135
to
228bacb
Compare
228bacb
to
87626e9
Compare
ed0da3f
to
0173519
Compare
c804748
to
3669723
Compare
3669723
to
a1b047f
Compare
mabdinur
approved these changes
Sep 1, 2023
Yun-Kim
added a commit
that referenced
this pull request
Sep 5, 2023
This PR adds a note to upgrade to 2.x in `upgrading.rst` and removes all deprecated items slated for removal in 2.0.0. This includes: - `DD_GEVENT_PATCH_ALL`: no special configuration is now necessary to make `ddtrace-run` work with gevent. - `DD_AWS_TAG_ALL_PARAMS`: the boto/botocore/aiobotocore integrations no longer collect all API parameters by default. - `DD_REMOTECONFIG_POLL_SECONDS`: replaced by `DD_REMOTE_CONFIG_POLL_INTERVAL_SECONDS` - ASM deprecated constants including ``APPSEC_ENABLED``, ``APPSEC_JSON``, ``APPSEC_EVENT_RULE_VERSION``, ``APPSEC_EVENT_RULE_ERRORS``, ``APPSEC_EVENT_RULE_LOADED``, ``APPSEC_EVENT_RULE_ERROR_COUNT``, ``APPSEC_WAF_DURATION``, ``APPSEC_WAF_DURATION_EXT``, ``APPSEC_WAF_TIMEOUTS``, ``APPSEC_WAF_VERSION``, ``APPSEC_ORIGIN_VALUE``, ``APPSEC_BLOCKED``, ``IAST_JSON``, ``IAST_ENABLED``, ``IAST_CONTEXT_KEY``. These constants were meant for private use only and should not affect existing code. - ``ddtrace.contrib.grpc.constants.GRPC_PORT_KEY``: replaced by `ddtrace.ext.net.TARGET_PORT` - ``ddtrace.ext.cassandra.ROW_COUNT``, ``ddtrace.ext.mongo.ROW_COUNT``, ``ddtrace.ext.sql.ROW_COUNT``: replaced by `ddtrace.ext.db.ROWCOUNT` - `ddtrace.filters.TraceCiVisibilityFilter`: removed as this was for private use only and does not affect existing code. - `ddtrace.contrib.starlette.get_resource` and `ddtrace.contrib.starlette.span_modifier` and `ddtrace.contrib.fastapi.span_modifier`: the fastapi and starlette integrations now provide the full route and not just mounted route for sub-applications by default. - `ddtrace.contrib.starlette.config['aggregate_resources']` and `ddtrace.contrib.fastapi.config['aggregate_resources']`: the starlette and fastapi integrations no longer have the option to aggregate resources as this occurs by default now. - `DD_TRACE_OBFUSCATION_QUERY_STRING_PATTERN`: replaced by `DD_TRACE_OBFUSCATION_QUERY_STRING_REGEXP`. Additionally, the `pep562` dependency and references to it have been removed as it is no longer needed after dropping support for Python < 3.7. Note that `DD_CALL_BASIC_CONFIG` and `DD_LOG_FORMAT` are removed in #6612 which includes a subtle change in functionality. ## Checklist - [x] Change(s) are motivated and described in the PR description. - [x] Testing strategy is described if automated tests are not included in the PR. - [x] Risk is outlined (performance impact, potential for breakage, maintainability, etc). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] [Library release note guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html) are followed. If no release note is required, add label `changelog/no-changelog`. - [x] Documentation is included (in-code, generated user docs, [public corp docs](https://github.com/DataDog/documentation/)). - [x] Backport labels are set (if [applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)) ## Reviewer Checklist - [x] Title is accurate. - [x] No unnecessary changes are introduced. - [x] Description motivates each change. - [x] Avoids breaking [API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces) changes unless absolutely necessary. - [x] Testing strategy adequately addresses listed risk(s). - [x] Change is maintainable (easy to change, telemetry, documentation). - [x] Release note makes sense to a user of the library. - [x] Reviewer has explicitly acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment. - [x] Backport labels are set in a manner that is consistent with the [release branch maintenance policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes the
DD_CALL_BASIC_CONFIG
environment variable andDD_LOG_FORMAT
constant from the public API, and features a subtle change in the library's logging functionality to avoid configuring the user application's root-level logger. Moving forward, we will configure theddtrace
level logger instead.Additionally, this PR adds a new default behavior to ensure that ddtrace will always log to both stdout (stream) and/or file if configured to log to file. Previously ddtrace would only log to stream OR file, but this isn't intuitive for users.
Background
DD_CALL_BASIC_CONFIG
was deprecated as of #3168 (February 2022). This environment variable is currently used to enable the ddtrace library to calllogging.basicConfig()
to configure and format the root logger to print logs to stdout (when being run inddtrace-run
or through tracer debugging mode).However, the ddtrace library is not a logging library and calling
logging.basicConfig()
will configure the root-level logger and invalidate any future calls tologging.basicConfig()
, meaning this will potentially interfere with user logging configuration. User applications should be responsible for callinglogging.basicConfig()
instead of ddtrace.Proposed Solution
Instead of calling loggging.basicConfig(), we instead now configure the ddtrace level logger at module startup (no longer at sitecustomize.py or tracer startup) to add a stdout Streamhandler (or file logger if specified by
DD_TRACE_LOG_FILE
) to avoid interfering with root-level logger configurations. Note that we still configure logging injection at sitecustomize.py and tracer startup since that requires logging to be patched.Note: this PR leaves one usage of
logging.basicConfig()
inddtrace/commands/ddtrace_run.py
. This will not impact user application logging because ourddtrace-run
script replaces the currently running process with the bootstrap script and user application throughos.execl(...)
, meaning this will reset a new logging configuration to default and be unaffected once the bootstrap sitecustomize and user application starts running. This approach will leave ddtrace-run debugging logs to be printed to stdout but still avoids interfering with user application logging configurations.Checklist
changelog/no-changelog
.Reviewer Checklist