Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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(serviceName string, path string, method string) bool
ShouldTrace consults the LocalizedStrategy's rule set to determine if the given request should be traced or not.
type Reservoir ¶
type Reservoir struct {
// contains filtered or unexported fields
}
Reservoir allows a specified amount of `Take()`s per second. Support for atomic operations on uint64 is required. More information: https://golang.org/pkg/sync/atomic/#pkg-note-BUG
func NewReservoir ¶
NewReservoir creates a new reservoir with a specified perSecond sampling capacity. The maximum supported sampling capacity per second is currently 100,000,000. An error is returned if the desired capacity is greater than this maximum value.
type Rule ¶
type Rule struct { ServiceName string `json:"service_name"` HTTPMethod string `json:"http_method"` URLPath string `json:"url_path"` FixedTarget uint64 `json:"fixed_target"` Rate float64 `json:"rate"` // contains filtered or unexported fields }
Rule represents a single entry in a sampling ruleset.
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.