reporter

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Overview

Package reporter provides a low-level API for creating and reporting events for distributed tracing with AppOptics.

Index

Constants

View Source
const (
	XTR_FLAGS_NONE    = 0x0
	XTR_FLAGS_SAMPLED = 0x1
)

x-trace flags

View Source
const (
	LabelEntry = "entry"
	LabelExit  = "exit"
	LabelInfo  = "info"
	LabelError = "error"
	EdgeKey    = "Edge"
)

Labels used for reporting events for Layer spans.

View Source
const (
	TRACE_DISABLED tracingMode = iota // disable tracing, will neither start nor continue traces
	TRACE_ENABLED                     // perform sampling every inbound request for tracing
	TRACE_UNKNOWN                     // for cache purpose only
)

tracing modes

View Source
const (
	TYPE_DEFAULT settingType = iota // default setting which serves as a fallback if no other settings found
	TYPE_LAYER                      // layer specific settings
)

setting types

View Source
const (
	FlagInvalidOffset = iota
	FlagOverrideOffset
	FlagSampleStartOffset
	FlagSampleThroughOffset
	FlagSampleThroughAlwaysOffset
	FlagTriggerTraceOffset
)

setting flags offset

View Source
const (
	FLAG_OK                    settingFlag = 0x0
	FLAG_INVALID               settingFlag = 1 << FlagInvalidOffset
	FLAG_OVERRIDE              settingFlag = 1 << FlagOverrideOffset
	FLAG_SAMPLE_START          settingFlag = 1 << FlagSampleStartOffset
	FLAG_SAMPLE_THROUGH        settingFlag = 1 << FlagSampleThroughOffset
	FLAG_SAMPLE_THROUGH_ALWAYS settingFlag = 1 << FlagSampleThroughAlwaysOffset
	FLAG_TRIGGER_TRACE         settingFlag = 1 << FlagTriggerTraceOffset
)

setting flags

View Source
const (
	SAMPLE_SOURCE_UNSET sampleSource = iota - 1
	SAMPLE_SOURCE_NONE
	SAMPLE_SOURCE_FILE
	SAMPLE_SOURCE_DEFAULT
	SAMPLE_SOURCE_LAYER
)

source of the sample value

View Source
const (
	EventWT = iota
	MetricWT
)
View Source
const (
	EVENTS reporterChannel = iota
	METRICS
)

a channel the reporter is listening on for messages from the agent

View Source
const (
	// Disabled - disable SQL sanitizing (the default).
	Disabled = iota
	// EnabledAuto - enable SQL sanitizing and attempt to automatically determine
	// which quoting form to use.
	EnabledAuto
	// EnabledDropDoubleQuoted - enable SQL sanitizing and force dropping double-
	// quoted runes.
	EnabledDropDoubleQuoted
	// EnabledKeepDoubleQuoted enable SQL sanitizing and force retaining double-
	// quoted runes.
	EnabledKeepDoubleQuoted
)

The SQL sanitization mode

View Source
const (
	PostgreSQL = "postgresql"
	Oracle     = "oracle"
	MySQL      = "mysql"
	Sybase     = "sybase"
	SQLServer  = "sqlserver"
	DefaultDB  = "default"
)

The database types

View Source
const (
	// ReplacementRune is the rune to replace the removed literals
	ReplacementRune = '?'
	// EscapeRune is the SQL escape rune
	EscapeRune = '\\'
	// MaxSQLLen defines the maximum number of runes after truncation.
	MaxSQLLen = 2048
	// Ellipsis is appended to the truncated SQL statement
	Ellipsis = '…'
)
View Source
const (
	DefaultST = iota
	NoTriggerTraceST
	TriggerTraceOnlyST
	RelaxedTriggerTraceOnlyST
	StrictTriggerTraceOnlyST
	LimitedTriggerTraceST
	NoSettingST
)

Setting types

View Source
const HTTPHeaderXTraceOptions = "X-Trace-Options"
View Source
const HTTPHeaderXTraceOptionsResponse = "X-Trace-Options-Response"
View Source
const HTTPHeaderXTraceOptionsSignature = "X-Trace-Options-Signature"
View Source
const (
	TestToken = "TOKEN"
)

