trace

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: Apache-2.0 Imports: 20 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// GRPCStatusCodeKey is convention for numeric status code of a gRPC request.
	GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code")
	// RPCNameKey is the name of message transmitted or received.
	RPCNameKey = attribute.Key("name")
	// RPCMessageTypeKey is the type of message transmitted or received.
	RPCMessageTypeKey = attribute.Key("message.type")
	// RPCMessageIDKey is the identifier of message transmitted or received.
	RPCMessageIDKey = attribute.Key("message.id")
	// RPCMessageCompressedSizeKey is the compressed size of the message transmitted or received in bytes.
	RPCMessageCompressedSizeKey = attribute.Key("message.compressed_size")
	// RPCMessageUncompressedSizeKey is the uncompressed size of the message
	// transmitted or received in bytes.
	RPCMessageUncompressedSizeKey = attribute.Key("message.uncompressed_size")
)

Variables

View Source
var (
	// RPCSystemGRPC is the semantic convention for gRPC as the remoting system.
	RPCSystemGRPC = semconv.RPCSystemKey.String("grpc")
	// RPCNameMessage is the semantic convention for a message named message.
	RPCNameMessage = RPCNameKey.String("message")
	// RPCMessageTypeSent is the semantic conventions for sent RPC message types.
	RPCMessageTypeSent = RPCMessageTypeKey.String("SENT")
	// RPCMessageTypeReceived is the semantic conventions for the received RPC message types.
	RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED")
)

Semantic conventions for common RPC attributes.

View Source
var (
	// MessageSent is the type of sent messages.
	MessageSent = messageType(RPCMessageTypeSent)
	// MessageReceived is the type of received messages.
	MessageReceived = messageType(RPCMessageTypeReceived)
)

Functions

func Extract added in v0.0.3

Extract extracts the metadata from ctx.

func InitAgent

func InitAgent(o Options)

func Inject added in v0.0.3

func Inject(ctx context.Context, p propagation.TextMapPropagator, metadata *metadata.MD)

Inject injects the metadata into ctx.

func ParseFullMethod added in v0.0.3

func ParseFullMethod(fullMethod string) (string, []attribute.KeyValue)

ParseFullMethod returns the method name and attributes.

func PeerAttr added in v0.0.3

func PeerAttr(addr string) []attribute.KeyValue

PeerAttr returns the peer attributes.

func PeerFromCtx added in v0.0.3

func PeerFromCtx(ctx context.Context) string

PeerFromCtx returns the peer from ctx.

func SpanInfo added in v0.0.3

func SpanInfo(fullMethod, peerAddress string) (string, []attribute.KeyValue)

SpanInfo returns the span info.

func StatusCodeAttr added in v0.0.3

func StatusCodeAttr(c gcodes.Code) attribute.KeyValue

StatusCodeAttr returns an attribute.KeyValue that represents the give c.

Types

type Options

type Options struct {
	Name     string  `json:"name"`     // jeager 名称
	Endpoint string  `json:"endpoint"` // jeager 地址
	Sampler  float64 `json:"sampler"`  // 采样率
	Batcher  string  `json:"batcher"`  // 批量发送
}

Options 这个配置和 业务中 app 中的 tracing 冗余,为的是将 tracing 从业务中解耦出来

Jump to

Keyboard shortcuts

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