# Tracing Gorm queries with OpenCensus & Google Cloud Tracing

DevFeed: [Tracing Gorm queries with OpenCensus & Google Cloud Tracing](<https://devfeed.tech/articles/tracing-gorm-queries-with-opencensus-google-cloud-tracing-11791.md>)

Original publisher: [Read original article](<https://incident.io/blog/gorm-tracing>)

Author: Alex Russell-Saw

Published: 2022-07-07T00:00:00Z

Content type: tutorial

Language: en

Sources: [The incident.io Blog](<https://devfeed.tech/sources/the-incident-io-blog.md>)

Topics: [tracing](<https://devfeed.tech/topics/tracing.md>), [Traces](<https://devfeed.tech/topics/traces.md>), [Go Language](<https://devfeed.tech/topics/go-language.md>), [Object-relational mapping](<https://devfeed.tech/topics/orm.md>), [Databases](<https://devfeed.tech/topics/databases.md>), [Google](<https://devfeed.tech/topics/google.md>), [Cloud](<https://devfeed.tech/topics/cloud.md>), [Code](<https://devfeed.tech/topics/code.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [database](<https://devfeed.tech/tags/database.md>), [go](<https://devfeed.tech/tags/go.md>), [google](<https://devfeed.tech/tags/google.md>), [google-cloud](<https://devfeed.tech/tags/google-cloud.md>), [incident](<https://devfeed.tech/tags/incident.md>), [incident-channel](<https://devfeed.tech/tags/incident-channel.md>), [incident-management](<https://devfeed.tech/tags/incident-management.md>), [incident-response](<https://devfeed.tech/tags/incident-response.md>), [observability](<https://devfeed.tech/tags/observability.md>), [orm](<https://devfeed.tech/tags/orm.md>), [outage](<https://devfeed.tech/tags/outage.md>), [post-mortem](<https://devfeed.tech/tags/post-mortem.md>), [slack-incident](<https://devfeed.tech/tags/slack-incident.md>), [sql](<https://devfeed.tech/tags/sql.md>), [traces](<https://devfeed.tech/tags/traces.md>), [tracing](<https://devfeed.tech/tags/tracing.md>)

## AI overview

This tutorial explains how to add tracing to Gorm database queries using its Callbacks API and OpenCensus tools that feed into Google Cloud Tracing. It covers creating and ending spans, enriching them with query fingerprints, and sanitizing sensitive query variables.

## Source excerpt

Giving your traces superpowers with enriched metadata from your gorm queries