Help us shape the future of Go! Take the 2026 Go Developer Survey

apm

package module
v0.0.0-...-de72a6a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 4 Imported by: 4

README

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Middleware

func Middleware(componentName string) func(http.Handler) http.Handler

Types

This section is empty.

Directories

Path Synopsis
examples module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL