Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions application/single_app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,14 @@
from route_plugin_logging import bpl as plugin_logging_bp
from functions_debug import debug_print

from opentelemetry.instrumentation.flask import FlaskInstrumentor

app = Flask(__name__, static_url_path='/static', static_folder='static')

disable_flask_instrumentation = os.environ.get("DISABLE_FLASK_INSTRUMENTATION", "0")
if not (disable_flask_instrumentation == "1" or disable_flask_instrumentation.lower() == "true"):
FlaskInstrumentor().instrument_app(app)

app.config['EXECUTOR_TYPE'] = EXECUTOR_TYPE
app.config['EXECUTOR_MAX_WORKERS'] = EXECUTOR_MAX_WORKERS
executor = Executor()
Expand Down
40 changes: 40 additions & 0 deletions docs/troubleshooting/troubleshooting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Troubleshooting

- [OpenTelemetry Settings](#opentelemetry-settings)
- [Backend call failing](#backend-call-failing)
- [Flask Instrumentation Startup Error](#flask-instrumentation-startup-error)

## OpenTelemetry Settings

- [Azure Monitor Info](https://pypi.org/project/azure-monitor-opentelemetry)
- [OpenTelemetry Settings](https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/)

## Backend call failing

SimpleChat uses flask instrumentation by default and backend calls are logged to Application Insights. Query the 'requests' table to find the failing call and note the 'operation_Id'. Use the operation ID to find associated exceptions like below.

### Query failed requests

```
requests
| where success == false
```

### Query most recent exceptions

```
exceptions
| top 10 by timestamp
```

### Query exceptions associated with a specific operation_Id

```
exceptions
| where operation_Id == '61a97b6a6ddc11b465b5289738bddcf1'
```

## Flask Instrumentation Startup Error

If startup logs show an error initializing Flask Instrumentation it can be disabled using environment variable DISABLE_FLASK_INSTRUMENTATION. Set it to '1' or 'true' to disable flask instrumentation. **REQUIRES APP RESTART**.