```opentelemetry-instrument python manage.py runse...
# support
c
Copy code
opentelemetry-instrument python manage.py runserver --noreload
You are using Python 3.6. This version does not support timestamps with nanosecond precision and the OpenTelemetry SDK will use millisecond precision instead. Please refer to PEP 564 for more information. Please upgrade to Python 3.7 or newer to use nanosecond precision.
Instrumenting of django failed
Traceback (most recent call last):
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 81, in _load_instrumentors
    distro.load_instrumentor(entry_point, skip_dep_check=True)
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/distro.py", line 63, in load_instrumentor
    instrumentor().instrument(**kwargs)
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/instrumentor.py", line 106, in instrument
    **kwargs
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/django/__init__.py", line 132, in _instrument
    settings_middleware = getattr(settings, "MIDDLEWARE", [])
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/django/conf/__init__.py", line 64, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting MIDDLEWARE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
Failed to auto initialize opentelemetry
Traceback (most recent call last):
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 111, in initialize
    _load_instrumentors(distro)
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 85, in _load_instrumentors
    raise exc
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 81, in _load_instrumentors
    distro.load_instrumentor(entry_point, skip_dep_check=True)
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/distro.py", line 63, in load_instrumentor
    instrumentor().instrument(**kwargs)
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/instrumentor.py", line 106, in instrument
    **kwargs
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/django/__init__.py", line 132, in _instrument
    settings_middleware = getattr(settings, "MIDDLEWARE", [])
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/django/conf/__init__.py", line 64, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting MIDDLEWARE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <<http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>>.
  """)
Performing system checks...
I hope someone can share an insight. 🙂
p
@User You may want to have a look at this
@User Have you added environment variables before running this command OTEL_METRICS_EXPORTER=none OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> OTEL_EXPORTER_OTLP_ENDPOINT="http://<IP of SigNoz Backend>:4317" opentelemetry-instrument <your run command>
The instructions on how to run this sample app might also be helpful - https://github.com/SigNoz/sample-flask-app
Also which OS are you trying this on - Linux or Mac?
c
Hey, where should those env variables be placed? I'm running linux
BTW I was using https://signoz.io/blog/python-application-monitoring/ This page to help me setup, and I used
OTEL_RESOURCE_ATTRIBUTES=service.name=entri-main-service OTEL_EXPORTER_OTLP_ENDPOINT="<http://localhost:4317>" opentelemetry-instrument ./manage.py runserver --noreload
this to run the server for my project
@User Please follow the above doc.
c
Getting the same error with it. Shall we move this conversation to DMs?
OTEL_METRICS_EXPORTER=none OTEL_RESOURCE_ATTRIBUTES=service.name=testApp OTEL_EXPORTER_OTLP_ENDPOINT="http://127.0.0.1:4317" opentelemetry-instrument ./manage.py runserver 0.0.0.0:8000 You are using Python 3.6. This version does not support timestamps with nanosecond precision and the OpenTelemetry SDK will use millisecond precision instead. Please refer to PEP 564 for more information. Please upgrade to Python 3.7 or newer to use nanosecond precision. Instrumenting of django failed Traceback (most recent call last): File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 81, in _load_instrumentors distro.load_instrumentor(entry_point, skip_dep_check=True) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/distro.py", line 63, in load_instrumentor instrumentor().instrument(**kwargs) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/instrumentor.py", line 106, in instrument **kwargs File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/django/__init__.py", line 132, in _instrument settings_middleware = getattr(settings, "MIDDLEWARE", []) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in getattr self._setup(name) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/django/conf/__init__.py", line 64, in _setup % (desc, ENVIRONMENT_VARIABLE)) django.core.exceptions.ImproperlyConfigured: Requested setting MIDDLEWARE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. Failed to auto initialize opentelemetry Traceback (most recent call last): File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 111, in initialize _load_instrumentors(distro) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 85, in _load_instrumentors raise exc File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/auto_instrumentation/sitecustomize.py", line 81, in _load_instrumentors distro.load_instrumentor(entry_point, skip_dep_check=True) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/distro.py", line 63, in load_instrumentor instrumentor().instrument(**kwargs) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/instrumentor.py", line 106, in instrument **kwargs File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/opentelemetry/instrumentation/django/__init__.py", line 132, in _instrument settings_middleware = getattr(settings, "MIDDLEWARE", []) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in getattr self._setup(name) File "/home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/django/conf/__init__.py", line 64, in _setup % (desc, ENVIRONMENT_VARIABLE)) django.core.exceptions.ImproperlyConfigured: Requested setting MIDDLEWARE, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings. /home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/psycopg2/__init__.py144 UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>. """) /home/cmkishores/.virtualenvs/entri/lib/python3.6/site-packages/psycopg2/__init__.py144 UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>. """) Watching for file changes with StatReloader INFOdjango.utils.autoreloadWatching for file changes with StatReloader Performing system checks.
Copy code
`
a
Hi @User are you able to run django without any opentelemetry and signoz config and settings using
python manage.py runserver --noreload
?
Maybe you need to set
Copy code
export DJANGO_SETTINGS_MODULE=mysite.settings
as given in https://stackoverflow.com/a/26089302/3243212
c
Yea I'm able to run the project with out OT. It works fine.
I did try an initial googling and did that answer suggested in the above post. Its supposed to be run just before the init for django OT calls the settings Lazy object to insert middlewares. Right?