tracing

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 25 Imported by: 32

Documentation

Index

Constants

View Source
const (
	ServerRequestCount = "http.server.request_count" // measures the incoming request count total
	ServerLatency      = "http.server.duration"      // measures th incoming end to end duration
)

Server HTTP metrics

View Source
const (
	ClientRequestCount = "http.client.request_count" // measures the client request count total
	ClientLatency      = "http.client.duration"      // measures the duration outbound HTTP requests
)

Client HTTP metrics.

View Source
const (
	ReadBytesKey  = attribute.Key("http.read_bytes")  // if anything was read from the request body, the total number of bytes read
	ReadErrorKey  = attribute.Key("http.read_error")  // If an error occurred while reading a request, the string of the error (io.EOF is not recorded)
	WroteBytesKey = attribute.Key("http.wrote_bytes") // if anything was written to the response writer, the total number of bytes written
	WriteErrorKey = attribute.Key("http.write_error") // if an error occurred while writing a reply, the string of the error (io.EOF is not recorded)
)

Attribute keys that can be added to a span.

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 (
	StatusKey = attribute.Key("status.code")
)

Variables

Functions

func ClientMiddleware

func ClientMiddleware(opts ...Option) client.Middleware

func Extract

Extract returns the baggage and span context

func Inject

func Inject(ctx context.Context, c *Config, headers *protocol.RequestHeader)

Inject injects span context into the hertz metadata info

func SemVersion

func SemVersion() string

func ServerMiddleware

func ServerMiddleware(cfg *Config) app.HandlerFunc

func Version

func Version() string

Types

type ConditionFunc added in v0.4.0

type ConditionFunc func(ctx context.Context, c *app.RequestContext) bool

type Config

type Config struct {
	// contains filtered or unexported fields
}

func NewServerTracer

func NewServerTracer(opts ...Option) (serverconfig.Option, *Config)

type Option

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

Option opts for opentelemetry tracer provider

func WithClientHttpRouteFormatter added in v0.4.0

func WithClientHttpRouteFormatter(clientHttpRouteFormatter func(req *protocol.Request) string) Option

WithClientHttpRouteFormatter configures clientHttpRouteFormatter

func WithCustomResponseHandler added in v0.3.0

func WithCustomResponseHandler(h app.HandlerFunc) Option

WithCustomResponseHandler configures CustomResponseHandler

func WithRecordSourceOperation

func WithRecordSourceOperation(recordSourceOperation bool) Option

WithRecordSourceOperation configures record source operation dimension

func WithServerHttpRouteFormatter added in v0.4.0

func WithServerHttpRouteFormatter(serverHttpRouteFormatter func(c *app.RequestContext) string) Option

WithServerHttpRouteFormatter configures serverHttpRouteFormatter

func WithShouldIgnore added in v0.4.0

func WithShouldIgnore(condition ConditionFunc) Option

WithShouldIgnore allows you to define the condition for enabling distributed tracing

func WithTextMapPropagator

func WithTextMapPropagator(p propagation.TextMapPropagator) Option

WithTextMapPropagator configures propagation

type StringHeader

type StringHeader protocol.RequestHeader

func (*StringHeader) Visit

func (sh *StringHeader) Visit(f func(k, v string))

Visit implements the metainfo.HTTPHeaderCarrier interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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