trace

package
v1.22.3 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2022 License: MIT Imports: 16 Imported by: 10

Documentation

Index

Constants

View Source
const (

	// RoleS1 is the name of the role for server S1
	RoleS1 = "S1"

	// RoleS2 is the name of the role for server S2
	RoleS2 = "S2"

	// RoleS3 is the name of the role for server S3
	RoleS3 = "S3"

	// BaggageKey is the key used to pass baggage item
	BaggageKey = "crossdock-baggage-key"
)
View Source
const (
	BehaviorName = "trace"
)

Different parameter keys and values used by the system

Variables

This section is empty.

Functions

This section is empty.

Types

type Behavior

type Behavior struct {
	ServerPort    string
	Tracer        opentracing.Tracer
	ServiceToHost func(string) string
	// contains filtered or unexported fields
}

Behavior is an implementation of "trace behavior", that verifies that a tracing context and baggage are properly propagated through two level of servers.

func (*Behavior) Register

func (b *Behavior) Register(ch *tchannel.Channel)

Register function adds JSON and Thrift handlers to the server channel ch

func (*Behavior) Run

func (b *Behavior) Run(t crossdock.T)

Run executes the trace behavior

type Downstream

type Downstream struct {
	ServiceName string      `json:"serviceName"`
	ServerRole  string      `json:"serverRole"`
	Encoding    string      `json:"encoding"`
	HostPort    string      `json:"hostPort"`
	Downstream  *Downstream `json:"downstream,omitempty"`
}

Downstream describes which downstream service to call recursively.

type DownstreamCall

type DownstreamCall func(ctx context.Context, target *Downstream) (*Response, error)

DownstreamCall is an encoding-agnostic abstraction of calling a downstream service.

type ObservedSpan

type ObservedSpan struct {
	TraceID string `json:"traceId"`
	Sampled bool   `json:"sampled"`
	Baggage string `json:"baggage"`
}

ObservedSpan describes the tracing span observed by the server

type Request

type Request struct {
	ServerRole string      `json:"serverRole"`
	Downstream *Downstream `json:"downstream,omitempty"`
}

Request instructs the server to call another server recursively if Downstream != nil, and return the results of the downstream call as well as the current tracing span it observes in its Context.

type Response

type Response struct {
	Span       *ObservedSpan `json:"span,omitempty"`
	Downstream *Response     `json:"downstream,omitempty"`
}

Response contains the span observed by the server and nested downstream response.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL