Opengintracing
trace requests using opentracing specification
Install / Use
/learn @gin-contrib/OpengintracingREADME
tracing
trace requests using opentracing specification, Download:
go get -u github.com/gin-contrib/opengintracing
See opentracing/opentracing-go for more information.
Usage
For example you have architecture like this

To start requests tracing you have to:
- On "API Gateway": start span, inject headers and pass it to services
package main
import (
...
"github.com/gin-gonic/gin"
"github.com/gin-contrib/opengintracing"
"github.com/opentracing/opentracing-go"
...
)
var trace = /* setup tracer */
func main() {
...
app := gin.Default()
app.POST("/service1",
opengintracing.NewSpan(trace, "forward to service 1"),
opengintracing.InjectToHeaders(trace, true),
service1handler)
app.POST("/service2",
opengintracing.NewSpan(trace, "forward to service 2"),
opengintracing.InjectToHeaders(trace, true),
service2handler)
...
}
- On "Service 1", "Service 2" start span inherited from "API Gateway"`s span
package main
import (
...
"github.com/gin-gonic/gin"
"github.com/gin-contrib/opengintracing"
"github.com/opentracing/opentracing-go"
...
)
var trace = /* setup tracer */
func main() {
...
refFunc := opentracing.FollowsFrom
app := gin.Default()
app.POST("",
opengintracing.SpanFromHeaders(trace, "operation", refFunc, true),
// don`t forget to inject if you want continue tracing in other service
opengintracing.InjectToHeaders(trace, true),
handler)
...
}
Also don`t forget to forward headers from "Service 1" to "Service 3"
- On "Service 3" injecting to headers is not required
package main
import (
...
"github.com/gin-gonic/gin"
"github.com/gin-contrib/opengintracing"
"github.com/opentracing/opentracing-go"
...
)
var trace = /* setup tracer */
func main() {
...
refFunc := opentracing.ChildOf
app := gin.Default()
app.POST("",
opengintracing.SpanFromHeaders(trace, "operation", refFunc, true),
handler)
...
}
TODO
- [x] add code sample
- [ ] maybe add sample with SpanFromContext
- [ ] add buildable example (needed simple logging tracer)
Related Skills
xurl
347.2kA CLI tool for making authenticated requests to the X (Twitter) API. Use this skill when you need to post tweets, reply, quote, search, read posts, manage followers, send DMs, upload media, or interact with any X API v2 endpoint.
wanwu
4.2kChina Unicom's Yuanjing Wanwu Agent Platform is an enterprise-grade, multi-tenant AI agent development platform. It helps users build applications such as intelligent agents, workflows, and rag, and also supports model management. The platform features a developer-friendly license, and we welcome all developers to build upon the platform.
mcp-gateway
40Model Context Protocol (MCP) Gateway & Registry - Central hub for managing tools, resources, and prompts for MCP-compatible LLMs. Translates REST APIs into MCP, builds virtual MCP servers with security and observability, and bridges multiple transports (stdio, SSE, streamable HTTP).
agent-deck
1.9kTerminal session manager for AI coding agents. One TUI for Claude, Gemini, OpenCode, Codex, and more.

