Allow django to be instrumented automatically (#1239)

This commit is contained in:
Owais Lone
2020-10-14 21:43:27 +05:30
committed by GitHub
parent 904a938c6d
commit 5bc4e2882b
3 changed files with 3 additions and 20 deletions

View File

@ -2,6 +2,8 @@
## Unreleased
- Django instrumentation is now enabled by default but can be disabled by setting `OTEL_PYTHON_DJANGO_INSTRUMENT` to `False` ([#1239](https://github.com/open-telemetry/opentelemetry-python/pull/1239))
## Version 0.14b0
Released 2020-10-13

View File

@ -41,7 +41,7 @@ class DjangoInstrumentor(BaseInstrumentor):
# built inside the Configuration class itself with the magic method
# __bool__
if not Configuration().DJANGO_INSTRUMENT:
if Configuration().DJANGO_INSTRUMENT is False:
return
# This can not be solved, but is an inherent problem of this approach:

View File

@ -1,19 +0,0 @@
# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from os import environ
def pytest_sessionstart(session): # pylint: disable=unused-argument
environ.setdefault("OTEL_PYTHON_DJANGO_INSTRUMENT", "True")