Variables

View Source
var (
	ErrShutdownClosedReporter = errors.New("trying to shutdown a closed reporter")
	ErrShutdownTimeout        = errors.New("Shutdown timeout")
	ErrReporterIsClosed       = errors.New("the reporter is closed")
)

gRPC reporter errors

View Source
var SQLOperatorRunes = map[rune]bool{
	'.': true,
	';': true,
	'(': true,
	')': true,
	',': true,
	'+': true,
	'-': true,
	'*': true,
	'/': true,
	'|': true,
	'=': true,
	'!': true,
	'^': true,
	'>': true,
	'<': true,
	'[': true,
	']': true,
}

SQLOperatorRunes defines the list of SQL operators

Functions

func Closed

func Closed() bool

Closed indicates if the reporter has been shutdown

func DefaultBackoff

func DefaultBackoff(retries int, wait func(d time.Duration)) error

DefaultBackoff calls the wait function to sleep for a certain time based on the retries value. It returns immediately if the retries exceeds a threshold.

func Flush

func Flush() error

Flush flush the events buffer to stderr. Currently it's used for AWS Lambda only

func FlushRateCounts

func FlushRateCounts() map[string]*metrics.RateCounts

FlushRateCounts collects the request counters values by categories.

func HmacHash

func HmacHash(token, data []byte) string

func IncrementMetric

func IncrementMetric(name string, opts metrics.MetricOptions) error

IncrementMetric submits a incremental measurement to the reporter. The measurements will be collected in the background and reported periodically.

func NewContextFromMetadataString added in v1.16.0

func NewContextFromMetadataString(mdstr string) (*oboeContext, error)

func OboeCheckSettingsTimeout

func OboeCheckSettingsTimeout()

OboeCheckSettingsTimeout checks and deletes expired settings

func ReloadURLsConfig

func ReloadURLsConfig(filters []config.TransactionFilter)

ReloadURLsConfig reloads the configuration and build the transaction filtering filters and cache. This function is used for testing purpose only. It's not thread-safe.

func ReportSpan

func ReportSpan(span metrics.SpanMessage) error

ReportSpan is called from the app when a span message is available span span message to be put on the channel

returns error if channel is full

func SQLSanitize

func SQLSanitize(dbType string, sql string) string

SQLSanitize checks the sanitizer of the database type and does the sanitization accordingly. It uses the default sanitizer if the type is not found.

func SetServiceKey

func SetServiceKey(key string)

func Shutdown

func Shutdown(ctx context.Context) error

Shutdown flushes the metrics and stops the reporter. It blocked until the reporter is shutdown or the context is canceled.

func SummaryMetric

func SummaryMetric(name string, value float64, opts metrics.MetricOptions) error

SummaryMetric submits a summary type measurement to the reporter. The measurements will be collected in the background and reported periodically.

func ValidMetadata

func ValidMetadata(mdStr string) bool

ValidMetadata checks if a metadata string is valid.

func WaitForReady

func WaitForReady(ctx context.Context) bool

WaitForReady waits until the reporter becomes ready or the context is canceled.

Types

type Backoff

type Backoff func(retries int, wait func(d time.Duration)) error

type BucketOption

type BucketOption func(b *BytesBucket)

BucketOption defines the function type of option setters

func WithClosingIndicator

func WithClosingIndicator(closing chan struct{}) BucketOption

WithClosingIndicator assigns the closing indicator to the bucket

func WithGracefulShutdown

func WithGracefulShutdown(graceful bool) BucketOption

WithGracefulShutdown sets the flag which determined if the bucket will be closed gracefully.

func WithHWM

func WithHWM(HWM int) BucketOption

WithHWM provides a high watermark (in bytes) for the bucket

func WithIntervalGetter

func WithIntervalGetter(fn func() time.Duration) BucketOption

WithIntervalGetter provides a ticker to the bucket to drain it periodically.

type BytesBucket

