Documentation ¶
Index ¶
- Constants
- Variables
- func AWS(c *client.Client)
- func AWSSession(s *session.Session) *session.Session
- func AWSSessionWithWhitelist(s *session.Session, filename string) *session.Session
- func AWSWithWhitelist(c *client.Client, filename string)
- func AddAnnotation(ctx context.Context, key string, value interface{}) error
- func AddError(ctx context.Context, err error) error
- func AddMetadata(ctx context.Context, key string, value interface{}) error
- func AddMetadataToNamespace(ctx context.Context, namespace string, key string, value interface{}) error
- func Capture(ctx context.Context, name string, fn func(context.Context) error) (err error)
- func CaptureAsync(ctx context.Context, name string, fn func(context.Context) error)
- func Client(c *http.Client) *http.Client
- func Configure(c Config) error
- func ContextWithConfig(ctx context.Context, c Config) (context.Context, error)
- func DetachContext(ctx context.Context) context.Context
- func Handler(sn SegmentNamer, h http.Handler) http.Handler
- func HandlerWithContext(ctx context.Context, sn SegmentNamer, h http.Handler) http.Handler
- func HttpCaptureResponse(seg *Segment, statusCode int)
- func HttpTrace(seg *Segment, h http.Handler, w http.ResponseWriter, r *http.Request, ...)
- func NewSegmentID() string
- func NewTraceID() string
- func RequestWasTraced(ctx context.Context) bool
- func RoundTripper(rt http.RoundTripper) http.RoundTripper
- func SQLConnector(dsn string, connector driver.Connector) driver.Connector
- func SQLContext(driver, dsn string) (*sql.DB, error)
- func SdkDisabled() bool
- func SetLogger(l xraylog.Logger)
- func TraceID(ctx context.Context) string
- func UnaryClientInterceptor(clientInterceptorOptions ...GrpcOption) grpc.UnaryClientInterceptor
- func UnaryServerInterceptor(serverInterceptorOptions ...GrpcOption) grpc.UnaryServerInterceptor
- type CauseData
- type ClientTrace
- type Config
- type ContextKeytype
- type DefaultEmitter
- type DefaultStreamingStrategy
- type DynamicSegmentNamer
- type Emitter
- type FastHTTPHandler
- type FixedSegmentNamer
- type GrpcOption
- type HTTPData
- type HTTPSubsegments
- func (xt *HTTPSubsegments) ConnectDone(network, addr string, err error)
- func (xt *HTTPSubsegments) ConnectStart(network, addr string)
- func (xt *HTTPSubsegments) DNSDone(info httptrace.DNSDoneInfo)
- func (xt *HTTPSubsegments) DNSStart(info httptrace.DNSStartInfo)
- func (xt *HTTPSubsegments) GetConn(hostPort string)
- func (xt *HTTPSubsegments) GotConn(info *httptrace.GotConnInfo, err error)
- func (xt *HTTPSubsegments) GotFirstResponseByte()
- func (xt *HTTPSubsegments) TLSHandshakeDone(connState tls.ConnectionState, err error)
- func (xt *HTTPSubsegments) TLSHandshakeStart()
- func (xt *HTTPSubsegments) WroteRequest(info httptrace.WroteRequestInfo)
- type RecorderContextKey
- type RequestData
- type ResponseData
- type SDK
- type SQLData
- type Segment
- func BeginFacadeSegment(ctx context.Context, name string, h *header.Header) (context.Context, *Segment)
- func BeginSegment(ctx context.Context, name string) (context.Context, *Segment)
- func BeginSegmentWithSampling(ctx context.Context, name string, r *http.Request, traceHeader *header.Header) (context.Context, *Segment)
- func BeginSubsegment(ctx context.Context, name string) (context.Context, *Segment)
- func BeginSubsegmentWithoutSampling(ctx context.Context, name string) (context.Context, *Segment)
- func GetSegment(ctx context.Context) *Segment
- func NewSegmentFromHeader(ctx context.Context, name string, r *http.Request, h *header.Header) (context.Context, *Segment)
- func (seg *Segment) AddAnnotation(key string, value interface{}) error
- func (seg *Segment) AddError(err error) error
- func (seg *Segment) AddMetadata(key string, value interface{}) error
- func (seg *Segment) AddMetadataToNamespace(namespace string, key string, value interface{}) error
- func (s *Segment) AddRuleName(sd *sampling.Decision)
- func (seg *Segment) Close(err error)
- func (seg *Segment) CloseAndStream(err error)
- func (s *Segment) DownstreamHeader() *header.Header
- func (s *Segment) GetAWS() map[string]interface{}
- func (s *Segment) GetCause() *CauseData
- func (s *Segment) GetConfiguration() *Config
- func (s *Segment) GetHTTP() *HTTPData
- func (s *Segment) GetSQL() *SQLData
- func (s *Segment) GetService() *ServiceData
- func (seg *Segment) RemoveSubsegment(remove *Segment) bool
- type SegmentNamer
- type ServiceData
- type StreamingStrategy
Constants ¶
const ExtendedRequestIDKey string = "id_2"
ExtendedRequestIDKey is the key name of the extend request id.
const Header = `{"format": "json", "version": 1}` + "\n"
Header is added before sending segments to daemon.
const LambdaTaskRootKey string = "LAMBDA_TASK_ROOT"
LambdaTaskRootKey is the key to get Lambda Task Root from environment variable.
const LambdaTraceHeaderKey string = "x-amzn-trace-id"
LambdaTraceHeaderKey is key to get trace header from context.
const RequestIDKey string = "request_id"
RequestIDKey is the key name of the request id.
const S3ExtendedRequestIDHeaderKey string = "x-amz-id-2"
S3ExtendedRequestIDHeaderKey is the key name of the s3 extend request id.
const SDKInitializedFileFolder string = "/tmp/.aws-xray"
SDKInitializedFileFolder records the location of SDK initialized file.
const SDKInitializedFileName string = "initialized"
SDKInitializedFileName records the SDK initialized file name.
const SDKType = "X-Ray for Go"
SDKType records which X-Ray SDK customer uses.
const SDKVersion = "1.8.5"
SDKVersion records the current X-Ray Go SDK version.
const TraceIDHeaderKey = "x-amzn-trace-id"
TraceIDHeaderKey is the HTTP header name used for tracing.
Variables ¶
var ContextKey = new(ContextKeytype)
ContextKey returns a pointer to a newly allocated zero value of ContextKeytype.
var ErrRetrieveSegment = errors.New("unable to retrieve segment")
ErrRetrieveSegment happens when a segment cannot be retrieved
Functions ¶
func AWSSession ¶ added in v1.0.0
AWSSession adds X-Ray tracing to an AWS session. Clients created under this session will inherit X-Ray tracing.
func AWSSessionWithWhitelist ¶ added in v1.0.0
AWSSessionWithWhitelist allows a custom parameter whitelist JSON file to be defined.
func AWSWithWhitelist ¶
AWSWithWhitelist allows a custom parameter whitelist JSON file to be defined.
func AddAnnotation ¶
AddAnnotation adds an annotation to the provided segment or subsegment in ctx.
func AddMetadata ¶
AddMetadata adds a metadata to the provided segment or subsegment in ctx.
func AddMetadataToNamespace ¶
func AddMetadataToNamespace(ctx context.Context, namespace string, key string, value interface{}) error
AddMetadataToNamespace adds a namespace to the provided segment's or subsegment's metadata in ctx.
func Capture ¶
Capture traces the provided synchronous function by beginning and closing a subsegment around its execution.
func CaptureAsync ¶
CaptureAsync traces an arbitrary code segment within a goroutine. Use CaptureAsync instead of manually calling Capture within a goroutine to ensure the segment is flushed properly.
func Client ¶
Client creates a shallow copy of the provided http client, defaulting to http.DefaultClient, with roundtripper wrapped with xray.RoundTripper.
func ContextWithConfig ¶ added in v1.0.0
ContextWithConfig returns context with given configuration settings.
func DetachContext ¶
DetachContext returns a new context with the existing segment. This is useful for creating background tasks which won't be cancelled when a request completes.
func Handler ¶
func Handler(sn SegmentNamer, h http.Handler) http.Handler
Handler wraps the provided http handler with xray.Capture using the request's context, parsing the incoming headers, adding response headers if needed, and sets HTTP specific trace fields. Handler names the generated segments using the provided SegmentNamer.
func HandlerWithContext ¶ added in v1.0.0
HandlerWithContext wraps the provided http handler and context to parse the incoming headers, add response headers if needed, and sets HTTP specific trace fields. HandlerWithContext names the generated segments using the provided SegmentNamer.
func HttpCaptureResponse ¶ added in v1.6.0
HttpCaptureResponse fill response by http status code
func NewSegmentID ¶
func NewSegmentID() string
NewSegmentID generates a string format of segment ID.
func RequestWasTraced ¶
RequestWasTraced returns true if the context contains an X-Ray segment that was created from an HTTP request that contained a trace header. This is useful to ensure that a service is only called from X-Ray traced services.
func RoundTripper ¶
func RoundTripper(rt http.RoundTripper) http.RoundTripper
RoundTripper wraps the provided http roundtripper with xray.Capture, sets HTTP-specific xray fields, and adds the trace header to the outbound request.
func SQLConnector ¶ added in v1.0.0
SQLConnector wraps the connector, and traces SQL executions. Unlike SQLContext, SQLConnector doesn't filter the password of the dsn. So, you have to filter the password before passing the dsn to SQLConnector.
func SQLContext ¶ added in v1.0.0
SQLContext opens a normalized and traced wrapper around an *sql.DB connection. It uses `sql.Open` internally and shares the same function signature. To ensure passwords are filtered, it is HIGHLY RECOMMENDED that your DSN follows the format: `<schema>://<user>:<password>@<host>:<port>/<database>`
func SetLogger ¶ added in v1.0.0
SetLogger sets the logger instance used by xray. Only set from init() functions as SetLogger is not goroutine safe.
func TraceID ¶
TraceID returns the canonical ID of the cross-service trace from the given segment in ctx. The value can be used in X-Ray's UI to uniquely identify the code paths executed. If no segment is provided in ctx, an empty string is returned.
func UnaryClientInterceptor ¶ added in v1.5.0
func UnaryClientInterceptor(clientInterceptorOptions ...GrpcOption) grpc.UnaryClientInterceptor
UnaryClientInterceptor provides gRPC unary client interceptor.
func UnaryServerInterceptor ¶ added in v1.5.0
func UnaryServerInterceptor(serverInterceptorOptions ...GrpcOption) grpc.UnaryServerInterceptor
UnaryServerInterceptor provides gRPC unary server interceptor.
Types ¶
type CauseData ¶
type CauseData struct { WorkingDirectory string `json:"working_directory,omitempty"` Paths []string `json:"paths,omitempty"` Exceptions []exception.Exception `json:"exceptions,omitempty"` }
CauseData provides the shape for unmarshalling data that records exception.
type ClientTrace ¶
type ClientTrace struct {
// contains filtered or unexported fields
}
ClientTrace is a set of pointers of HTTPSubsegments and ClientTrace.
func NewClientTrace ¶
func NewClientTrace(opCtx context.Context) (ct *ClientTrace, err error)
NewClientTrace returns an instance of xray.ClientTrace, a wrapper around httptrace.ClientTrace. The ClientTrace implementation will generate subsegments for connection time, DNS lookup time, TLS handshake time, and provides additional information about the HTTP round trip
type Config ¶
type Config struct { DaemonAddr string ServiceVersion string Emitter Emitter SamplingStrategy sampling.Strategy StreamingStrategy StreamingStrategy ExceptionFormattingStrategy exception.FormattingStrategy ContextMissingStrategy ctxmissing.Strategy // LogLevel and LogFormat are deprecated and no longer have any effect. // See SetLogger() and the associated xraylog.Logger interface to control // logging. LogLevel string LogFormat string }
Config is a set of X-Ray configurations.
func GetRecorder ¶ added in v1.0.0
GetRecorder returns a pointer to the config struct provided in ctx, or nil if no config is set.
type ContextKeytype ¶
type ContextKeytype int
ContextKeytype defines integer to be type of ContextKey.
type DefaultEmitter ¶ added in v1.0.0
DefaultEmitter provides the naive implementation of emitting trace entities.
func NewDefaultEmitter ¶ added in v1.0.0
func NewDefaultEmitter(raddr *net.UDPAddr) (*DefaultEmitter, error)
NewDefaultEmitter initializes and returns a pointer to an instance of DefaultEmitter.
func (*DefaultEmitter) Emit ¶ added in v1.0.0
func (de *DefaultEmitter) Emit(seg *Segment)
Emit segment or subsegment if root segment is sampled. seg has a write lock acquired by the caller.
func (*DefaultEmitter) RefreshEmitterWithAddress ¶ added in v1.0.0
func (de *DefaultEmitter) RefreshEmitterWithAddress(raddr *net.UDPAddr)
RefreshEmitterWithAddress dials UDP based on the input UDP address.
type DefaultStreamingStrategy ¶
type DefaultStreamingStrategy struct {
MaxSubsegmentCount uint32
}
DefaultStreamingStrategy provides a default value of 20 for the maximum number of subsegments that can be emitted in a single UDP packet.
func NewDefaultStreamingStrategy ¶
func NewDefaultStreamingStrategy() (*DefaultStreamingStrategy, error)
NewDefaultStreamingStrategy initializes and returns a pointer to an instance of DefaultStreamingStrategy.
func NewDefaultStreamingStrategyWithMaxSubsegmentCount ¶
func NewDefaultStreamingStrategyWithMaxSubsegmentCount(maxSubsegmentCount int) (*DefaultStreamingStrategy, error)
NewDefaultStreamingStrategyWithMaxSubsegmentCount initializes and returns a pointer to an instance of DefaultStreamingStrategy with a custom maximum number of subsegments per UDP packet.
func (*DefaultStreamingStrategy) RequiresStreaming ¶
func (dSS *DefaultStreamingStrategy) RequiresStreaming(seg *Segment) bool
RequiresStreaming returns true when the number of subsegment children for a given segment is larger than MaxSubsegmentCount.
func (*DefaultStreamingStrategy) StreamCompletedSubsegments ¶
func (dSS *DefaultStreamingStrategy) StreamCompletedSubsegments(seg *Segment) [][]byte
StreamCompletedSubsegments separates subsegments from the provided segment tree and sends them to daemon as streamed subsegment UDP packets.
type DynamicSegmentNamer ¶
DynamicSegmentNamer chooses names for segments generated for incoming requests by parsing the HOST header of the incoming request. If the host header matches a given recognized pattern (using the included pattern package), it is used as the segment name. Otherwise, the fallback name is used.
func NewDynamicSegmentNamer ¶
func NewDynamicSegmentNamer(fallback string, recognized string) *DynamicSegmentNamer
NewDynamicSegmentNamer creates a new dynamic segment namer.
func (*DynamicSegmentNamer) Name ¶
func (dSN *DynamicSegmentNamer) Name(host string) string
Name returns the segment name for the given host header value.
type Emitter ¶ added in v1.0.0
Emitter provides an interface for implementing emitting trace entities.
type FastHTTPHandler ¶ added in v1.5.0
type FastHTTPHandler interface {
Handler(SegmentNamer, fasthttp.RequestHandler) fasthttp.RequestHandler
}
func NewFastHTTPInstrumentor ¶ added in v1.5.0
func NewFastHTTPInstrumentor(cfg *Config) FastHTTPHandler
NewFastHTTPInstrumentor returns a struct that provides Handle method that satisfy fasthttp.RequestHandler interface.
type FixedSegmentNamer ¶
type FixedSegmentNamer struct {
FixedName string
}
FixedSegmentNamer records the fixed name of service node.
func NewFixedSegmentNamer ¶
func NewFixedSegmentNamer(name string) *FixedSegmentNamer
NewFixedSegmentNamer initializes a FixedSegmentNamer which will provide a fixed segment name for every generated segment. If the AWS_XRAY_TRACING_NAME environment variable is set, its value will override the provided name argument.
func (*FixedSegmentNamer) Name ¶
func (fSN *FixedSegmentNamer) Name(host string) string
Name returns the segment name for the given host header value. In this case, FixedName is always returned.
type GrpcOption ¶ added in v1.5.0
type GrpcOption interface {
// contains filtered or unexported methods
}
func WithRecorder ¶ added in v1.5.0
func WithRecorder(cfg *Config) GrpcOption
WithRecorder configures the instrumentation by given xray.Config.
func WithSegmentNamer ¶ added in v1.5.0
func WithSegmentNamer(sn SegmentNamer) GrpcOption
WithSegmentNamer makes the interceptor use the segment namer to name the segment.
type HTTPData ¶
type HTTPData struct { Request *RequestData `json:"request,omitempty"` Response *ResponseData `json:"response,omitempty"` }
HTTPData provides the shape for unmarshalling request and response data.
func (*HTTPData) GetRequest ¶
func (d *HTTPData) GetRequest() *RequestData
GetRequest returns value of RequestData.
func (*HTTPData) GetResponse ¶
func (d *HTTPData) GetResponse() *ResponseData
GetResponse returns value of ResponseData.
type HTTPSubsegments ¶ added in v0.9.4
type HTTPSubsegments struct {
// contains filtered or unexported fields
}
HTTPSubsegments is a set of context in different HTTP operation. Note: from ClientTrace godoc
Functions may be called concurrently from different goroutines
HTTPSubsegments must operate as though all functions on it can be called in different goroutines and must protect against races
func NewHTTPSubsegments ¶ added in v1.0.0
func NewHTTPSubsegments(opCtx context.Context) *HTTPSubsegments
NewHTTPSubsegments creates a new HTTPSubsegments to use in httptrace.ClientTrace functions
func (*HTTPSubsegments) ConnectDone ¶ added in v0.9.4
func (xt *HTTPSubsegments) ConnectDone(network, addr string, err error)
ConnectDone closes the dial subsegment if the HTTP operation subsegment is still in progress, passing the error value (if any). Information about the network over which the dial was made is added as metadata to the subsegment.
func (*HTTPSubsegments) ConnectStart ¶ added in v0.9.4
func (xt *HTTPSubsegments) ConnectStart(network, addr string)
ConnectStart begins a dial subsegment if the HTTP operation subsegment is still in progress.
func (*HTTPSubsegments) DNSDone ¶ added in v0.9.4
func (xt *HTTPSubsegments) DNSDone(info httptrace.DNSDoneInfo)
DNSDone closes the dns subsegment if the HTTP operation subsegment is still in progress, passing the error value (if any). Information about the address values looked up, and whether or not the call was coalesced is added as metadata to the dns subsegment.
func (*HTTPSubsegments) DNSStart ¶ added in v0.9.4
func (xt *HTTPSubsegments) DNSStart(info httptrace.DNSStartInfo)
DNSStart begins a dns subsegment if the HTTP operation subsegment is still in progress.
func (*HTTPSubsegments) GetConn ¶ added in v0.9.4
func (xt *HTTPSubsegments) GetConn(hostPort string)
GetConn begins a connect subsegment if the HTTP operation subsegment is still in progress.
func (*HTTPSubsegments) GotConn ¶ added in v0.9.4
func (xt *HTTPSubsegments) GotConn(info *httptrace.GotConnInfo, err error)
GotConn closes the connect subsegment if the HTTP operation subsegment is still in progress, passing the error value (if any). Information about the connection is added as metadata to the subsegment. If the connection is marked as reused, the connect subsegment is deleted.
func (*HTTPSubsegments) GotFirstResponseByte ¶ added in v0.9.4
func (xt *HTTPSubsegments) GotFirstResponseByte()
GotFirstResponseByte closes the response subsegment if the HTTP operation subsegment is still in progress.
func (*HTTPSubsegments) TLSHandshakeDone ¶ added in v0.9.4
func (xt *HTTPSubsegments) TLSHandshakeDone(connState tls.ConnectionState, err error)
TLSHandshakeDone closes the tls subsegment if the HTTP operation subsegment is still in progress, passing the error value(if any). Information about the tls connection is added as metadata to the subsegment.
func (*HTTPSubsegments) TLSHandshakeStart ¶ added in v0.9.4
func (xt *HTTPSubsegments) TLSHandshakeStart()
TLSHandshakeStart begins a tls subsegment if the HTTP operation subsegment is still in progress.
func (*HTTPSubsegments) WroteRequest ¶ added in v0.9.4
func (xt *HTTPSubsegments) WroteRequest(info httptrace.WroteRequestInfo)
WroteRequest closes the request subsegment if the HTTP operation subsegment is still in progress, passing the error value (if any). The response subsegment is then begun.
type RecorderContextKey ¶ added in v1.0.0
type RecorderContextKey struct{}
RecorderContextKey records the key for Config value.
type RequestData ¶
type RequestData struct { Method string `json:"method,omitempty"` URL string `json:"url,omitempty"` // http(s)://host/path ClientIP string `json:"client_ip,omitempty"` UserAgent string `json:"user_agent,omitempty"` XForwardedFor bool `json:"x_forwarded_for,omitempty"` Traced bool `json:"traced,omitempty"` }
RequestData provides the shape for unmarshalling request data.
type ResponseData ¶
type ResponseData struct { Status int `json:"status,omitempty"` ContentLength int `json:"content_length,omitempty"` }
ResponseData provides the shape for unmarshalling response data.
type SDK ¶ added in v1.0.0
type SDK struct { Version string `json:"sdk_version,omitempty"` Type string `json:"sdk,omitempty"` RuleName string `json:"sampling_rule_name,omitempty"` }
SDK provides the shape for unmarshalling an SDK struct.
type SQLData ¶
type SQLData struct { ConnectionString string `json:"connection_string,omitempty"` URL string `json:"url,omitempty"` // host:port/database DatabaseType string `json:"database_type,omitempty"` DatabaseVersion string `json:"database_version,omitempty"` DriverVersion string `json:"driver_version,omitempty"` User string `json:"user,omitempty"` Preparation string `json:"preparation,omitempty"` // "statement" / "call" SanitizedQuery string `json:"sanitized_query,omitempty"` }
SQLData provides the shape for unmarshalling sql data.
type Segment ¶
type Segment struct { sync.RWMutex Sampled bool `json:"-"` RequestWasTraced bool `json:"-"` // Used by xray.RequestWasTraced ContextDone bool `json:"-"` Emitted bool `json:"-"` IncomingHeader *header.Header `json:"-"` ParentSegment *Segment `json:"-"` // The root of the Segment tree, the parent Segment (not Subsegment). // Required TraceID string `json:"trace_id,omitempty"` ID string `json:"id"` Name string `json:"name"` StartTime float64 `json:"start_time"` EndTime float64 `json:"end_time,omitempty"` // Optional InProgress bool `json:"in_progress,omitempty"` ParentID string `json:"parent_id,omitempty"` Fault bool `json:"fault,omitempty"` Error bool `json:"error,omitempty"` Throttle bool `json:"throttle,omitempty"` Cause *CauseData `json:"cause,omitempty"` ResourceARN string `json:"resource_arn,omitempty"` Origin string `json:"origin,omitempty"` Type string `json:"type,omitempty"` Namespace string `json:"namespace,omitempty"` User string `json:"user,omitempty"` PrecursorIDs []string `json:"precursor_ids,omitempty"` HTTP *HTTPData `json:"http,omitempty"` AWS map[string]interface{} `json:"aws,omitempty"` Service *ServiceData `json:"service,omitempty"` // SQL SQL *SQLData `json:"sql,omitempty"` // Metadata Annotations map[string]interface{} `json:"annotations,omitempty"` Metadata map[string]map[string]interface{} `json:"metadata,omitempty"` // Children Subsegments []json.RawMessage `json:"subsegments,omitempty"` // Configuration Configuration *Config `json:"-"` // Lambda Facade bool `json:"-"` // Dummy Segment flag Dummy bool // contains filtered or unexported fields }
Segment provides the resource's name, details about the request, and details about the work done.
func BeginFacadeSegment ¶ added in v1.0.0
func BeginFacadeSegment(ctx context.Context, name string, h *header.Header) (context.Context, *Segment)
BeginFacadeSegment creates a Segment for a given name and context. NOTE: This is an internal API only to be used in Lambda context within the SDK. Consider using BeginSegment instead.
func BeginSegment ¶
BeginSegment creates a Segment for a given name and context.
func BeginSegmentWithSampling ¶ added in v1.0.0
func BeginSubsegment ¶
BeginSubsegment creates a subsegment for a given name and context.
func BeginSubsegmentWithoutSampling ¶ added in v1.8.0
func GetSegment ¶
GetSegment returns a pointer to the segment or subsegment provided in ctx, or nil if no segment or subsegment is found.
func NewSegmentFromHeader ¶
func NewSegmentFromHeader(ctx context.Context, name string, r *http.Request, h *header.Header) (context.Context, *Segment)
NewSegmentFromHeader creates a segment for downstream call and add information to the segment that gets from HTTP header.
func (*Segment) AddAnnotation ¶ added in v0.9.4
AddAnnotation allows adding an annotation to the segment.
func (*Segment) AddMetadata ¶ added in v0.9.4
AddMetadata allows adding metadata to the segment.
func (*Segment) AddMetadataToNamespace ¶ added in v0.9.4
AddMetadataToNamespace allows adding a namespace into metadata for the segment.
func (*Segment) AddRuleName ¶ added in v1.0.0
AddRuleName adds rule name, if present from sampling decision to xray context.
func (*Segment) CloseAndStream ¶ added in v1.0.0
CloseAndStream closes a subsegment and sends it.
func (*Segment) DownstreamHeader ¶
DownstreamHeader returns a header for passing to downstream calls.
func (*Segment) GetConfiguration ¶ added in v1.0.0
GetConfiguration returns a value of Config.
func (*Segment) GetService ¶
func (s *Segment) GetService() *ServiceData
GetService returns value of Service.
func (*Segment) RemoveSubsegment ¶
RemoveSubsegment removes a subsegment child from a segment or subsegment.
type SegmentNamer ¶
SegmentNamer is the interface for naming service node.
type ServiceData ¶
type ServiceData struct { Version string `json:"version,omitempty"` RuntimeVersion string `json:"runtime_version,omitempty"` Runtime string `json:"runtime,omitempty"` }
ServiceData provides the shape for unmarshalling service version.