Skip to content

Commit 22a4e97

Browse files
authored
docs: Add troubleshooting page (#261)
* docs: Add troubleshooting page * Make it clear that observe application is debug mode is not a good idea * docs: add an entry for troubleshooting python logging auto instrumentation While at it improve a bit the configuration part for it.
1 parent 899aaea commit 22a4e97

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ With EDOT Python you have access to all the features of the OpenTelemetry Python
2424
* [Manual instrumentation](./docs/manual-instrumentation.md)
2525
* [Configuration](./docs/configure.md)
2626
* [Migrating from Elastic APM Python Agent](./docs/migrate-from-apm.md)
27+
* [Troubleshooting](./docs/troubleshooting.md)
2728

2829
## Install
2930

docs/configure.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ EDOT Python supports all configuration options listed in the [OpenTelemetry Gene
3636

3737
#### Logs
3838

39-
Exporting logs from the Python `logging` module is disabled by default and gated under a configuration environment variable:
39+
Instrument Python `logging` module to format and forward logs in OTLP format is disabled by default and gated under a configuration environment variable:
4040

4141
```sh
4242
export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
4343
```
4444

45+
> [!NOTE]
46+
> Enabling this will make any call to [logging.basicConfig](https://docs.python.org/3/library/logging.html#logging.basicConfig) from your application a no-op.
47+
4548
#### Differences from OpenTelemetry Python
4649

4750
EDOT Python uses different defaults than OpenTelemetry Python for the following configuration options:

docs/troubleshooting.md

+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!--
2+
Goal of this doc:
3+
The user is able to overcome on their own some basic issues
4+
-->
5+
6+
# Troubleshooting
7+
8+
Below are some resources and tips for troubleshooting and debugging the Elastic Distribution of OpenTelemetry Python (EDOT Python).
9+
10+
- [Easy Fixes](#easy-fixes)
11+
- [Disable EDOT](#easy-fixes)
12+
13+
## Easy Fixes
14+
15+
Before you try anything else, go through the following sections to ensure that
16+
EDOT Python is configured correctly. This is not an exhaustive list, but rather
17+
a list of common problems that users run into.
18+
19+
### Debug and development modes
20+
21+
Most frameworks support a debug mode. Generally, this mode is intended for
22+
non-production environments and provides detailed error messages and logging of
23+
potentially sensitive data. So enabling instrumentation in debug mode is not advised and may pose privacy and security issues in recording
24+
sensitive data.
25+
26+
#### Django
27+
28+
Django applications running with the Django `runserver` need to use the `--noreload` parameter in order to be instrumented with `opentelemetry-instrument`.
29+
Remember that you also need to set the `DJANGO_SETTINGS_MODULE` environment variable pointing to the application settings module.
30+
31+
#### FastAPI
32+
33+
FastAPI application started with `fastapi dev` requires the reloader to be disabled with `--no-reload` in order to be instrumented with `opentelemetry-instrument`.
34+
35+
#### Flask
36+
37+
Flask applications running in debug mode will require to disable the reloader in order to being traced, see [OpenTelemetry zero code documentation](https://opentelemetry.io/docs/zero-code/python/example/#instrumentation-while-debugging).
38+
39+
## Disable EDOT
40+
41+
In the unlikely event EDOT Python causes disruptions to a production application, you can disable it while you troubleshoot.
42+
43+
To disable the underlying OpenTelemetry SDK you set the following environment variable `OTEL_SDK_DISABLED=true`.
44+
45+
If only a subset of instrumentation are causing disruptions you can disable them with the `OTEL_PYTHON_DISABLED_INSTRUMENTATIONS`
46+
environment variable. It accepts a list of comma separated instrumentations to disable, see [OpenTelemetry zero code documentation](https://opentelemetry.io/docs/zero-code/python/configuration/#disabling-specific-instrumentations)
47+
48+
## Missing logs
49+
50+
Enabling the Python logging module auto-instrumentation with `OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true` calls the
51+
[logging.basicConfig](https://docs.python.org/3/library/logging.html#logging.basicConfig) method that will make your own application calls
52+
to it a no-op. The side effect of this is that you won't see your application logs in the console anymore.
53+
54+
If you are already shipping logs by other means you don't need to enable this.
55+
56+
<!-- TODO: when available add link to to propose other option https://elastic.github.io/opentelemetry/use-cases/logs/ -->

0 commit comments

Comments
 (0)