type BytesBucket struct {

	// the high watermark of the bucket, we try to keep the current watermark
	// lower than HWM, but just in best-effort.
	HWM int
	// contains filtered or unexported fields
}

BytesBucket is a struct to simulate a bucket. It has two actions: pour some water into it from the water source, and drain it when it's drainable. This struct is **not** intended for concurrent-safe.

func NewBytesBucket

func NewBytesBucket(source chan []byte, opts ...BucketOption) *BytesBucket

NewBytesBucket returns a new BytesBucket object with the options provided

func (*BytesBucket) Count

func (b *BytesBucket) Count() int

Count returns the water count during a drain cycle

func (*BytesBucket) Drain

func (b *BytesBucket) Drain() [][]byte

Drain pour all the water out and make the bucket empty.

func (*BytesBucket) DroppedCount

func (b *BytesBucket) DroppedCount() int

DroppedCount returns the number of dropped water during a drain cycle

func (*BytesBucket) Full

func (b *BytesBucket) Full() bool

Full checks if it can be drained now. It is true either when the bucket is marked as full, or it reaches the maximum drain interval (we want to at least drain it periodically)

func (*BytesBucket) PourIn

func (b *BytesBucket) PourIn() int

PourIn pours as much water as possible from the source into the bucket and returns the water it pours in. This method blocks until it's either full or timeout.

func (*BytesBucket) Watermark

func (b *BytesBucket) Watermark() int

Watermark returns the current watermark of the bucket.

type Context

type Context interface {
	ReportEvent(label Label, layer string, args ...interface{}) error
	ReportEventWithOverrides(label Label, layer string, overrides Overrides, args ...interface{}) error
	ReportEventMap(label Label, layer string, keys map[string]interface{}) error
	Copy() Context
	IsSampled() bool
	SetSampled(trace bool)
	SetEnabled(enabled bool)
	GetEnabled() bool
	SetTransactionName(name string)
	GetTransactionName() string
	MetadataString() string
	NewEvent(label Label, layer string, addCtxEdge bool) Event
	GetVersion() uint8
}

A Context is an oboe context that may or not be tracing.

func NewContext

func NewContext(layer string, reportEntry bool, opts ContextOptions,
	cb func() KVMap) (ctx Context, ok bool, headers map[string]string)

NewContext starts a trace for the provided URL, possibly continuing one, if mdStr is provided. Setting reportEntry will report an entry event before this function returns, calling cb if provided for additional KV pairs.

func NewNullContext

func NewNullContext() Context

NewNullContext returns a context that is not tracing.

type ContextOptions

type ContextOptions struct {
	// MdStr is the string representation of the X-Trace ID.
	MdStr string
	// URL is used to do the URL-based transaction filtering.
	URL string
	// XTraceOptions represents the X-Trace-Options header.
	XTraceOptions string
	// CB is the callback function to produce the KVs.
	// XTraceOptionsSignature represents the X-Trace-Options-Signature header.
	XTraceOptionsSignature string
	Overrides              Overrides
	CB                     func() KVMap
}

ContextOptions defines the options of creating a context.

type DefaultDialer

type DefaultDialer struct{}

DefaultDialer implements the Dialer interface to provide the default dialing method.

func (*DefaultDialer) Dial

func (d *DefaultDialer) Dial(p DialParams) (*grpc.ClientConn, error)

Dial issues the connection to the remote address with attributes provided by the grpcConnection.

type DialParams

type DialParams struct {
	Certificate   []byte
	Address       string
	Proxy         string
	ProxyCertPath string
}

type Dialer

type Dialer interface {
	Dial(options DialParams) (*grpc.ClientConn, error)
}

Dialer has a method Dial which accepts a grpcConnection object as the argument and returns a ClientConn object.

type Event

type Event interface {
	ReportContext(c Context, addCtxEdge bool, args ...interface{}) error
	MetadataString() string
}

A Event is an event that may or may not be tracing, created by a Context.

type FSMState

type FSMState int

FSMState defines the states of a FSM

