https://github.com/opentracing-contrib/beego
a middleware for the beego web framework to use opentracing
https://github.com/opentracing-contrib/beego
beego opentracing
Last synced: 3 months ago
JSON representation
a middleware for the beego web framework to use opentracing
- Host: GitHub
- URL: https://github.com/opentracing-contrib/beego
- Owner: opentracing-contrib
- License: apache-2.0
- Created: 2019-08-07T06:45:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-12-03T07:29:31.000Z (10 months ago)
- Last Synced: 2025-06-29T01:56:57.176Z (3 months ago)
- Topics: beego, opentracing
- Language: Go
- Size: 389 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# beego
a middleware for the beego web framework to use opentracing```go
import (
"github.com/astaxie/beego"
apmbeego "github.com/opentracing-contrib/beego"
"github.com/opentracing/opentracing-go"
)const (
DefaultComponentName = "beego-demo"
)type helloController struct{ beego.Controller }
func (this *helloController) Hello() {
span, _ := opentracing.StartSpanFromContext(this.Ctx.Request.Context(), "helloController.Hello")
defer span.Finish()
this.Ctx.WriteString("hello world")
}func main() {
beego.Router("/hello", &helloController{}, "get:Hello")// use the middleware
beego.RunWithMiddleWares("localhost:8080", apmbeego.Middleware(DefaultComponentName))}
```Example: [beego-example](./examples)

