opentelemetry-sqlcommenter

Google Cloud Platform

Introduction

This guide will help you add sqlcommenter to your Django applications running on Google Cloud Platform (GCP)

Requirements

Steps Resource
Django on GCP https://cloud.google.com/python/django/
opentelemetry-sqlcommenter https://pypi.org/project/opentelemetry-sqlcommenter
Django 2.X https://docs.djangoproject.com/en/stable/faq/install
Python 3.X https://www.python.org/downloads/

Addition to your code

Firstly, please install opentelemetry-sqlcommenter.

For any Django deployment, we can just edit our settings.py file and update the MIDDLEWARE section as per:

MIDDLEWARE = [
  'opentelemetry.sqlcommenter.django.middleware.SqlCommenter',
  ...
]

If any middleware execute database queries (that you’d like commented by SqlCommenter), those middleware MUST appear after ‘opentelemetry.sqlcommenter.django.middleware.SqlCommenter’

References

Resource URL
Running Django on GCP https://cloud.google.com/python/django/
Installing Django middleware link