Documentation
¶
Index ¶
- type CentralizedManifest
- type CentralizedReservoir
- type CentralizedRule
- type CentralizedStrategy
- type Decision
- type GetSamplingRulesInput
- type GetSamplingRulesOutput
- type GetSamplingTargetsInput
- type GetSamplingTargetsOutput
- type LocalizedStrategy
- type Properties
- type Request
- type Reservoir
- type Rule
- type RuleManifest
- type SamplingRule
- type SamplingRuleRecord
- type SamplingStatisticsDocument
- type SamplingTargetDocument
- type Strategy
- type UnprocessedStatistics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CentralizedManifest ¶
type CentralizedManifest struct {
Default *CentralizedRule
Rules []*CentralizedRule
Index map[string]*CentralizedRule
// contains filtered or unexported fields
}
CentralizedManifest represents a full sampling ruleset, with a list of custom rules and default values for incoming requests that do not match any of the provided rules.
type CentralizedReservoir ¶
type CentralizedReservoir struct {
// contains filtered or unexported fields
}
CentralizedReservoir is a reservoir distributed among all running instances of the SDK
func (*CentralizedReservoir) Take ¶
func (r *CentralizedReservoir) Take(now int64) bool
Take consumes quota from reservoir, if any remains, and returns true. False otherwise.
type CentralizedRule ¶
type CentralizedRule struct {
// Common sampling rule properties
*Properties
// contains filtered or unexported fields
}
CentralizedRule represents a centralized sampling rule
func (*CentralizedRule) AppliesTo ¶
func (r *CentralizedRule) AppliesTo(request *Request) bool
AppliesTo returns true if the sampling rule matches against given sampling request. False Otherwise. Assumes lock is already held, if required.
func (*CentralizedRule) Sample ¶
func (r *CentralizedRule) Sample() *Decision
Sample returns true if the request should be sampled. False otherwise.
type CentralizedStrategy ¶
type CentralizedStrategy struct {
// contains filtered or unexported fields
}
CentralizedStrategy is an implementation of SamplingStrategy. It performs quota-based sampling with X-Ray acting as arbitrator for clients. It will fall back to LocalizedStrategy if sampling rules are not available from X-Ray APIS.
func NewCentralizedStrategy ¶
func NewCentralizedStrategy() (*CentralizedStrategy, error)
NewCentralizedStrategy creates a centralized sampling strategy with a fallback on local default rule.
func NewCentralizedStrategyWithFilePath ¶
func NewCentralizedStrategyWithFilePath(fp string) (*CentralizedStrategy, error)
NewCentralizedStrategyWithFilePath creates a centralized sampling strategy with a fallback on local rules located at the given file path.
func NewCentralizedStrategyWithJSONBytes ¶
func NewCentralizedStrategyWithJSONBytes(b []byte) (*CentralizedStrategy, error)
NewCentralizedStrategyWithJSONBytes creates a centralized sampling strategy with a fallback on local rules specified in the given byte slice.
func (*CentralizedStrategy) LoadDaemonEndpoints ¶
func (ss *CentralizedStrategy) LoadDaemonEndpoints(endpoints *daemoncfg.DaemonEndpoints)
LoadDaemonEndpoints configures proxy with the provided endpoint.
func (*CentralizedStrategy) ShouldTrace ¶
func (ss *CentralizedStrategy) ShouldTrace(request *Request) *Decision
ShouldTrace determines whether a request should be sampled. It matches the given parameters against a list of known rules and uses the matched rule's values to make a decision.
type GetSamplingRulesInput ¶
type GetSamplingRulesInput struct {
// Pagination token.
NextToken *string `type:"string"`
}
type GetSamplingRulesOutput ¶
type GetSamplingRulesOutput struct {
// Pagination token.
NextToken *string `json:"NextToken"`
// Rule definitions and metadata.
SamplingRuleRecords []*SamplingRuleRecord `json:"SamplingRuleRecords"`
}
type GetSamplingTargetsInput ¶
type GetSamplingTargetsInput struct {
// Information about rules that the service is using to sample requests.
//
// SamplingStatisticsDocuments is a required field
SamplingStatisticsDocuments []*SamplingStatisticsDocument `type:"list" required:"true"`
}
type GetSamplingTargetsOutput ¶
type GetSamplingTargetsOutput struct {
// The last time a user changed the sampling rule configuration. If the sampling
// rule configuration changed since the service last retrieved it, the service
// should call GetSamplingRules (https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingRules.html)
// to get the latest version.
LastRuleModification *float64 `json:"LastRuleModification"`
// Updated rules that the service should use to sample requests.
SamplingTargetDocuments []*SamplingTargetDocument `json:"SamplingTargetDocuments"`
// Information about SamplingStatisticsDocument (https://docs.aws.amazon.com/xray/latest/api/API_SamplingStatisticsDocument.html)
// that X-Ray could not process.
UnprocessedStatistics []*UnprocessedStatistics `json:"UnprocessedStatistics"`
}
type LocalizedStrategy ¶
type LocalizedStrategy struct {
// contains filtered or unexported fields
}
LocalizedStrategy makes trace sampling decisions based on a set of rules provided in a local JSON file. Trace sampling decisions are made by the root node in the trace. If a sampling decision is made by the root service, it will be passed to downstream services through the trace header.
func NewLocalizedStrategy ¶
func NewLocalizedStrategy() (*LocalizedStrategy, error)
NewLocalizedStrategy initializes an instance of LocalizedStrategy with the default trace sampling rules. The default rules sample the first request per second, and 5% of requests thereafter.
func NewLocalizedStrategyFromFilePath ¶
func NewLocalizedStrategyFromFilePath(fp string) (*LocalizedStrategy, error)
NewLocalizedStrategyFromFilePath initializes an instance of LocalizedStrategy using a custom ruleset found at the filepath fp.
func NewLocalizedStrategyFromJSONBytes ¶
func NewLocalizedStrategyFromJSONBytes(b []byte) (*LocalizedStrategy, error)
NewLocalizedStrategyFromJSONBytes initializes an instance of LocalizedStrategy using a custom ruleset provided in the json bytes b.
func (*LocalizedStrategy) ShouldTrace ¶
func (lss *LocalizedStrategy) ShouldTrace(rq *Request) *Decision
ShouldTrace consults the LocalizedStrategy's rule set to determine if the given request should be traced or not.
type Properties ¶
type Properties struct {
ServiceName string `json:"service_name"`
Host string `json:"host"`
HTTPMethod string `json:"http_method"`
URLPath string `json:"url_path"`
FixedTarget int64 `json:"fixed_target"`
Rate float64 `json:"rate"`
}
Properties is the base set of properties that define a sampling rule.
func (*Properties) AppliesTo ¶
func (p *Properties) AppliesTo(host, path, method string) bool
AppliesTo returns true if the sampling rule matches against given parameters. False Otherwise. Assumes lock is already held, if required.
type Reservoir ¶
type Reservoir struct {
// contains filtered or unexported fields
}
Reservoir is a reservoir local to the running instance of the SDK
type Rule ¶
type Rule struct {
// Common sampling rule properties
*Properties
// contains filtered or unexported fields
}
Rule is local sampling rule.
type RuleManifest ¶
type RuleManifest struct {
Version int `json:"version"`
Default *Rule `json:"default"`
Rules []*Rule `json:"rules"`
}
RuleManifest represents a full sampling ruleset, with a list of custom rules and default values for incoming requests that do not match any of the provided rules.
func ManifestFromFilePath ¶
func ManifestFromFilePath(fp string) (*RuleManifest, error)
ManifestFromFilePath creates a sampling ruleset from a given filepath fp.
func ManifestFromJSONBytes ¶
func ManifestFromJSONBytes(b []byte) (*RuleManifest, error)
ManifestFromJSONBytes creates a sampling ruleset from given JSON bytes b.
type SamplingRule ¶
type SamplingRule struct {
// Matches attributes derived from the request.
Attributes map[string]*string `json:"Attributes"`
// The percentage of matching requests to instrument, after the reservoir is
// exhausted.
//
// FixedRate is a required field
FixedRate *float64 `json:"FixedRate" required:"true"`
// Matches the HTTP method of a request.
//
// HTTPMethod is a required field
HTTPMethod *string `json:"HTTPMethod" required:"true"`
// Matches the hostname from a request URL.
//
// Host is a required field
Host *string `json:"Host" required:"true"`
// The priority of the sampling rule.
//
// Priority is a required field
Priority *int64 `min:"1" json:"Priority" required:"true"`
// A fixed number of matching requests to instrument per second, prior to applying
// the fixed rate. The reservoir is not used directly by services, but applies
// to all services using the rule collectively.
//
// ReservoirSize is a required field
ReservoirSize *int64 `json:"ReservoirSize" required:"true"`
// Matches the ARN of the Amazon Web Services resource on which the service
// runs.
//
// ResourceARN is a required field
ResourceARN *string `json:"ResourceARN" required:"true"`
// The ARN of the sampling rule. Specify a rule by either name or ARN, but not
// both.
RuleARN *string `json:"RuleARN"`
// The name of the sampling rule. Specify a rule by either name or ARN, but
// not both.
RuleName *string `min:"1" json:"RuleName"`
// Matches the name that the service uses to identify itself in segments.
//
// ServiceName is a required field
ServiceName *string `json:"ServiceName" required:"true"`
// Matches the origin that the service uses to identify its type in segments.
//
// ServiceType is a required field
ServiceType *string `json:"ServiceType" required:"true"`
// Matches the path from a request URL.
//
// URLPath is a required field
URLPath *string `json:"URLPath" required:"true"`
// The version of the sampling rule format (1).
//
// Version is a required field
Version *int64 `min:"1" json:"Version" required:"true"`
}
A sampling rule that services use to decide whether to instrument a request. Rule fields can match properties of the service, or properties of a request. The service can ignore rules that don't match its properties.
type SamplingRuleRecord ¶
type SamplingRuleRecord struct {
// When the rule was created.
CreatedAt *float64 `json:"CreatedAt"`
// When the rule was last modified.
ModifiedAt *float64 `json:"ModifiedAt"`
// The sampling rule.
SamplingRule *SamplingRule `json:"SamplingRule"`
}
A SamplingRule (https://docs.aws.amazon.com/xray/latest/api/API_SamplingRule.html) and its metadata.
type SamplingStatisticsDocument ¶
type SamplingStatisticsDocument struct {
// The number of requests recorded with borrowed reservoir quota.
BorrowCount *int64 `type:"integer"`
// A unique identifier for the service in hexadecimal.
//
// ClientID is a required field
ClientID *string `min:"24" type:"string" required:"true"`
// The number of requests that matched the rule.
//
// RequestCount is a required field
RequestCount *int64 `type:"integer" required:"true"`
// The name of the sampling rule.
//
// RuleName is a required field
RuleName *string `min:"1" type:"string" required:"true"`
// The number of requests recorded.
//
// SampledCount is a required field
SampledCount *int64 `type:"integer" required:"true"`
// The current time.
//
// Timestamp is a required field
Timestamp *int64 `type:"integer" required:"true"`
}
type SamplingTargetDocument ¶
type SamplingTargetDocument struct {
// The percentage of matching requests to instrument, after the reservoir is
// exhausted.
FixedRate *float64 `json:"FixedRate"`
// The number of seconds for the service to wait before getting sampling targets
// again.
Interval *int64 `json:"Interval"`
// The number of requests per second that X-Ray allocated for this service.
ReservoirQuota *int64 `json:"ReservoirQuota"`
// When the reservoir quota expires.
ReservoirQuotaTTL *float64 `json:"ReservoirQuotaTTL"`
// The name of the sampling rule.
RuleName *string `json:"RuleName"`
}
Temporary changes to a sampling rule configuration. To meet the global sampling target for a rule, X-Ray calculates a new reservoir for each service based on the recent sampling results of all services that called GetSamplingTargets (https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingTargets.html).
type UnprocessedStatistics ¶
type UnprocessedStatistics struct {
// The error code.
ErrorCode *string `json:"ErrorCode"`
// The error message.
Message *string `json:"Message"`
// The name of the sampling rule.
RuleName *string `json:"RuleName"`
}
Sampling statistics from a call to GetSamplingTargets (https://docs.aws.amazon.com/xray/latest/api/API_GetSamplingTargets.html) that X-Ray could not process.