All Projects → smacker → opentracing-gorm

smacker / opentracing-gorm

Licence: MIT license
OpenTracing instrumentation for GORM.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to opentracing-gorm

Echo Web
Go web framework Echo example. 在线演示☞迁移ing❌
Stars: ✭ 409 (+789.13%)
Mutual labels:  gorm, opentracing
Go Project Sample
Introduce the best practice experience of Go project with a complete project example.通过一个完整的项目示例介绍Go语言项目的最佳实践经验.
Stars: ✭ 344 (+647.83%)
Mutual labels:  gorm, opentracing
Gin bbs
Gin BBS App
Stars: ✭ 123 (+167.39%)
Mutual labels:  gorm
BEW-2.5-Strongly-Typed-Languages
💪 Learn and implement the design patterns and best practices that make Go a top choice at high-velocity startups like Lyft, Heroku, Docker, Medium, and more!
Stars: ✭ 14 (-69.57%)
Mutual labels:  gorm
Grails Data Mapping
GORM - Groovy Object Mapping
Stars: ✭ 194 (+321.74%)
Mutual labels:  gorm
Go Web
Modern Web Application with Golang
Stars: ✭ 138 (+200%)
Mutual labels:  gorm
Golang Project Structure
Golang Skeleton with fully version managed
Stars: ✭ 103 (+123.91%)
Mutual labels:  gorm
Gin Admin
RBAC scaffolding based on Gin + Gorm 2.0 + Casbin + Wire
Stars: ✭ 1,835 (+3889.13%)
Mutual labels:  gorm
datadog-tracer-js
[DEPRECATED] OpenTracing tracer implementation for Datadog in JavaScript.
Stars: ✭ 39 (-15.22%)
Mutual labels:  opentracing
Go Mocket
Go GORM & SQL mocking library
Stars: ✭ 190 (+313.04%)
Mutual labels:  gorm
golang-example-app
Example application
Stars: ✭ 138 (+200%)
Mutual labels:  gorm
Go init
一个用go组织项目结构,主要包括 gin, goredis, gorm, websocket, rabbitmq等。👉
Stars: ✭ 183 (+297.83%)
Mutual labels:  gorm
Gosql
golang orm and sql builder
Stars: ✭ 141 (+206.52%)
Mutual labels:  gorm
Gorm Bulk Insert
implement BulkInsert using gorm, just pass a Slice of Struct. Simple and compatible.
Stars: ✭ 241 (+423.91%)
Mutual labels:  gorm
Gorm Paginator
gorm pagination extension
Stars: ✭ 136 (+195.65%)
Mutual labels:  gorm
java-concurrent
OpenTracing-aware helpers related to java.util.concurrent
Stars: ✭ 36 (-21.74%)
Mutual labels:  opentracing
Apiproject
[https://www.sofineday.com], golang项目开发脚手架,集成最佳实践(gin+gorm+go-redis+mongo+cors+jwt+json日志库zap(支持日志收集到kafka或mongo)+消息队列kafka+微信支付宝支付gopay+api加密+api反向代理+go modules依赖管理+headless爬虫chromedp+makefile+二进制压缩+livereload热加载)
Stars: ✭ 124 (+169.57%)
Mutual labels:  gorm
Goilerplate
Clean Boilerplate of Go, Domain-Driven Design, Clean Architecture, Gin and GORM.
Stars: ✭ 173 (+276.09%)
Mutual labels:  gorm
Fuckdb
From database generate go struct,help you fuck db fields
Stars: ✭ 195 (+323.91%)
Mutual labels:  gorm
Petabridge.Tracing.ApplicationInsights
OpenTracing adapter for Microsoft Application Insights
Stars: ✭ 30 (-34.78%)
Mutual labels:  opentracing

opentracing gorm

OpenTracing instrumentation for GORM.

Install

go get -u github.com/smacker/opentracing-gorm

Usage

  1. Call otgorm.AddGormCallbacks(db) with an instance of your *gorm.DB.
  2. Clone db db = otgorm.SetSpanToGorm(ctx, db) with a span.

Example:

var gDB *gorm.DB

func init() {
    gDB = initDB()
}

func initDB() *gorm.DB {
    db, err := gorm.Open("sqlite3", ":memory:")
    if err != nil {
        panic(err)
    }
    // register callbacks must be called for a root instance of your gorm.DB
    otgorm.AddGormCallbacks(db)
    return db
}

func Handler(ctx context.Context) {
    span, ctx := opentracing.StartSpanFromContext(ctx, "handler")
    defer span.Finish()

    // clone db with proper context
    db := otgorm.SetSpanToGorm(ctx, gDB)

    // sql query
    db.First
}

Call to the Handler function would create sql span with table name, sql method and sql statement as a child of handler span.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].