opentracing

package
v0.12.8 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2021 License: MIT Imports: 3 Imported by: 0

README

opentracing中间件使用方法

安装

go get github.com/hanguangbaihuo/sparrow_cloud_go

iris框架中使用方法

import "github.com/hanguangbaihuo/sparrow_cloud_go/middleware/opentracing"

func main() {
    // 初始化iris app
    app := iris.New()
    // 使用opentracing中间件,从header中b3 headers,用于之后注入restclient请求头
    app.Use(opentracing.Serve)
    ...
}

注意

该中间件需要配合restclient包使用,才能实现链路追踪
restclient包的地址:github.com/hanguangbaihuo/sparrow_cloud_go/restclient

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HeaderStore []Entry

HeaderStore is global variable to saving opentracing b3 headers

View Source
var OpentracingInf = new(OpentracingHeader)

OpentracingInf global variable to transmit opentracing b3 header data

Functions

func Serve

func Serve(ctx context.Context)

Serve is for saving incoming request header of b3

func ServeBk added in v0.4.2

func ServeBk(ctx context.Context)

ServeBk is for saving incoming request header of b3 it is a backup fucntion for Serve in this middleware

Types

type Entry added in v0.4.2

type Entry struct {
	Key   string
	Value []string
}

Entry is key value store struct

type OpentracingHeader added in v0.4.2

type OpentracingHeader struct {
	sync.RWMutex
	Headers interface{}
}

OpentracingHeader is saving opentracing b3 header data field Headers is map[string][]string type

func (*OpentracingHeader) GetHeaders added in v0.4.2

func (oh *OpentracingHeader) GetHeaders() interface{}

GetHeaders get OpentracingHeader Headers function

func (*OpentracingHeader) SetHeaders added in v0.4.2

func (oh *OpentracingHeader) SetHeaders(data interface{})

SetHeaders set OpentracingHeader Headers function

Jump to

Keyboard shortcuts

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