Skip to content

Commit

Permalink
PMM-4192 MongoDB EXPLAIN JSON APIs. (#420)
Browse files Browse the repository at this point in the history
* PMM-4192 WIP - Initial proto changes

* PMM-4192 Updated proto def for mongo explain

* PBM-4192 Updated MongoDBExplainParams definition

* PMM-4192 Removed database from mongodbexplain

* PMM-4192 Regenerate.

* PMM-4192 Fixed comments

Fixed comments referencing PostgreSQL instead of MongoDB

* PMM-4192 Merged current 2.0 branch

* Revert "PMM-4192 Merged current 2.0 branch"

This reverts commit b7d0361.

* PMM-4192 after make gen

* PMM-4192 Updated MongoExplain path

* PMM-4192 Removed Database from MDB explain

In MongoDB Explain action, the database to run the command should be
"admin" and the query database is taken from the JSON query in the Ns
field (namespace).
Keeping this parameter here and using it makes explain to fail in
pmm-agent.

Co-authored-by: Alexey Palazhchenko <[email protected]>
Co-authored-by: Nurlan Moldomurov <[email protected]>
  • Loading branch information
3 people authored Mar 30, 2020
1 parent 373639d commit 41f9637
Show file tree
Hide file tree
Showing 12 changed files with 1,158 additions and 171 deletions.
276 changes: 172 additions & 104 deletions api/agentpb/agent.pb.go

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions api/agentpb/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@ message StartActionRequest {
string dsn = 1;
string table = 2;
}
// MongoDBExplainParams describes MongoDB EXPLAIN action parameters.
message MongoDBExplainParams {
string dsn = 1;
string query = 2;
}
string action_id = 1;
oneof params {
MySQLExplainParams mysql_explain_params = 2;
Expand All @@ -120,6 +125,7 @@ message StartActionRequest {
MySQLShowIndexParams mysql_show_index_params = 5;
PostgreSQLShowCreateTableParams postgresql_show_create_table_params = 6;
PostgreSQLShowIndexParams postgresql_show_index_params = 7;
MongoDBExplainParams mongodb_explain_params = 8;
}
}

Expand Down
10 changes: 10 additions & 0 deletions api/agentpb/agent.validator.pb.go

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

287 changes: 220 additions & 67 deletions api/managementpb/actions.pb.go

Large diffs are not rendered by default.

78 changes: 78 additions & 0 deletions api/managementpb/actions.pb.gw.go

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

32 changes: 32 additions & 0 deletions api/managementpb/actions.proto
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum ActionType {
MYSQL_SHOW_INDEX = 4;
POSTGRESQL_SHOW_CREATE_TABLE = 5;
POSTGRESQL_SHOW_INDEX = 6;
MONGODB_EXPLAIN = 7;
}

message GetActionRequest {
Expand Down Expand Up @@ -249,6 +250,30 @@ message StartPostgreSQLShowIndexActionResponse {
string pmm_agent_id = 2;
}

message StartMongoDBExplainActionRequest {
// pmm-agent ID where to run this Action.
string pmm_agent_id = 1;
// Service ID for this Action. Required.
string service_id = 2 [
(validator.field) = {
string_not_empty: true
}
];
// Query. Required.
string query = 3 [
(validator.field) = {
string_not_empty: true
}
];
}

message StartMongoDBExplainActionResponse {
// Unique Action ID.
string action_id = 1;
// pmm-agent ID where to this Action was started.
string pmm_agent_id = 2;
}

message CancelActionRequest {
// Unique Action ID. Required.
string action_id = 1 [
Expand Down Expand Up @@ -325,6 +350,13 @@ service Actions {
body: "*"
};
}
// StartMongoDBExplainAction starts MongoDB EXPLAIN Action.
rpc StartMongoDBExplainAction(StartMongoDBExplainActionRequest) returns (StartMongoDBExplainActionResponse) {
option (google.api.http) = {
post: "/v1/management/Actions/StartMongoDBExplain"
body: "*"
};
}
// CancelAction stops an Action.
rpc CancelAction(CancelActionRequest) returns (CancelActionResponse) {
option (google.api.http) = {
Expand Down
12 changes: 12 additions & 0 deletions api/managementpb/actions.validator.pb.go

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

33 changes: 33 additions & 0 deletions api/managementpb/json/client/actions/actions_client.go

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

Loading

0 comments on commit 41f9637

Please sign in to comment.