tracing

package module
v0.0.0-...-c228f2a Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestCount          = "http.server.request_count"           // Incoming request count total
	RequestContentLength  = "http.server.request_content_length"  // Incoming request bytes total
	ResponseContentLength = "http.server.response_content_length" // Incoming response bytes total
	ServerLatency         = "http.server.duration"                // Incoming end to end duration, microseconds
)

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

View Source
const (
	ClientLatency      = "http.client.duration"
	ClientRequestSize  = "http.client.request.size"
	ClientResponseSize = "http.client.response.size"
)

Client HTTP metrics. ref to https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/semantic_conventions/http-metrics.md#http-client http.client.duration Histogram milliseconds ms measures the duration outbound HTTP requests http.client.request.size Histogram bytes By measures the size of HTTP request messages (compressed) http.client.response.size Histogram bytes By measures the size of HTTP response messages (compressed)

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 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 WithRecordSourceOperation

func WithRecordSourceOperation(recordSourceOperation bool) Option

WithRecordSourceOperation configures record source operation dimension

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