Availability |
Odoo Online
Odoo.sh
On Premise
|
Community Apps Dependencies | Show |
Lines of code | 336 |
Technical Name |
dkn_otel_gcloud |
License | OPL-1 |
Website | https://dakon.io |
Versions | 14.0 15.0 16.0 17.0 18.0 |
Integrate OpenTelemetry Exporter with Google Cloud Trace
Version: 14.0.1.0
Author: Dakon
Compatibility: Odoo 14+
Overview
Cloud Trace is a distributed tracing system by Google Cloud that helps you monitor, analyze, and debug performance issues in your applications. It visualizes latency data from requests, making it easy to identify slow operations and bottlenecks across services. Integrated with Google Cloud Console, it supports both automatic and custom instrumentation, working seamlessly with OpenTelemetry.
The exporter enables developers and DevOps teams to:
- Monitor and visualize the performance of Odoo requests (e.g., HTTP RPC calls, background jobs).
- Trace execution flow across distributed services using a standard observability format.
- Diagnose performance bottlenecks or errors by examining spans.
Installation
Instructions on how to install the module:
1. Copy the module into your Odoo addons folder. 2. Update the configuration files or use the environment variable. 3. Install the Python dependency detailed in the requirements.txt using the command bellow pip install -r requirements.txt 4. Restart the Odoo server. 5. Install module dkn_otel and dkn_otel_gcloud from menu Apps.
Configuration
There are two ways to configure this module: the first is by using the odoo.conf configuration file, and the second is to set it up using environment variables.
1. Using odoo.conf
[options] .. dkn_otel_enable = true dkn_otel_service_name = odoo dkn_otel_class = odoo.addons.dkn_otel_gcloud.patch.tools.otel.Otel ..
2. Using environment variable
|-----------------------|-----------------------------------|-------------------------| | VARIABLE | DESCRIPTION | DEFAULT | |-----------------------|-----------------------------------|-------------------------| | DKN_OTEL_ENABLE | Enable OpenTelemetry (true/false) | false | | DKN_OTEL_TIMEOUT | OLTP connect timeout | 10 | | DKN_OTEL_SKIP_PATH | Excludes path (comma separated) | /longpolling,/websocket | | DKN_OTEL_SERVICE_NAME | Custom service name | odoo | | DKN_OTEL_CLASS | Custom otel singleton class | | |-------------------------------------------------------------------------------------|
Authentication
Before running Odoo and installing this module, ensure your service has the necessary permissions to
write to Cloud Trace and Monitoring.
(1) If running on GCP (Cloud Run, GKE, GCE): use the default service
account or assign the following roles:
- Cloud Trace Agent
- Monitoring Metric Writer
-
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
Development Mode
1. Setup Development Environment
There are several ways to run this module locally for development, as it requires integrating
multiple dependencies. We propose using the docker-compose tools to streamline the installation of
the entire stack. This is just an example of docker-compose.yaml
, you can improve if
needed.
services: db: image: postgres container_name: db ports: - "5432:5432" environment: - POSTGRES_DB=postgres - POSTGRES_PASSWORD=odoo - POSTGRES_USER=odoo - PGDATA=/var/lib/postgresql/data/pgdata volumes: - db-data:/var/lib/postgresql/data/pgdata odoo: image: dakonio/odoo:14.0 container_name: odoo ports: - "80:8080" # Odoo UI (http://localhost) environment: - OPTIONS__DB_HOST=db - OPTIONS__DB_PORT=5432 - OPTIONS__DB_USER=odoo - OPTIONS__DB_NAME=odoo - OPTIONS__DB_PASSWORD=odoo - OPTIONS__LOG_HANDLER=:INFO - OPTIONS__LOG_LEVEL=info - OPTIONS__DKN_OTEL_ENABLE=true - OPTIONS__DKN_OTEL_SERVICE_NAME=odoo - OPTIONS__DKN_OTEL_CLASS=odoo.addons.dkn_otel_gcloud.patch.tools.otel.Otel - GOOGLE_APPLICATION_CREDENTIALS=/mnt/service-account.json # Service account for development volumes: - ./addons/dkn_otel:/mnt/addons/dkn_otel:ro - ./service-account.json:/mnt/service-account.json:ro tty: true depends_on: - db platform: linux/amd64 volumes: db-data: driver: local
2. Create a first event
Events represent something that happened at a specific time during the span's lifetime. They are
useful for logging key moments or actions, such as retries, errors, or state changes.
Creating your own event and sending the data to OpenTelemetry is easy; you need to use the Otel
class and call the add_event
function provided by this module.
Here is the example:
# -*- coding: utf-8 -*- from odoo import api, models from odoo.addons.dkn_otel.patch.tools.otel import Otel class Partner(models.Model): _inherit = 'res.partner' def write(self, vals): res = super(Partner, self).write(vals) Otel.add_event('update_partner', vals) return res
The code above catches the update event on the res.partner
model, and all changes will be saved to
the OpenTelemetry database.
Here the example screenshot from Cloud Trace.

Support
For support, please contact:
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module