open-telemetry / open-telemetry/opentelemetry-python-contrib

[Django Instrumentation] Exception on settings not raised when using instrumentor and django environ

Open
#1,878 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
1.1k
Forks
1.1k
Avg merge
4d 15h
Merged PRs (30d)
16

Description

Describe your environment Describe any aspect of your environment relevant to the problem, including your Python version, platform, version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on main.

Using python 3.8, Django 4.1.9 and django-environ 0.10.0 on a docker python:3.8-slim-buster

Steps to reproduce
Describe exactly how to reproduce the error. Include a code sample if applicable.

  • Install a django project and use django environ for settings.
  • Declare a settings based on an env variable not existing (on settings.py) with no default:
    NOT_EXISTING = env.str("NOT_EXISTING")

What is the expected behavior?
What did you expect to see?

See the exception in the console: django.core.exceptions.ImproperlyConfigured: Set the NOT_EXISTING environment variable

What is the actual behavior?
What did you see instead?

No error. And Django settings not loaded and backed up to the default ones.

Additional context
Add any other context about the problem here.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with a Django project's settings.py using django-environ and a missing NOT_EXISTING variable, then inspect the Django instrumentor's settings-loading entry point. Done means Django raises django.core.exceptions.ImproperlyConfigured instead of falling back to default settings; no test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.