Documentation ¶
Index ¶
- Constants
- Variables
- func Extract(ctx context.Context, p propagation.TextMapPropagator, metadata *metadata.MD) (baggage.Baggage, sdktrace.SpanContext)
- func Inject(ctx context.Context, p propagation.TextMapPropagator, metadata *metadata.MD)
- func ParseFullMethod(fullMethod string) (string, []attribute.KeyValue)
- func PeerAttr(addr string) []attribute.KeyValue
- func PeerFromCtx(ctx context.Context) string
- func SpanInfo(fullMethod, peerAddress string) (string, []attribute.KeyValue)
- func StartAgent(c Config)
- func StartClientSpan(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)
- func StartServerSpan(ctx context.Context, carrier Carrier, serviceName, operationName string) (context.Context, tracespec.Trace)
- func StatusCodeAttr(c gcodes.Code) attribute.KeyValue
- func StopAgent()
- type Carrier
- type Config
- type Span
- func (s *Span) Finish()
- func (s *Span) Follow(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)
- func (s *Span) Fork(ctx context.Context, serviceName, operationName string) (context.Context, tracespec.Trace)
- func (s *Span) SpanId() string
- func (s *Span) TraceId() string
- func (s *Span) Visit(fn func(key, val string) bool)
Constants ¶
View Source
const ( // GRPCStatusCodeKey is convention for numeric status code of a gRPC request. GRPCStatusCodeKey = attribute.Key("rpc.grpc.status_code") // RPCNameKey is the name of message transmitted or received. RPCNameKey = attribute.Key("name") // RPCMessageTypeKey is the type of message transmitted or received. RPCMessageTypeKey = attribute.Key("message.type") // RPCMessageIDKey is the identifier of message transmitted or received. RPCMessageIDKey = attribute.Key("message.id") // RPCMessageCompressedSizeKey is the compressed size of the message transmitted or received in bytes. RPCMessageCompressedSizeKey = attribute.Key("message.compressed_size") // RPCMessageUncompressedSizeKey is the uncompressed size of the message // transmitted or received in bytes. RPCMessageUncompressedSizeKey = attribute.Key("message.uncompressed_size") )
View Source
const TraceName = "GoFast"
TraceName represents the tracing name.
Variables ¶
View Source
var ( // RPCSystemGRPC is the semantic convention for gRPC as the remoting system. RPCSystemGRPC = semconv.RPCSystemKey.String("grpc") // RPCNameMessage is the semantic convention for a message named message. RPCNameMessage = RPCNameKey.String("message") // RPCMessageTypeSent is the semantic conventions for sent RPC message types. RPCMessageTypeSent = RPCMessageTypeKey.String("SENT") // RPCMessageTypeReceived is the semantic conventions for the received RPC message types. RPCMessageTypeReceived = RPCMessageTypeKey.String("RECEIVED") )
Semantic conventions for common RPC attributes.
View Source
var ( // MessageSent is the type of sent messages. MessageSent = messageType(RPCMessageTypeSent) // MessageReceived is the type of received messages. MessageReceived = messageType(RPCMessageTypeReceived) )
View Source
var ErrInvalidCarrier = errors.New("invalid carrier")
View Source
var TraceIdKey = http.CanonicalHeaderKey("x-trace-id")
TraceIdKey is the trace id header. https://www.w3.org/TR/trace-context/#trace-id May change it to trace-id afterwards.
Functions ¶
func Extract ¶
func Extract(ctx context.Context, p propagation.TextMapPropagator, metadata *metadata.MD) ( baggage.Baggage, sdktrace.SpanContext)
Extract extracts the metadata from ctx.
func Inject ¶
func Inject(ctx context.Context, p propagation.TextMapPropagator, metadata *metadata.MD)
Inject injects cross-cutting concerns from the ctx into the metadata.
func ParseFullMethod ¶ added in v0.4.3
ParseFullMethod returns the method name and attributes.
func PeerFromCtx ¶ added in v0.4.3
PeerFromCtx returns the peer from ctx.
func StartAgent ¶ added in v0.4.3
func StartAgent(c Config)
StartAgent starts a opentelemetry agent.
func StartClientSpan ¶
func StartServerSpan ¶
func StatusCodeAttr ¶ added in v0.4.3
StatusCodeAttr returns an attribute.KeyValue that represents the give c.
Types ¶
type Config ¶ added in v0.4.3
type Config struct { Name string `v:""` Endpoint string `v:""` Sampler float64 `v:"def=1.0"` Batcher string `v:"def=jaeger,enum=jaeger|zipkin|grpc"` }
A Config is a opentelemetry config.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.