/plushcap/analysis/incident-io/gorm-tracing

Tracing Gorm queries with OpenCensus & Google Cloud Tracing

What's this blog post about?

This post discusses how to implement tracing for Gorm database queries using OpenCensus and Google Cloud Tracing libraries. The author explains how to use Gorm's Callbacks API to hook into the query lifecycle, allowing them to pull out data for observability purposes. They demonstrate how to start and end spans in their tracing system, as well as how to make these spans more informative by adding table names, query fingerprints, line of code that called the query, WHERE params from select queries, and number of rows affected. The author also provides a link to the full code implementation for this process.

Company
Incident.io

Date published
July 7, 2022

Author(s)
Alex Russell-Saw

Word count
1010

Hacker News points
None found.

Language
English


By Matt Makai. 2021-2024.