const (
	FSMUninitialized FSMState = iota
	FSMCopy
	FSMCopyEscape
	FSMStringStart
	FSMStringBody
	FSMStringEscape
	FSMStringEnd
	FSMNumber
	FSMNumericExtension
	FSMIdentifier
	FSMQuotedIdentifier
	FSMQuotedIdentifierEscape
)

The states for the SQL sanitization FSM

type FlushWriter

type FlushWriter interface {
	Write(t WriteType, bytes []byte) (int, error)
	Flush() error
}

FlushWriter offers an interface to write a byte slice to a specific destination. The caller needs to flush the buffer explicitly in async mode, while for sync mode, a flush is implicitly called after a write.

type GetSettingsMethod

type GetSettingsMethod struct {
	Resp *collector.SettingsResult
	// contains filtered or unexported fields
}

GetSettingsMethod is the struct for RPC method GetSettings

func (*GetSettingsMethod) Arg

func (gs *GetSettingsMethod) Arg() string

Arg returns the Arg of the RPC call result

func (*GetSettingsMethod) Call

Call issues an RPC call.

func (*GetSettingsMethod) CallSummary

func (gs *GetSettingsMethod) CallSummary() string

CallSummary returns a string representation of the RPC call result.

func (*GetSettingsMethod) Message

func (gs *GetSettingsMethod) Message() [][]byte

Message returns the message body of the RPC call.

func (*GetSettingsMethod) MessageLen

func (gs *GetSettingsMethod) MessageLen() int64

MessageLen returns the length of the RPC message body.

func (*GetSettingsMethod) RequestSize

func (gs *GetSettingsMethod) RequestSize() int64

RequestSize returns the total bytes for an rpc request body

func (*GetSettingsMethod) ResultCode

func (gs *GetSettingsMethod) ResultCode() (collector.ResultCode, error)

ResultCode returns the result code of the RPC call

func (*GetSettingsMethod) RetryOnErr

func (gs *GetSettingsMethod) RetryOnErr(err error) bool

RetryOnErr denotes if this method needs a retry on failure.

func (*GetSettingsMethod) ServiceKey

func (gs *GetSettingsMethod) ServiceKey() string

func (*GetSettingsMethod) String

func (gs *GetSettingsMethod) String() string

type GrpcConnOpt

type GrpcConnOpt func(c *grpcConnection)

GrpcConnOpt defines the function type that sets an option of the grpcConnection

func WithBackoff

func WithBackoff(b Backoff) GrpcConnOpt

WithBackoff return a function that sets the backoff option

func WithCert

func WithCert(cert []byte) GrpcConnOpt

WithCert returns a function that sets the certificate

func WithDialer

func WithDialer(d Dialer) GrpcConnOpt

WithDialer returns a function that sets the Dialer option

func WithMaxReqBytes

func WithMaxReqBytes(size int64) GrpcConnOpt

WithMaxReqBytes sets the maximum size of an RPC request

func WithProxy

func WithProxy(proxy string) GrpcConnOpt

WithProxy assign the proxy url to the gRPC connection

func WithProxyCertPath

func WithProxyCertPath(certPath string) GrpcConnOpt

WithProxyCertPath assigns the proxy TLS certificate path to the gRPC connection

type KVMap

type KVMap map[string]interface{}

type Label

type Label string

Label is a required event attribute.

type LogData

type LogData struct {
	Events  []string `json:"events,omitempty"`
	Metrics []string `json:"metrics,omitempty"`
}

type Method

type Method interface {
	// Call invokes the RPC method through a specified gRPC client. It may return
	// an error if the call is failed and no result code is returned by the collector
	// due to some reason, e.g., the transport issue.
	Call(ctx context.Context, c collector.TraceCollectorClient) error

	// CallSummary returns a string indicating the summary of this call, e.g., the
	// data chunks sent out and the round trip time.It is for logging purpose only.
	CallSummary() string

	// MessageLen returns the length (number of elements) of the method request
	MessageLen() int64

	// RequestSize returns the total bytes for an rpc request body
	RequestSize() int64

	// Message returns the message body, if any
	Message() [][]byte

	// ResultCode is the return code of the RPC call. It must only be called after
	// the Call() method is invoked.
	ResultCode() (collector.ResultCode, error)

	// Arg returns the Arg field of the RPC call result. It must only be called
	// after the Call() method is invoked.
	Arg() string

	// String returns the string representation of the Method object
	String() string

	// RetryOnErr checks if the method allows retry
	RetryOnErr(error) bool

	// ServiceKey returns the service key attached to this method
	ServiceKey() string
}

