Skip to content

Commit

Permalink
Added metric name to GetObservationLogRequest (#559)
Browse files Browse the repository at this point in the history
* Adding metric name to GetObservationLogRequest

* regenerate mockdb
  • Loading branch information
johnugeorge authored and k8s-ci-robot committed May 20, 2019
1 parent 0a98288 commit 4c378bc
Show file tree
Hide file tree
Showing 12 changed files with 613 additions and 371 deletions.
2 changes: 1 addition & 1 deletion cmd/manager/v1alpha2/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func (s *server) ReportObservationLog(ctx context.Context, in *api_pb.ReportObse

// Get all log of Observations for a Trial.
func (s *server) GetObservationLog(ctx context.Context, in *api_pb.GetObservationLogRequest) (*api_pb.GetObservationLogReply, error) {
ol, err := dbIf.GetObservationLog(in.TrialName, in.StartTime, in.EndTime)
ol, err := dbIf.GetObservationLog(in.TrialName, in.MetricName, in.StartTime, in.EndTime)
return &api_pb.GetObservationLogReply{
ObservationLog: ol,
}, err
Expand Down
2 changes: 1 addition & 1 deletion cmd/manager/v1alpha2/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ func TestGetObservationLog(t *testing.T) {
},
}

mockDB.EXPECT().GetObservationLog(req.TrialName, req.StartTime, req.EndTime).Return(obs, nil)
mockDB.EXPECT().GetObservationLog(req.TrialName, req.MetricName, req.StartTime, req.EndTime).Return(obs, nil)
ret, err := s.GetObservationLog(context.Background(), req)
if err != nil {
t.Fatalf("GetObservationLog Error %v", err)
Expand Down
322 changes: 165 additions & 157 deletions pkg/api/v1alpha2/api.pb.go

Large diffs are not rendered by default.

28 changes: 3 additions & 25 deletions pkg/api/v1alpha2/api.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions pkg/api/v1alpha2/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ service Manager {
*/
rpc GetObservationLog(GetObservationLogRequest) returns (GetObservationLogReply){
option (google.api.http) = {
get: "/api/Manager/GetObservationLog/{trial_name}"
post: "/api/Manager/GetObservationLog"
body: "*"
};
};

Expand Down Expand Up @@ -491,8 +492,9 @@ message ReportObservationLogReply {

message GetObservationLogRequest {
string trial_name = 1;
string start_time = 2; ///The start of the time range. RFC3339 format
string end_time = 3; ///The end of the time range. RFC3339 format
string metric_name = 2;
string start_time = 3; ///The start of the time range. RFC3339 format
string end_time = 4; ///The end of the time range. RFC3339 format
}

message GetObservationLogReply {
Expand Down
41 changes: 24 additions & 17 deletions pkg/api/v1alpha2/api.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
]
}
},
"/api/Manager/GetObservationLog/{trial_name}": {
"get": {
"/api/Manager/GetObservationLog": {
"post": {
"summary": "*\nGet all log of Observations for a Trial.",
"operationId": "GetObservationLog",
"responses": {
Expand All @@ -146,22 +146,12 @@
},
"parameters": [
{
"name": "trial_name",
"in": "path",
"name": "body",
"in": "body",
"required": true,
"type": "string"
},
{
"name": "start_time",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "end_time",
"in": "query",
"required": false,
"type": "string"
"schema": {
"$ref": "#/definitions/alpha2GetObservationLogRequest"
}
}
],
"tags": [
Expand Down Expand Up @@ -681,6 +671,23 @@
}
}
},
"alpha2GetObservationLogRequest": {
"type": "object",
"properties": {
"trial_name": {
"type": "string"
},
"metric_name": {
"type": "string"
},
"start_time": {
"type": "string"
},
"end_time": {
"type": "string"
}
}
},
"alpha2GetSuggestionsReply": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit 4c378bc

Please sign in to comment.