func FromContext(ctx context.Context) (t Trace, ok bool) {
	t, ok = ctx.Value(_ctxkey).(Trace)
	return
}
FromContext returns the trace bound to the context, if any.
package trace
import (
	"context"
	"encoding/binary"
	"math/rand"
	"time"
	"github.com/mapgoo-lab/atreus/pkg/conf/env"
	"github.com/mapgoo-lab/atreus/pkg/net/ip"
	"github.com/pkg/errors"
)
var _hostHash byte
func init() {
	rand.Seed(time.Now().UnixNano())
	_hostHash = byte(oneAtTimeHash(env.Hostname))
}
func extendTag() (tags []Tag) {
	tags = append(tags,
		TagString("region", env.Region),
		TagString("zone", env.Zone),
		TagString("hostname", env.Hostname),
		TagString("ip", ip.InternalIP()),
	)
	return
}
func genID() uint64 {
	var b [8]byte
	binary.BigEndian.PutUint32(b[4:], uint32(time.Now().Unix())>>8)
	b[4] = _hostHash
	binary.BigEndian.PutUint32(b[:4], uint32(rand.Int31()))
	return binary.BigEndian.Uint64(b[:])
}
type stackTracer interface {
	StackTrace() errors.StackTrace
}
type ctxKey string
var _ctxkey ctxKey = "atreus/pkg/net/trace.trace"