Documentation ¶
Overview ¶
Example (Handler) ¶
cb := func(ctx context.Context, sub string, data []byte) ([]byte, error) { return nil, nil } tele := tel.NewNull() mw := New(WithReply(true), WithTel(tele)) conn, _ := nats.Connect("example.com") _, _ = conn.QueueSubscribe("sub", "queue", mw.Handler(cb)) _, _ = conn.QueueSubscribe("sub2", "queue", mw.Handler(cb))
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const ( Subject = attribute.Key("nats.subject") IsError = attribute.Key("nats.code") ReadBytesKey = attribute.Key("nats.read_bytes") // if anything was read from the request body, the total number of bytes read WroteBytesKey = attribute.Key("nats.wrote_bytes") // if anything was written to the response writer, the total number of bytes written )
Attribute keys that can be added to a span.
View Source
const ( RequestCount = "nats.consumer.request_count" // Incoming request count total RequestContentLength = "nats.consumer.request_content_length" // Incoming request bytes total ResponseContentLength = "nats.consumer.response_content_length" // Incoming response bytes total ServerLatency = "nats.consumer.duration" // Incoming end to end duration, microseconds )
Server HTTP metrics
Variables ¶
This section is empty.
Functions ¶
func SemVersion ¶
func SemVersion() string
SemVersion is the semantic version to be supplied to tracer/meter creation.
Types ¶
type MiddleWare ¶
type MiddleWare struct {
// contains filtered or unexported fields
}
MiddleWare helper
func (*MiddleWare) Handler ¶
func (n *MiddleWare) Handler(next PostFn) func(*nats.Msg)
Handler is entry point perform recovery, debug logging and perform tracing
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option allows configuration of the httptrace Extract() and Inject() functions.
func WithPostHook ¶
WithPostHook set (only one) where you can perform post handle operation with data provided by handler
Click to show internal directories.
Click to hide internal directories.