-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
YAAAAS - Yet Another Attempt At Adaptive Sampling #2966
YAAAAS - Yet Another Attempt At Adaptive Sampling #2966
Conversation
Signed-off-by: Joe Elliott <[email protected]> Co-authored-by: Ashmita Bohara [email protected]
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
1666468
to
8113686
Compare
Signed-off-by: Joe Elliott <[email protected]>
Do you want an initial review, or should I wait for the remaining items to be done? |
Let me move this a little farther forward before a first review. I have everything wired up but I'd like to see it work at least a little before we start reviews. |
I'll mark this as a draft then. |
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #2966 +/- ##
==========================================
- Coverage 95.90% 95.81% -0.09%
==========================================
Files 242 243 +1
Lines 14831 14922 +91
==========================================
+ Hits 14223 14297 +74
- Misses 527 539 +12
- Partials 81 86 +5
Continue to review full report at Codecov.
|
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Sorry, I asked a very simple question. In the process of reading the source code, I found that the Store.InsertThroughput method was not called anywhere // Store writes and retrieves sampling data to and from storage. |
Thank you for pointing that out. The last time I spent time on this I was trying to track down the mechanism to add throughput. :) The other elements were working: distributed lock and probabilities calculation, but this was not. |
I realized there are a few files missing from what was available internally at Uber. I will work with @vprithvi to get them committed (they were all cleaned up for oss, but for some reason not moved). |
The missing files have been added in #3065 |
Signed-off-by: Joe Elliott <[email protected]>
Let's go! I'll work on clawing back that last few percentage of code coverage today. |
Signed-off-by: Joe Elliott <[email protected]>
storage/factory.go
Outdated
@@ -45,6 +47,10 @@ type Factory interface { | |||
|
|||
// CreateDependencyReader creates a dependencystore.Reader. | |||
CreateDependencyReader() (dependencystore.Reader, error) | |||
|
|||
// CreateLockAndSamplingStore creates a distributedlock.Lock and samplingstore.Store. | |||
// These are used for adaptive sampling. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sampling store could be static though, can it not? So not always for adaptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The SamplingStore
is explicitly for adaptive sampling. It is for storing and retrieving the various datapoints necessary to calculate the current sampling rates:
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
) | ||
|
||
// NewStrategyStore creates a strategy store that holds adaptive sampling strategies. | ||
func NewStrategyStore(options Options, metricsFactory metrics.Factory, logger *zap.Logger, lock distributedlock.Lock, store samplingstore.Store) (*Processor, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am now confused by what drives what. NewStrategyStore returns Processor? Is Processor API surface bigger than StrategyStore? If so, should this be renamed to reflect that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Processor
implements the strategystore.StrategyStore
interface which is used by the serving code to respond when a user hits /sampling?service="test"
. This is used for both adaptive and static sampling (and all future sampling served off this endpoint).
type StrategyStore interface {
GetSamplingStrategy(ctx context.Context, serviceName string) (*sampling.SamplingStrategyResponse, error)
}
samplingstore.Store
is an interface that abstracts away a backend (cassandra, elastic, ...) for use by the adaptive sampling code to record data for adaptive sampling.
type Store interface {
InsertThroughput(throughput []*model.Throughput) error
InsertProbabilitiesAndQPS(hostname string, probabilities model.ServiceOperationProbabilities, qps model.ServiceOperationQPS) error
GetThroughput(start, end time.Time) ([]*model.Throughput, error)
GetProbabilitiesAndQPS(start, end time.Time) (map[string][]model.ServiceOperationData, error)
GetLatestProbabilities() (model.ServiceOperationProbabilities, error)
}
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Joe Elliott <[email protected]>
Signed-off-by: Yuri Shkuro <[email protected]>
woohoo! |
Which problem is this PR solving?
Short description of the changes
This PR builds on #2818 and as such @Ashmita152 is named as a coauthor. Currently it only wires config for adaptive sampling to the existing Cassandra storage implementations.
Additional changes