Method defines the interface of an RPC call

type Overrides added in v1.16.0

type Overrides struct {
	ExplicitTS    time.Time
	ExplicitMdStr string
}

type PingMethod

type PingMethod struct {
	Resp *collector.MessageResult
	// contains filtered or unexported fields
}

PingMethod defines the RPC method `Ping`

func (*PingMethod) Arg

func (p *PingMethod) Arg() string

Arg returns the arg of the RPC call result

func (*PingMethod) Call

Call makes an RPC call with the information provided.

func (*PingMethod) CallSummary

func (p *PingMethod) CallSummary() string

CallSummary returns a string representation for the RPC call result. It is mainly used for debug printing.

func (*PingMethod) Message

func (p *PingMethod) Message() [][]byte

Message returns the message body, if any.

func (*PingMethod) MessageLen

func (p *PingMethod) MessageLen() int64

MessageLen returns the length of the RPC call message body.

func (*PingMethod) RequestSize

func (p *PingMethod) RequestSize() int64

RequestSize returns the total bytes for an rpc request body

func (*PingMethod) ResultCode

func (p *PingMethod) ResultCode() (collector.ResultCode, error)

ResultCode returns the code of the RPC call result

func (*PingMethod) RetryOnErr

func (p *PingMethod) RetryOnErr(err error) bool

RetryOnErr denotes if this RPC method needs a retry on failure.

func (*PingMethod) ServiceKey

func (p *PingMethod) ServiceKey() string

func (*PingMethod) String

func (p *PingMethod) String() string

type PostEventsMethod

type PostEventsMethod struct {
	Resp *collector.MessageResult
	// contains filtered or unexported fields
}

PostEventsMethod is the struct for RPC method PostEvents

func (*PostEventsMethod) Arg

func (pe *PostEventsMethod) Arg() string

Arg returns the Arg of the PostEvents RPC call. This method should only be invoked after the method Call is called.

func (*PostEventsMethod) Call

Call issues an RPC call with the provided information

func (*PostEventsMethod) CallSummary

func (pe *PostEventsMethod) CallSummary() string

CallSummary returns a string representation of the RPC call result. It is mainly used for debug printing.

func (*PostEventsMethod) Message

func (pe *PostEventsMethod) Message() [][]byte

Message returns the message body of the RPC call

func (*PostEventsMethod) MessageLen

func (pe *PostEventsMethod) MessageLen() int64

MessageLen returns the length of the PostEvents RPC message body.

func (*PostEventsMethod) RequestSize

func (pe *PostEventsMethod) RequestSize() int64

RequestSize returns the total bytes for an rpc request body

func (*PostEventsMethod) ResultCode

func (pe *PostEventsMethod) ResultCode() (collector.ResultCode, error)

ResultCode returns the result code of the PostEvents RPC call. This method should only be invoked after the method Call is called.

func (*PostEventsMethod) RetryOnErr

func (pe *PostEventsMethod) RetryOnErr(err error) bool

RetryOnErr denotes if retry is needed for this RPC method

func (*PostEventsMethod) ServiceKey

func (pe *PostEventsMethod) ServiceKey() string

func (*PostEventsMethod) String

func (pe *PostEventsMethod) String() string

type PostMetricsMethod

type PostMetricsMethod struct {
	Resp *collector.MessageResult
	// contains filtered or unexported fields
}

PostMetricsMethod is the struct for RPC method PostMetrics

func (*PostMetricsMethod) Arg

func (pm *PostMetricsMethod) Arg() string

Arg returns the Arg of the RPC call result

func (*PostMetricsMethod) Call

Call issues an RPC request with the provided information.

