-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[WIP] Add Adaptive Sampling Support for gRPC Remote Storage #6308
base: main
Are you sure you want to change the base?
Changes from 6 commits
01068ec
0d66a50
50b8079
c753064
596b5bb
6d5c718
2e23786
15bd0e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,7 @@ func TestNewServer_CreateStorageErrors(t *testing.T) { | |
factory, | ||
tenancy.NewManager(&tenancy.Options{}), | ||
telemetry.NoopSettings(), | ||
nil, | ||
) | ||
} | ||
_, err := f() | ||
|
@@ -118,13 +119,14 @@ func TestNewServer_TLSConfigError(t *testing.T) { | |
storageMocks.factory, | ||
tenancy.NewManager(&tenancy.Options{}), | ||
telset, | ||
nil, | ||
) | ||
assert.ErrorContains(t, err, "invalid TLS config") | ||
} | ||
|
||
func TestCreateGRPCHandler(t *testing.T) { | ||
storageMocks := newStorageMocks() | ||
h, err := createGRPCHandler(storageMocks.factory, zap.NewNop()) | ||
h, err := createGRPCHandler(storageMocks.factory, nil, zap.NewNop()) | ||
require.NoError(t, err) | ||
|
||
storageMocks.writer.On("WriteSpan", mock.Anything, mock.Anything).Return(errors.New("writer error")) | ||
|
@@ -325,6 +327,7 @@ func TestServerGRPCTLS(t *testing.T) { | |
storageMocks.factory, | ||
tm, | ||
telset, | ||
nil, | ||
) | ||
require.NoError(t, err) | ||
require.NoError(t, server.Start()) | ||
|
@@ -374,6 +377,7 @@ func TestServerHandlesPortZero(t *testing.T) { | |
storageMocks.factory, | ||
tenancy.NewManager(&tenancy.Options{}), | ||
telset, | ||
nil, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please add a test where something real is passed |
||
) | ||
require.NoError(t, err) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ func main() { | |
tm := tenancy.NewManager(&opts.Tenancy) | ||
telset := baseTelset // copy | ||
telset.Metrics = metricsFactory | ||
server, err := app.NewServer(opts, storageFactory, tm, telset) | ||
server, err := app.NewServer(opts, storageFactory, tm, telset, nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how will it work if you pass nil? |
||
if err != nil { | ||
logger.Fatal("Failed to create server", zap.Error(err)) | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,63 @@ message FindTraceIDsResponse { | |
]; | ||
} | ||
|
||
message Throughput { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Schema should be documented. Wherever you are copying this from, we have comments explaining all types. |
||
string Service = 1; | ||
string Operation = 2; | ||
int64 Count = 3; | ||
repeated double Probabilities = 4; | ||
} | ||
|
||
message InsertThroughputRequest { | ||
repeated Throughput throughput = 1; | ||
} | ||
|
||
message InsertThroughputResponse { | ||
} | ||
|
||
message StringFloatMap { | ||
map<string, double> stringFloatMap = 1; | ||
} | ||
|
||
message ServiceOperationProbabilities { | ||
map<string, StringFloatMap> serviceOperationProbabilities = 1; | ||
} | ||
|
||
message ServiceOperationQPS { | ||
map<string, StringFloatMap> serviceOperationQPS = 1; | ||
} | ||
|
||
message InsertProbabilitiesAndQPSRequest { | ||
string hostname = 1; | ||
ServiceOperationProbabilities probabilities = 2; | ||
ServiceOperationQPS qps = 3; | ||
} | ||
|
||
message InsertProbabilitiesAndQPSResponse { | ||
} | ||
|
||
message GetThroughputRequest { | ||
google.protobuf.Timestamp start_time = 1[ | ||
(gogoproto.stdtime) = true, | ||
(gogoproto.nullable) = false | ||
]; | ||
google.protobuf.Timestamp end_time = 2 [ | ||
(gogoproto.stdtime) = true, | ||
(gogoproto.nullable) = false | ||
]; | ||
} | ||
|
||
message GetThroughputResponse { | ||
repeated Throughput throughput = 1; | ||
} | ||
|
||
message GetLatestProbabilitiesRequest { | ||
} | ||
|
||
message GetLatestProbabilitiesResponse { | ||
ServiceOperationProbabilities serviceOperationProbabilities = 1; | ||
} | ||
|
||
service SpanWriterPlugin { | ||
// spanstore/Writer | ||
rpc WriteSpan(WriteSpanRequest) returns (WriteSpanResponse); | ||
|
@@ -182,6 +239,16 @@ service DependenciesReaderPlugin { | |
rpc GetDependencies(GetDependenciesRequest) returns (GetDependenciesResponse); | ||
} | ||
|
||
service SamplingStorePlugin{ | ||
rpc InsertThroughput(InsertThroughputRequest) returns (InsertThroughputResponse); | ||
|
||
rpc InsertProbabilitiesAndQPS(InsertProbabilitiesAndQPSRequest) returns (InsertProbabilitiesAndQPSResponse); | ||
|
||
rpc GetThroughput(GetThroughputRequest) returns (GetThroughputResponse); | ||
|
||
rpc GetLatestProbabilities(GetLatestProbabilitiesRequest) returns (GetLatestProbabilitiesResponse); | ||
} | ||
|
||
// empty; extensible in the future | ||
message CapabilitiesRequest { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,6 +112,7 @@ func TestNewGRPCClient(t *testing.T) { | |
assert.Implements(t, (*storage_v1.PluginCapabilitiesClient)(nil), client.capabilitiesClient) | ||
assert.Implements(t, (*storage_v1.DependenciesReaderPluginClient)(nil), client.depsReaderClient) | ||
assert.Implements(t, (*storage_v1.StreamingSpanWriterPluginClient)(nil), client.streamWriterClient) | ||
assert.Implements(t, (*storage_v1.SamplingStorePluginClient)(nil), client.samplingStoreClient) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no unit tests for new functions? |
||
} | ||
|
||
func TestGRPCClientGetServices(t *testing.T) { | ||
|
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.
for readability, define named constant instead of passing unnamed
1