func GetCtxTrace(ctx context.Context) (*Trace, bool) {
	val, ok := ctx.Value(ctxKey).(*Trace)
	return val, ok
}
GetCtxTrace get context *Trace
package trace
import (
	"bytes"
	"context"
	"encoding/hex"
	"encoding/json"
	"fmt"
	"math/rand"
	"net"
	"net/http"
	"os"
	"strings"
	"sync"
	"time"
)
var (
	ip     string
	ctxKey key
)
const (
	DIDI_HEADER_RID = "Didi-Header-Rid"
	DIDI_HEADER_SPANID       = "Didi-Header-Spanid"
	DIDI_HEADER_HINT_CODE    = "Didi-Header-Hint-Code"
	DIDI_HEADER_HINT_CONTENT = "Didi-Header-Hint-Content"
	EMPRY_TRACE_ID = ""
	TRACEID        = "traceid"
	SPANID         = "spanid"
	CALLER         = "caller"
	SRC_METHOD     = "srcMethod"
	HINT_CODE      = "hintCode"
	HINT_CONTENT   = "hintContent"
	DLTagUndefined        = " _undef"
	DLTagMysqlFailed      = " _com_mysql_failure"
	DLTagMysqlSuccess     = " _com_mysql_success"
	DLTagRedisFailed      = " _com_redis_failure"
	DLTagRedisSuccess     = " _com_redis_success"
	DLTagThriftFailed     = " _com_thrift_failure"
	DLTagThriftSuccess    = " _com_thrift_success"
	DLTagHTTPSuccess      = " _com_http_success"
	DLTagHTTPFailed       = " _com_http_failure"
	DLTagBackendRPCFailed = " _com_interactive_failure"
	DLTagRequestIn        = " _com_request_in"
	DLTagRequestOut       = " _com_request_out"
	EMPTY_SPAN_ID             string = "0"
	HINT_PRESSURE_TRAFFIC            = "1"
	HINT_NORMAL_TRAFFIC              = "0"
	HINT_TRACE_SAMPLE_INIT    int64  = 0x80
	HINT_TRACE_SAMPLE         int64  = 0x40
	DEFAULT_TRACE_SAMPLE_RATE int64  = 10000
)
type Trace struct {
	TraceId      string
	SpanId       string
	Caller       string
	SrcMethod    string
	Method       string
	Host         string
	URL          string
	Params       string
	From         string
	HintCode     string
	Sampling     int
	HintContent  string
	FormatString string
}
type HintContent struct {
	Sample HintSampling `json:"Sample"`
}
type HintSampling struct {
	Rate int64 `json:"Rate"`
	Code int64 `json:"Code"`
}
type key int
func (k *key) GetCtxKey() interface{} {
	return ctxKey
}
type ICtxKey interface {
	GetCtxKey() interface{}
}
func NewCtxKey() ICtxKey {
	return new(key)
}
func SetCtxTrace(ctx context.Context, val *Trace) context.Context {
	return context.WithValue(ctx, ctxKey, val)
}