func (*PostMetricsMethod) CallSummary

func (pm *PostMetricsMethod) CallSummary() string

CallSummary returns a string representation of the RPC call result. It is mainly used for debug printing.

func (*PostMetricsMethod) Message

func (pm *PostMetricsMethod) Message() [][]byte

Message returns the message body of the RPC call.

func (*PostMetricsMethod) MessageLen

func (pm *PostMetricsMethod) MessageLen() int64

MessageLen returns the length of the RPC call message.

func (*PostMetricsMethod) RequestSize

func (pm *PostMetricsMethod) RequestSize() int64

RequestSize returns the total bytes for an rpc request body

func (*PostMetricsMethod) ResultCode

func (pm *PostMetricsMethod) ResultCode() (collector.ResultCode, error)

ResultCode returns the result code of the RPC call. This method should only be called after the method Call is invoked.

func (*PostMetricsMethod) RetryOnErr

func (pm *PostMetricsMethod) RetryOnErr(err error) bool

RetryOnErr denotes if retry is needed for this RPC method

func (*PostMetricsMethod) ServiceKey

func (pm *PostMetricsMethod) ServiceKey() string

func (*PostMetricsMethod) String

func (pm *PostMetricsMethod) String() string

type PostStatusMethod

type PostStatusMethod struct {
	Resp *collector.MessageResult
	// contains filtered or unexported fields
}

PostStatusMethod is the struct for RPC method PostStatus

func (*PostStatusMethod) Arg

func (ps *PostStatusMethod) Arg() string

Arg returns the Arg of the RPC call result.

func (*PostStatusMethod) Call

Call issues an RPC call with the provided information.

func (*PostStatusMethod) CallSummary

func (ps *PostStatusMethod) CallSummary() string

CallSummary returns a string representation for the RPC call result. It is mainly used for debug printing.

func (*PostStatusMethod) Message

func (ps *PostStatusMethod) Message() [][]byte

Message returns the RPC call message body

func (*PostStatusMethod) MessageLen

func (ps *PostStatusMethod) MessageLen() int64

MessageLen returns the length of the RPC call message body

func (*PostStatusMethod) RequestSize

func (ps *PostStatusMethod) RequestSize() int64

RequestSize returns the total bytes for an rpc request body

func (*PostStatusMethod) ResultCode

func (ps *PostStatusMethod) ResultCode() (collector.ResultCode, error)

ResultCode returns the result code of the RPC call.

func (*PostStatusMethod) RetryOnErr

func (ps *PostStatusMethod) RetryOnErr(err error) bool

RetryOnErr denotes if retry is needed for this RPC method

func (*PostStatusMethod) ServiceKey

func (ps *PostStatusMethod) ServiceKey() string

func (*PostStatusMethod) String

func (ps *PostStatusMethod) String() string

type SQLSanitizer

type SQLSanitizer struct {
	// contains filtered or unexported fields
}

SQLSanitizer sanitizes the SQL statement by removing literals from it.

func NewSQLSanitizer

func NewSQLSanitizer(dbType string, sanitizeFlag int) *SQLSanitizer

NewSQLSanitizer returns the pointer of a new SQLSanitizer.

func (*SQLSanitizer) Sanitize

func (s *SQLSanitizer) Sanitize(sql string) string

Sanitize does the SQL sanitization by removing literals from the statement, it also truncates the statement after sanitization if it's longer than MaxSQLLen.

type SampleDecision

type SampleDecision struct {
	// contains filtered or unexported fields
}

type ServerlessMessage

type ServerlessMessage struct {
	Data LogData `json:"ao-data"`
}

ServerlessMessage denotes the message to be written to AWS CloudWatch. The forwarder will decode the message and sent the messages to the AO collector.

type TestReporter

type TestReporter struct {
	EventBufs      [][]byte
	SpanMessages   []metrics.SpanMessage
	ShouldTrace    bool
	ShouldError    bool
	UseSettings    bool
	SettingType    int
	CaptureMetrics bool
	ErrorEvents    map[int]bool // whether to drop an event

	Timeout time.Duration
	// contains filtered or unexported fields
}

