Documentation ¶
Overview ¶
© 2023 SolarWinds Worldwide, LLC. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
© 2023 SolarWinds Worldwide, LLC. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
© 2023 SolarWinds Worldwide, LLC. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func Closed() bool
- func DefaultBackoff(retries int, wait func(d time.Duration)) error
- func FlushRateCounts() map[string]*metrics.RateCounts
- func GetServiceName() string
- func HmacHash(token, data []byte) string
- func HmacHashTT(data []byte) (string, error)
- func OboeCheckSettingsTimeout()
- func ReloadURLsConfig(filters []config.TransactionFilter)
- func ReportEvent(e Event) error
- func ReportStatus(e Event) error
- func SQLSanitize(dbType string, sql string) string
- func SetGlobalReporter(r Reporter) func()
- func SetServiceKey(key string) error
- func Shutdown(ctx context.Context) error
- func Start(r *resource.Resource)
- func WaitForReady(ctx context.Context) bool
- type AuthStatus
- type Backoff
- type BucketOption
- type BytesBucket
- type DefaultDialer
- type DialParams
- type Dialer
- type Event
- func CreateEntryEvent(ctx trace.SpanContext, t time.Time, parent trace.SpanContext) Event
- func CreateExceptionEvent(ctx trace.SpanContext, t time.Time) Event
- func CreateExitEvent(ctx trace.SpanContext, t time.Time) Event
- func CreateInfoEvent(ctx trace.SpanContext, t time.Time) Event
- func EventFromOtelEvent(ctx trace.SpanContext, evt sdktrace.Event) Event
- func NewEvent(tid trace.TraceID, oid opID, t time.Time) Event
- func NewEventWithRandomOpID(tid trace.TraceID, t time.Time) Event
- type FSMState
- type FlushWriter
- type GetSettingsMethod
- func (gs *GetSettingsMethod) Arg() string
- func (gs *GetSettingsMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
- func (gs *GetSettingsMethod) CallSummary() string
- func (gs *GetSettingsMethod) Message() [][]byte
- func (gs *GetSettingsMethod) MessageLen() int64
- func (gs *GetSettingsMethod) RequestSize() int64
- func (gs *GetSettingsMethod) ResultCode() (collector.ResultCode, error)
- func (gs *GetSettingsMethod) RetryOnErr(err error) bool
- func (gs *GetSettingsMethod) ServiceKey() string
- func (gs *GetSettingsMethod) String() string
- type GrpcConnOpt
- type Label
- type LogData
- type Method
- type PingMethod
- func (p *PingMethod) Arg() string
- func (p *PingMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
- func (p *PingMethod) CallSummary() string
- func (p *PingMethod) Message() [][]byte
- func (p *PingMethod) MessageLen() int64
- func (p *PingMethod) RequestSize() int64
- func (p *PingMethod) ResultCode() (collector.ResultCode, error)
- func (p *PingMethod) RetryOnErr(err error) bool
- func (p *PingMethod) ServiceKey() string
- func (p *PingMethod) String() string
- type PostEventsMethod
- func (pe *PostEventsMethod) Arg() string
- func (pe *PostEventsMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
- func (pe *PostEventsMethod) CallSummary() string
- func (pe *PostEventsMethod) Message() [][]byte
- func (pe *PostEventsMethod) MessageLen() int64
- func (pe *PostEventsMethod) RequestSize() int64
- func (pe *PostEventsMethod) ResultCode() (collector.ResultCode, error)
- func (pe *PostEventsMethod) RetryOnErr(err error) bool
- func (pe *PostEventsMethod) ServiceKey() string
- func (pe *PostEventsMethod) String() string
- type PostMetricsMethod
- func (pm *PostMetricsMethod) Arg() string
- func (pm *PostMetricsMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
- func (pm *PostMetricsMethod) CallSummary() string
- func (pm *PostMetricsMethod) Message() [][]byte
- func (pm *PostMetricsMethod) MessageLen() int64
- func (pm *PostMetricsMethod) RequestSize() int64
- func (pm *PostMetricsMethod) ResultCode() (collector.ResultCode, error)
- func (pm *PostMetricsMethod) RetryOnErr(err error) bool
- func (pm *PostMetricsMethod) ServiceKey() string
- func (pm *PostMetricsMethod) String() string
- type PostStatusMethod
- func (ps *PostStatusMethod) Arg() string
- func (ps *PostStatusMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
- func (ps *PostStatusMethod) CallSummary() string
- func (ps *PostStatusMethod) Message() [][]byte
- func (ps *PostStatusMethod) MessageLen() int64
- func (ps *PostStatusMethod) RequestSize() int64
- func (ps *PostStatusMethod) ResultCode() (collector.ResultCode, error)
- func (ps *PostStatusMethod) RetryOnErr(err error) bool
- func (ps *PostStatusMethod) ServiceKey() string
- func (ps *PostStatusMethod) String() string
- type Reporter
- type SQLSanitizer
- type SampleDecision
- func (s SampleDecision) BucketCapacity() float64
- func (s SampleDecision) BucketCapacityStr() string
- func (s SampleDecision) BucketRate() float64
- func (s SampleDecision) BucketRateStr() string
- func (s SampleDecision) Enabled() bool
- func (s SampleDecision) SampleRate() int
- func (s SampleDecision) SampleSource() SampleSource
- func (s SampleDecision) Trace() bool
- func (s SampleDecision) XTraceOptsRsp() string
- type SampleSource
- type ServerlessMessage
- type TestReporter
- func (r *TestReporter) Close(numBufs int)
- func (r *TestReporter) Closed() bool
- func (r *TestReporter) GetServiceName() string
- func (r *TestReporter) ReportEvent(Event) error
- func (r *TestReporter) ReportStatus(Event) error
- func (r *TestReporter) SetServiceKey(string) error
- func (r *TestReporter) Shutdown(context.Context) error
- func (r *TestReporter) ShutdownNow()
- func (r *TestReporter) WaitForReady(context.Context) bool
- type TestReporterOption
- type TriggerTraceMode
- type WriteType
Constants ¶
const ( AuthOK = iota AuthBadTimestamp AuthNoSignatureKey AuthBadSignature )
const ( EventWT = iota MetricWT )
const ( TraceDisabled tracingMode = iota // disable tracing, will neither start nor continue traces TraceEnabled // perform sampling every inbound request for tracing TraceUnknown // for cache purpose only )
tracing modes
const ( TYPE_DEFAULT settingType = iota // default setting which serves as a fallback if no other settings found TYPE_LAYER // layer specific settings )
setting types
const ( FlagInvalidOffset = iota FlagOverrideOffset FlagSampleStartOffset FlagSampleThroughOffset FlagSampleThroughAlwaysOffset FlagTriggerTraceOffset )
setting flags offset
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
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
const ( PostgreSQL = "postgresql" Oracle = "oracle" MySQL = "mysql" Sybase = "sybase" SQLServer = "sqlserver" DefaultDB = "default" )
The database types
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 = '…' )
const ( DefaultST = iota NoTriggerTraceST TriggerTraceOnlyST RelaxedTriggerTraceOnlyST StrictTriggerTraceOnlyST LimitedTriggerTraceST SampleThroughST DisabledST NoSettingST )
Setting types
const (
TestToken = "TOKEN"
)
Variables ¶
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
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 DefaultBackoff ¶
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 FlushRateCounts ¶
func FlushRateCounts() map[string]*metrics.RateCounts
FlushRateCounts collects the request counters values by categories.
func GetServiceName ¶
func GetServiceName() string
func HmacHashTT ¶
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 ReportEvent ¶
func ReportStatus ¶
func SQLSanitize ¶
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 SetGlobalReporter ¶
func SetGlobalReporter(r Reporter) func()
func SetServiceKey ¶
func Shutdown ¶
Shutdown flushes the metrics and stops the reporter. It blocked until the reporter is shutdown or the context is canceled.
func WaitForReady ¶
WaitForReady waits until the reporter becomes ready or the context is canceled.
Types ¶
type AuthStatus ¶
type AuthStatus int
func ValidateXTraceOptionsSignature ¶
func ValidateXTraceOptionsSignature(signature, ts, data string) AuthStatus
TODO: This could live in the `xtrace` package, except it requires TODO: the ability to extract the TT Token from oboe settings. TODO: Determine a clean/elegant way to clean this up.
func (AuthStatus) IsError ¶
func (a AuthStatus) IsError() bool
func (AuthStatus) Msg ¶
func (a AuthStatus) Msg() string
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 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 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 { AddKV(attribute.KeyValue) AddKVs([]attribute.KeyValue) SetLabel(Label) SetLayer(string) SetParent(trace.SpanID) GetXTrace() string GetSwTraceContext() string ToBson() []byte }
func CreateEntryEvent ¶
func CreateEntryEvent(ctx trace.SpanContext, t time.Time, parent trace.SpanContext) Event
func CreateExceptionEvent ¶
func CreateExceptionEvent(ctx trace.SpanContext, t time.Time) Event
func CreateExitEvent ¶
func CreateExitEvent(ctx trace.SpanContext, t time.Time) Event
func CreateInfoEvent ¶
func CreateInfoEvent(ctx trace.SpanContext, t time.Time) Event
func EventFromOtelEvent ¶
func EventFromOtelEvent(ctx trace.SpanContext, evt sdktrace.Event) Event
type FlushWriter ¶
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 ¶
func (gs *GetSettingsMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
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 string) 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 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 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 ¶
func (p *PingMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
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 ¶
func (pe *PostEventsMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
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 ¶
func (pm *PostMetricsMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
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 ¶
func (ps *PostStatusMethod) Call(ctx context.Context, c collector.TraceCollectorClient) error
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 Reporter ¶
type Reporter interface { ReportEvent(e Event) error ReportStatus(e Event) error // Shutdown closes the Reporter. Shutdown(ctx context.Context) error // ShutdownNow closes the Reporter immediately, logs on error ShutdownNow() // Closed returns if the Reporter is already closed. Closed() bool // WaitForReady waits until the Reporter becomes ready or the context is canceled. WaitForReady(context.Context) bool // SetServiceKey attaches a service key to the Reporter // Returns error if service key is invalid SetServiceKey(key string) error // GetServiceName retrieves the current service name, preferring an otel `service.name` from resource attributes, // falling back to the service name in the service key GetServiceName() string }
defines what methods a Reporter should offer (internal to Reporter package)
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
}
func ShouldTraceRequestWithURL ¶
func ShouldTraceRequestWithURL(traced bool, url string, ttMode TriggerTraceMode, swState w3cfmt.SwTraceState) SampleDecision
func (SampleDecision) BucketCapacity ¶
func (s SampleDecision) BucketCapacity() float64
func (SampleDecision) BucketCapacityStr ¶
func (s SampleDecision) BucketCapacityStr() string
func (SampleDecision) BucketRate ¶
func (s SampleDecision) BucketRate() float64
func (SampleDecision) BucketRateStr ¶
func (s SampleDecision) BucketRateStr() string
func (SampleDecision) Enabled ¶
func (s SampleDecision) Enabled() bool
func (SampleDecision) SampleRate ¶
func (s SampleDecision) SampleRate() int
func (SampleDecision) SampleSource ¶
func (s SampleDecision) SampleSource() SampleSource
func (SampleDecision) Trace ¶
func (s SampleDecision) Trace() bool
func (SampleDecision) XTraceOptsRsp ¶
func (s SampleDecision) XTraceOptsRsp() string
type SampleSource ¶
type SampleSource int
enums used by sampling and tracing settings
const ( SAMPLE_SOURCE_UNSET SampleSource = iota - 1 SAMPLE_SOURCE_NONE SAMPLE_SOURCE_FILE SAMPLE_SOURCE_DEFAULT SAMPLE_SOURCE_LAYER )
source of the sample value
type ServerlessMessage ¶
type ServerlessMessage struct {
Data LogData `json:"apm-data"`
}
ServerlessMessage denotes the message to be written to AWS CloudWatch. The forwarder will decode the message and sent the messages to the SolarWinds Observability collector.
type TestReporter ¶
type TestReporter struct { EventBufs [][]byte 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) GetServiceName ¶
func (r *TestReporter) GetServiceName() string
func (*TestReporter) ReportEvent ¶
func (r *TestReporter) ReportEvent(Event) error
func (*TestReporter) ReportStatus ¶
func (r *TestReporter) ReportStatus(Event) error
func (*TestReporter) SetServiceKey ¶
func (r *TestReporter) SetServiceKey(string) error
func (*TestReporter) Shutdown ¶
func (r *TestReporter) Shutdown(context.Context) error
Shutdown closes the Test reporter TODO: not supported
func (*TestReporter) ShutdownNow ¶
func (r *TestReporter) ShutdownNow()
ShutdownNow closes the Test reporter immediately
func (*TestReporter) WaitForReady ¶
func (r *TestReporter) WaitForReady(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 TestReporterSettingType ¶
func TestReporterSettingType(tp int) TestReporterOption
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)