tracing

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 24 Imported by: 246

Documentation

Overview

Package tracing provides the otel tracing & metrics implement of tracer

Index

Constants

View Source
const (
	ServerDuration        = "rpc.server.duration"          // measures duration of inbound RPC
	ServerRequestSize     = "rpc.server.request.size"      // measures size of RPC request messages (uncompressed)
	ServerResponseSize    = "rpc.server.response.size"     // measures size of RPC response messages (uncompressed)
	ServerRequestsPerRPC  = "rpc.server.requests_per_rpc"  // measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs
	ServerResponsesPerRPC = "rpc.server.responses_per_rpc" // measures the number of messages sent per RPC. Should be 1 for all non-streaming RPCs
)

RPC Server metrics ref to https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc.md#rpc-server

View Source
const (
	ClientDuration        = "rpc.client.duration"          // measures duration of outbound RPC
	ClientRequestSize     = "rpc.client.request.size"      // measures size of RPC request messages (uncompressed)
	ClientResponseSize    = "rpc.client.response.size"     // measures size of RPC response messages (uncompressed)
	ClientRequestsPerRPC  = "rpc.client.requests_per_rpc"  // measures the number of messages received per RPC. Should be 1 for all non-streaming RPCs
	ClientResponsesPerRPC = "rpc.client.responses_per_rpc" // measures the number of messages sent per RPC. Should be 1 for all non-streaming RPCs
)

RPC Client metrics ref to https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/rpc.md#rpc-client

View Source
const (
	// RPCSystemKitexRecvSize recv_size
	RPCSystemKitexRecvSize = attribute.Key("kitex.recv_size")
	// RPCSystemKitexSendSize send_size
	RPCSystemKitexSendSize = attribute.Key("kitex.send_size")
)
View Source
const (
	// PeerServiceNamespaceKey peer.service.namespace
	PeerServiceNamespaceKey = attribute.Key("peer.service.namespace")
	// PeerDeploymentEnvironmentKey peer.deployment.environment
	PeerDeploymentEnvironmentKey = attribute.Key("peer.deployment.environment")
)
View Source
const (
	// RequestProtocolKey protocol of the request.
	//
	// Type: string
	// Required: Always
	// Examples:
	// http: 'http'
	// rpc: 'grpc', 'java_rmi', 'wcf', 'kitex'
	// db: mysql, postgresql
	// mq: 'rabbitmq', 'activemq', 'AmazonSQS'
	RequestProtocolKey = attribute.Key("request.protocol")
)
View Source
const (
	// SourceOperationKey source operation
	//
	// Type: string
	// Required: Optional
	// Examples: '/operation1'
	SourceOperationKey = attribute.Key("source_operation")
)
View Source
const (
	StatusKey = attribute.Key("status.code")
)

Variables

View Source
var RPCSystemKitex = semconv.RPCSystemKey.String("kitex")

RPCSystemKitex Semantic convention for kitex as the remoting system.

Functions

func CGIVariableToHTTPHeaderMetadata

func CGIVariableToHTTPHeaderMetadata(metadata map[string]string) map[string]string

CGIVariableToHTTPHeaderMetadata converts all CGI variable into HTTP header key. For example, `ABC_DEF` will be converted to `abc-def`.

func ClientMiddleware

func ClientMiddleware(cfg *config) endpoint.Middleware

ClientMiddleware inject span context into req meta

func Extract

func Extract(ctx context.Context, c *config, metadata map[string]string) (baggage.Baggage, trace.SpanContext)

Extract returns the baggage and span context

func ExtractFromPropagator added in v0.2.6

func ExtractFromPropagator(ctx context.Context) map[string]string

ExtractFromPropagator get metadata from propagator

func Inject

func Inject(ctx context.Context, c *config, metadata map[string]string)

Inject injects span context into the kitex metadata info

func NewClientSuite

func NewClientSuite(opts ...Option) *clientSuite

NewClientSuite client suite for otel with http2 and ttheader meta handler

func NewFramedClientSuite deprecated

func NewFramedClientSuite(opts ...Option) *clientSuite

Deprecated: Use NewClientSuite instead.

func NewGRPCClientSuite deprecated

func NewGRPCClientSuite(opts ...Option) *clientSuite

Deprecated: Use NewClientSuite instead.

func NewGRPCServerSuite deprecated

func NewGRPCServerSuite(opts ...Option) *serverSuite

Deprecated: Use NewServerSuite instead.

func NewServerSuite

func NewServerSuite(opts ...Option) *serverSuite

NewServerSuite server suite for otel with http2 and ttheader meta handler

func SemVersion

func SemVersion() string

func ServerMiddleware

func ServerMiddleware(cfg *config) endpoint.Middleware

ServerMiddleware extract req meta into span context

func Version

func Version() string

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option opts for opentelemetry tracer provider

func WithEnableGRPCMetadata added in v0.2.8

func WithEnableGRPCMetadata() Option

WithEnableGRPCMetadata Enable retrieving data from metadata or adding data to metadata

func WithRecordSourceOperation

func WithRecordSourceOperation(recordSourceOperation bool) Option

WithRecordSourceOperation configures record source operation dimension

func WithTextMapPropagator

func WithTextMapPropagator(p propagation.TextMapPropagator) Option

WithTextMapPropagator configures propagation

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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