trace

package
v0.0.0-...-0c2590b Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GRPCStatusCodeKey 是 gRPC 请求的数字状态代码的约定。
	GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code")
	// RPCNameKey 是发送或接收的消息的名称。
	RPCNameKey = attribute.Key("name")
	// RPCMessageTypeKey 是发送或接收的消息的类型。
	RPCMessageTypeKey = attribute.Key("message.type")
	// RPCMessageIDKey 是发送或接收的消息的标识符。
	RPCMessageIDKey = attribute.Key("message.id")
	// RPCMessageCompressedSizeKey 是传输或接收的消息的压缩大小(以字节为单位)。
	RPCMessageCompressedSizeKey = attribute.Key("message.compressed_size")
	// RPCMessageUncompressedSizeKey 是消息的未压缩大小 [以字节为单位发送或接收]
	RPCMessageUncompressedSizeKey = attribute.Key("message.uncompressed_size")
	// ServerEnvironment ...
	ServerEnvironment = attribute.Key("environment")
)
View Source
const (
	TraceName = "tiger-trace"
)

Variables

View Source
var (
	// RPCSystemGRPC 是 gRPC 作为远程处理系统的语义约定。
	RPCSystemGRPC = semconv.RPCSystemKey.String("grpc")
	// RPCNameMessage 是名为 message 的消息的语义约定。
	RPCNameMessage = RPCNameKey.String("message")
	// RPCMessageTypeSent 是发送的 RPC 消息类型的语义约定。
	RPCMessageTypeSent = RPCMessageTypeKey.String("SENT")
	// RPCMessageTypeReceived 是接收到的 RPC 消息类型的语义约定。
	RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED")
)

常见RPC属性的语义约定

Functions

func BuildSpan

func BuildSpan(method, peerAddr string) (string, []attribute.KeyValue)

func PeerFromCtx

func PeerFromCtx(ctx context.Context) string

func StartAgent

func StartAgent()

开启trace collector

func StatusCodeAttr

func StatusCodeAttr(c gcodes.Code) attribute.KeyValue

StatusCode Attr 返回一个表示给定 c 的 attribute.Key Value。

func StopAgent

func StopAgent()

关闭trace collector,在服务停止前调用stopAgent,不然可能造成trace数据的丢失

Types

This section is empty.

Jump to

Keyboard shortcuts

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