Skip to content

a middleware for the beego web framework to use opentracing

License

Notifications You must be signed in to change notification settings

opentracing-contrib/beego

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

beego

a middleware for the beego web framework to use opentracing

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

About

a middleware for the beego web framework to use opentracing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages