Documentation ¶
Index ¶
- Constants
- Variables
- func ClientMiddleware(opts ...Option) client.Middleware
- func Extract(ctx context.Context, c *Config, headers *protocol.RequestHeader) (baggage.Baggage, trace.SpanContext)
- func Inject(ctx context.Context, c *Config, headers *protocol.RequestHeader)
- func SemVersion() string
- func ServerMiddleware(cfg *Config) app.HandlerFunc
- func Version() string
- type ConditionFunc
- type Config
- type Option
- func WithClientHttpRouteFormatter(clientHttpRouteFormatter func(req *protocol.Request) string) Option
- func WithClientSpanNameFormatter(clientSpanNameFormatter func(req *protocol.Request) string) Option
- func WithCustomResponseHandler(h app.HandlerFunc) Option
- func WithRecordSourceOperation(recordSourceOperation bool) Option
- func WithServerHttpRouteFormatter(serverHttpRouteFormatter func(c *app.RequestContext) string) Option
- func WithServerSpanNameFormatter(serverSpanNameFormatter func(c *app.RequestContext) string) Option
- func WithShouldIgnore(condition ConditionFunc) Option
- func WithTextMapPropagator(p propagation.TextMapPropagator) Option
- type StringHeader
Constants ¶
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
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.
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.
const ( // PeerServiceNamespaceKey peer.service.namespace PeerServiceNamespaceKey = attribute.Key("peer.service.namespace") // PeerDeploymentEnvironmentKey peer.deployment.environment PeerDeploymentEnvironmentKey = attribute.Key("peer.deployment.environment") )
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") )
const (
StatusKey = attribute.Key("status.code")
)
Variables ¶
var ( HTTPMetricsAttributes = []attribute.Key{ semconv.HTTPHostKey, semconv.HTTPRouteKey, semconv.HTTPMethodKey, semconv.HTTPStatusCodeKey, } PeerMetricsAttributes = []attribute.Key{ semconv.PeerServiceKey, PeerServiceNamespaceKey, PeerDeploymentEnvironmentKey, RequestProtocolKey, } // MetricResourceAttributes resource attributes MetricResourceAttributes = []attribute.Key{ semconv.ServiceNameKey, semconv.ServiceNamespaceKey, semconv.DeploymentEnvironmentKey, semconv.ServiceInstanceIDKey, semconv.ServiceVersionKey, semconv.TelemetrySDKLanguageKey, semconv.TelemetrySDKVersionKey, semconv.ProcessPIDKey, semconv.HostNameKey, semconv.HostIDKey, } )
Functions ¶
func ClientMiddleware ¶
func ClientMiddleware(opts ...Option) client.Middleware
func Extract ¶
func Extract(ctx context.Context, c *Config, headers *protocol.RequestHeader) (baggage.Baggage, trace.SpanContext)
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
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 WithClientSpanNameFormatter ¶ added in v0.4.1
WithClientSpanNameFormatter configures clientSpanNameFormatter
func WithCustomResponseHandler ¶ added in v0.3.0
func WithCustomResponseHandler(h app.HandlerFunc) Option
WithCustomResponseHandler configures CustomResponseHandler
func WithRecordSourceOperation ¶
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 WithServerSpanNameFormatter ¶ added in v0.4.1
func WithServerSpanNameFormatter(serverSpanNameFormatter func(c *app.RequestContext) string) Option
WithServerSpanNameFormatter configures serverSpanNameFormatter
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.