TestReporter appends reported events to Bufs if ShouldTrace is true.

func SetTestReporter

func SetTestReporter(options ...TestReporterOption) *TestReporter

SetTestReporter sets and returns a test reporter that captures raw event bytes for making assertions about using the graphtest package.

func (*TestReporter) Close

func (r *TestReporter) Close(numBufs int)

Close stops the test reporter from listening for events; r.EventBufs will no longer be updated and any calls to WritePacket() will panic.

func (*TestReporter) Closed

func (r *TestReporter) Closed() bool

Closed returns if the reporter is closed or not TODO: not supported

func (*TestReporter) CustomIncrementMetric

func (r *TestReporter) CustomIncrementMetric(name string, opts metrics.MetricOptions) error

func (*TestReporter) CustomSummaryMetric

func (r *TestReporter) CustomSummaryMetric(name string, value float64, opts metrics.MetricOptions) error

func (*TestReporter) Flush

func (r *TestReporter) Flush() error

func (*TestReporter) SetServiceKey

func (r *TestReporter) SetServiceKey(key string)

func (*TestReporter) Shutdown

func (r *TestReporter) Shutdown(ctx context.Context) error

Shutdown closes the Test reporter TODO: not supported

func (*TestReporter) ShutdownNow

func (r *TestReporter) ShutdownNow() error

ShutdownNow closes the Test reporter immediately

func (*TestReporter) WaitForReady

func (r *TestReporter) WaitForReady(ctx context.Context) bool

WaitForReady checks the state of the reporter and may wait for up to the specified duration until it becomes ready.

type TestReporterOption

type TestReporterOption func(*TestReporter)

TestReporterOption values may be passed to SetTestReporter.

func TestReporterDisableDefaultSetting

func TestReporterDisableDefaultSetting(val bool) TestReporterOption

TestReporterDisableDefaultSetting disables the default 100% test sampling rate and leaves settings state empty.

func TestReporterDisableTracing

func TestReporterDisableTracing() TestReporterOption

TestReporterDisableTracing turns off settings lookup and ensures oboeSampleRequest returns false.

func TestReporterSettingType

func TestReporterSettingType(tp int) TestReporterOption

func TestReporterShouldTrace

func TestReporterShouldTrace(val bool) TestReporterOption

TestReporterShouldTrace sets the first argument of the return value of oboeSampleRequest().

func TestReporterTimeout

func TestReporterTimeout(timeout time.Duration) TestReporterOption

TestReporterTimeout sets a timeout for the TestReporter to wait before shutting down its writer.

func TestReporterUseSettings

func TestReporterUseSettings(val bool) TestReporterOption

TestReporterUseSettings sets whether to look up settings lookup or return the value of r.ShouldTrace.

type TriggerTraceMode

type TriggerTraceMode int
const (
	// ModeTriggerTraceNotPresent means there is no X-Trace-Options header detected,
	// or the X-Trace-Options header is present but trigger_trace flag is not. This
	// indicates that it's a trace for regular sampling.
	ModeTriggerTraceNotPresent TriggerTraceMode = iota

	// ModeInvalidTriggerTrace means X-Trace-Options is detected but no valid trigger-trace
	// flag found, or X-Trace-Options-Signature is present but the authentication is failed.
	ModeInvalidTriggerTrace

	// ModeRelaxedTriggerTrace means X-Trace-Options-Signature is present and valid.
	// The trace will be sampled/limited by the relaxed token bucket.
	ModeRelaxedTriggerTrace

	// ModeStrictTriggerTrace means no X-Trace-Options-Signature is present. The trace
	// will be limited by the strict token bucket.
	ModeStrictTriggerTrace
)

func (TriggerTraceMode) Enabled

func (tm TriggerTraceMode) Enabled() bool

Enabled indicates whether it's a trigger-trace request

func (TriggerTraceMode) Requested

func (tm TriggerTraceMode) Requested() bool

Requested indicates whether the user tries to issue a trigger-trace request (but may be rejected if the header is illegal)

type WriteType

type WriteType int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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