Documentation
¶
Index ¶
- Constants
- Variables
- func FilterEvents(events []publisher.Event) ([]publisher.Event, error)
- func FormatApiAppKey(apiID, appID string) string
- func GetApiAppErrorSampling() map[string]struct{}
- func GetGlobalSampling() *sample
- func GetGlobalSamplingPercentage() (float64, error)
- func GetStatusFromCodeString(statusCode string) statusText
- func RemoveApiAppKey(apiServiceName, managedAppName string)
- func SetExternalAppKeyData(key definitions.ExternalAppData)
- func SetupSampling(cfg Sampling, offlineMode bool, apicDeployment string, opts ...SamplingOption) error
- func ShouldSampleTransaction(details TransactionDetails) (bool, error)
- func WithCacheAccess(ca cacheAccess) func(*Sampling)
- type Sampling
- type SamplingOption
- type TransactionDetails
Constants ¶
const ( Success statusText = "Success" Failure statusText = "Failure" Exception statusText = "Exception" )
const (
SampleKey = "sample"
)
SampleKey - the key used in the metadata when a transaction qualifies for sampling and should be sent to Observer defaultSamplingRate - the default sampling rate in percentage
Variables ¶
var ( ErrGlobalSamplingCfg = errors.New(1520, "the global sampling config has not been initialized") ErrSamplingCfg = errors.Newf(1521, "sampling percentage must be between 0 and %v. Setting sampling percentage to default value of %v percent") )
Config errors
Functions ¶
func FilterEvents ¶
FilterEvents - returns an array of events that are part of the sample
func FormatApiAppKey ¶ added in v1.1.133
func GetApiAppErrorSampling ¶ added in v1.1.133
func GetApiAppErrorSampling() map[string]struct{}
GetApiAppErrorSampling -
func GetGlobalSamplingPercentage ¶
GetGlobalSamplingPercentage -
func GetStatusFromCodeString ¶ added in v1.1.121
func GetStatusFromCodeString(statusCode string) statusText
func RemoveApiAppKey ¶ added in v1.1.133
func RemoveApiAppKey(apiServiceName, managedAppName string)
func SetExternalAppKeyData ¶ added in v1.1.133
func SetExternalAppKeyData(key definitions.ExternalAppData)
func SetupSampling ¶
func SetupSampling(cfg Sampling, offlineMode bool, apicDeployment string, opts ...SamplingOption) error
SetupSampling - set up the global sampling for use by traceability
func ShouldSampleTransaction ¶
func ShouldSampleTransaction(details TransactionDetails) (bool, error)
ShouldSampleTransaction - receives the transaction details and returns true to sample it false to not
func WithCacheAccess ¶ added in v1.1.134
func WithCacheAccess(ca cacheAccess) func(*Sampling)
Types ¶
type Sampling ¶
type Sampling struct {
Percentage float64 `config:"percentage"`
PerAPI bool `config:"per_api"`
PerSub bool `config:"per_subscription"`
OnlyErrors bool `config:"onlyErrors" yaml:"onlyErrors"`
ErrorSamplingEnabled bool
// contains filtered or unexported fields
}
Sampling - configures the sampling of events the agent sends to Amplify
func DefaultConfig ¶
func DefaultConfig() Sampling
DefaultConfig - returns a default sampling config where all transactions are sent
type SamplingOption ¶ added in v1.1.134
type SamplingOption func(*Sampling)
type TransactionDetails ¶
TransactionDetails - details about the transaction that are used for sampling