github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/server/serverpb/status.proto (about) 1 // Copyright 2016 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 syntax = "proto3"; 12 package cockroach.server.serverpb; 13 option go_package = "serverpb"; 14 15 import "build/info.proto"; 16 import "gossip/gossip.proto"; 17 import "jobs/jobspb/jobs.proto"; 18 import "roachpb/app_stats.proto"; 19 import "roachpb/data.proto"; 20 import "roachpb/metadata.proto"; 21 import "server/diagnosticspb/diagnostics.proto"; 22 import "server/status/statuspb/status.proto"; 23 import "storage/enginepb/engine.proto"; 24 import "storage/enginepb/mvcc.proto"; 25 import "storage/enginepb/rocksdb.proto"; 26 import "kv/kvserver/kvserverpb/lease_status.proto"; 27 import "kv/kvserver/kvserverpb/state.proto"; 28 import "kv/kvserver/kvserverpb/liveness.proto"; 29 import "util/log/log.proto"; 30 import "util/unresolved_addr.proto"; 31 32 import "etcd/raft/raftpb/raft.proto"; 33 34 import "gogoproto/gogo.proto"; 35 import "google/api/annotations.proto"; 36 import "google/protobuf/timestamp.proto"; 37 38 message CertificatesRequest { 39 // node_id is a string so that "local" can be used to specify that no 40 // forwarding is necessary. 41 string node_id = 1; 42 } 43 44 message CertificateDetails { 45 // We use an enum to allow reporting of client certs and potential others (eg: 46 // UI). 47 enum CertificateType { 48 CA = 0; 49 NODE = 1; 50 CLIENT_CA = 2; 51 CLIENT = 3; 52 UI_CA = 4; 53 UI = 5; 54 } 55 56 message Fields { 57 string issuer = 1; 58 string subject = 2; 59 int64 valid_from = 3; 60 int64 valid_until = 4; 61 repeated string addresses = 5; 62 string signature_algorithm = 6; 63 string public_key = 7; 64 repeated string key_usage = 8; 65 repeated string extended_key_usage = 9; 66 } 67 68 CertificateType type = 1; 69 // "error_message" and "data" are mutually exclusive. 70 string error_message = 2; 71 // data is the raw file contents of the certificate. This means PEM-encoded 72 // DER data. 73 bytes data = 3; 74 repeated Fields fields = 4 [ (gogoproto.nullable) = false ]; 75 } 76 77 message CertificatesResponse { 78 repeated CertificateDetails certificates = 1 [ (gogoproto.nullable) = false ]; 79 } 80 81 // DetailsRequest requests a nodes details. 82 // Note: this does *not* check readiness. Use the Health RPC for that purpose. 83 message DetailsRequest { 84 // node_id is a string so that "local" can be used to specify that no 85 // forwarding is necessary. 86 string node_id = 1; 87 reserved 2; 88 } 89 90 // SystemInfo contains information about the host system. 91 message SystemInfo { 92 // system_info is the output from `uname -a` 93 string system_info = 1; 94 95 // kernel_info is the output from `uname -r`. 96 string kernel_info = 2; 97 } 98 99 message DetailsResponse { 100 int32 node_id = 1 [ 101 (gogoproto.customname) = "NodeID", 102 (gogoproto.casttype) = 103 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 104 ]; 105 util.UnresolvedAddr address = 2 [ (gogoproto.nullable) = false ]; 106 build.Info build_info = 3 [ (gogoproto.nullable) = false ]; 107 SystemInfo system_info = 4 [ (gogoproto.nullable) = false ]; 108 util.UnresolvedAddr sql_address = 5 [ (gogoproto.nullable) = false, (gogoproto.customname) = "SQLAddress" ]; 109 } 110 111 message NodesRequest {} 112 113 message NodesResponse { 114 repeated server.status.statuspb.NodeStatus nodes = 1 [ (gogoproto.nullable) = false ]; 115 map<int32, cockroach.kv.kvserver.storagepb.NodeLivenessStatus> liveness_by_node_id = 2 [ 116 (gogoproto.castkey) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID", 117 (gogoproto.nullable) = false, 118 (gogoproto.customname) = "LivenessByNodeID" 119 ]; 120 } 121 122 message NodeRequest { 123 // node_id is a string so that "local" can be used to specify that no 124 // forwarding is necessary. 125 string node_id = 1; 126 } 127 128 // RaftState gives internal details about a Raft group's state. 129 // Closely mirrors the upstream definitions in github.com/etcd-io/etcd/raft. 130 message RaftState { 131 message Progress { 132 uint64 match = 1; 133 uint64 next = 2; 134 string state = 3; 135 bool paused = 4; 136 uint64 pending_snapshot = 5; 137 } 138 139 uint64 replica_id = 1 [ (gogoproto.customname) = "ReplicaID" ]; 140 raftpb.HardState hard_state = 2 [ (gogoproto.nullable) = false ]; 141 // Lead is part of Raft's SoftState. 142 uint64 lead = 3; 143 // State is part of Raft's SoftState. 144 // It's not an enum because this is primarily for ui consumption and there 145 // are issues associated with them. 146 string state = 4; 147 uint64 applied = 5; 148 map<uint64, Progress> progress = 6 [ (gogoproto.nullable) = false ]; 149 uint64 lead_transferee = 7; 150 } 151 152 message RangeProblems { 153 bool unavailable = 1; 154 bool leader_not_lease_holder = 2; 155 bool no_raft_leader = 3; 156 bool underreplicated = 4; 157 bool overreplicated = 8; 158 bool no_lease = 5; 159 160 // Quiescent ranges do not tick by definition, but we track this in 161 // two different ways and suspect that they're getting out of sync. 162 // If the replica's quiescent flag doesn't agree with the store's 163 // list of replicas that are ticking, warn about it. 164 bool quiescent_equals_ticking = 6; 165 166 // When the raft log is too large, it can be a symptom of other issues. 167 bool raft_log_too_large = 7; 168 } 169 170 message RangeStatistics { 171 // Note that queries per second will only be known by the leaseholder. 172 // All other replicas will report it as 0. 173 double queries_per_second = 1; 174 double writes_per_second = 2; 175 } 176 177 message PrettySpan { 178 option (gogoproto.equal) = true; 179 180 string start_key = 1; 181 string end_key = 2; 182 } 183 184 message RangeInfo { 185 PrettySpan span = 1 [ (gogoproto.nullable) = false ]; 186 RaftState raft_state = 2 [ (gogoproto.nullable) = false ]; 187 kv.kvserver.storagepb.RangeInfo state = 4 [ (gogoproto.nullable) = false ]; 188 int32 source_node_id = 5 [ 189 (gogoproto.customname) = "SourceNodeID", 190 (gogoproto.casttype) = 191 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 192 ]; 193 int32 source_store_id = 6 [ 194 (gogoproto.customname) = "SourceStoreID", 195 (gogoproto.casttype) = 196 "github.com/cockroachdb/cockroach/pkg/roachpb.StoreID" 197 ]; 198 string error_message = 7; 199 repeated roachpb.Lease lease_history = 8 [ (gogoproto.nullable) = false ]; 200 RangeProblems problems = 9 [ (gogoproto.nullable) = false ]; 201 RangeStatistics stats = 10 [ (gogoproto.nullable) = false ]; 202 kv.kvserver.storagepb.LatchManagerInfo latches_local = 11 [ (gogoproto.nullable) = false ]; 203 kv.kvserver.storagepb.LatchManagerInfo latches_global = 12 [ (gogoproto.nullable) = false ]; 204 kv.kvserver.storagepb.LeaseStatus lease_status = 13 [ (gogoproto.nullable) = false ]; 205 bool quiescent = 14; 206 bool ticking = 15; 207 } 208 209 message RangesRequest { 210 // node_id is a string so that "local" can be used to specify that no 211 // forwarding is necessary. 212 string node_id = 1; 213 repeated int64 range_ids = 2 [ 214 (gogoproto.customname) = "RangeIDs", 215 (gogoproto.casttype) = 216 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 217 ]; 218 } 219 220 message RangesResponse { 221 repeated RangeInfo ranges = 1 [ (gogoproto.nullable) = false ]; 222 } 223 224 message GossipRequest { 225 // node_id is a string so that "local" can be used to specify that no 226 // forwarding is necessary. 227 string node_id = 1; 228 } 229 230 message EngineStatsInfo { 231 int32 store_id = 1 [ 232 (gogoproto.customname) = "StoreID", 233 (gogoproto.casttype) = 234 "github.com/cockroachdb/cockroach/pkg/roachpb.StoreID" 235 ]; 236 cockroach.storage.enginepb.TickersAndHistograms tickers_and_histograms = 2; 237 cockroach.storage.enginepb.EngineType engine_type = 3; 238 } 239 240 message EngineStatsRequest { 241 // node_id is a string so that "local" can be used to specify that no 242 // forwarding is necessary. 243 string node_id = 1; 244 } 245 246 message EngineStatsResponse { 247 repeated EngineStatsInfo stats = 1 [ (gogoproto.nullable) = false ]; 248 } 249 250 message TraceEvent { 251 google.protobuf.Timestamp time = 1 252 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; 253 string message = 2; 254 } 255 256 message AllocatorDryRun { 257 int64 range_id = 1 [ 258 (gogoproto.customname) = "RangeID", 259 (gogoproto.casttype) = 260 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 261 ]; 262 repeated TraceEvent events = 2; 263 } 264 265 message AllocatorRangeRequest { 266 int64 range_id = 1; 267 } 268 269 message AllocatorRangeResponse { 270 // The NodeID of the store whose dry run is returned. Only the leaseholder 271 // for a given range will do an allocator dry run for it. 272 int64 node_id = 1 [ 273 (gogoproto.customname) = "NodeID", 274 (gogoproto.casttype) = 275 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 276 ]; 277 AllocatorDryRun dry_run = 2; 278 } 279 280 message AllocatorRequest { 281 string node_id = 1; 282 repeated int64 range_ids = 2 [ 283 (gogoproto.customname) = "RangeIDs", 284 (gogoproto.casttype) = 285 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 286 ]; 287 } 288 289 message AllocatorResponse { repeated AllocatorDryRun dry_runs = 1; } 290 291 message JSONResponse { bytes data = 1; } 292 293 message LogsRequest { 294 // node_id is a string so that "local" can be used to specify that no 295 // forwarding is necessary. 296 string node_id = 1; 297 string level = 2; 298 string start_time = 3; 299 string end_time = 4; 300 string max = 5; 301 string pattern = 6; 302 } 303 304 message LogEntriesResponse { 305 repeated cockroach.util.log.Entry entries = 1 306 [ (gogoproto.nullable) = false ]; 307 } 308 309 message LogFilesListRequest { 310 // node_id is a string so that "local" can be used to specify that no 311 // forwarding is necessary. 312 string node_id = 1; 313 } 314 315 message LogFilesListResponse { 316 repeated cockroach.util.log.FileInfo files = 1 317 [ (gogoproto.nullable) = false ]; 318 } 319 320 message LogFileRequest { 321 // node_id is a string so that "local" can be used to specify that no 322 // forwarding is necessary. 323 string node_id = 1; 324 string file = 2; 325 } 326 327 enum StacksType { 328 GOROUTINE_STACKS = 0; 329 THREAD_STACKS = 1; 330 } 331 332 message StacksRequest { 333 // node_id is a string so that "local" can be used to specify that no 334 // forwarding is necessary. 335 string node_id = 1; 336 StacksType type = 2; 337 } 338 339 // Represents the type of file. 340 // TODO(ridwanmsharif): Add support for log files. They're currently served 341 // by an endpoint that parses the log messages, which is not what the 342 // debug zip client wants. 343 enum FileType { 344 HEAP = 0; 345 GOROUTINES = 1; 346 } 347 348 message File { 349 string name = 1; 350 int64 file_size = 2; 351 // Contents may not be populated if only a list of Files are requested. 352 bytes contents = 3; 353 } 354 355 message GetFilesRequest { 356 // node_id is a string so that "local" can be used to specify that no 357 // forwarding is necessary. 358 string node_id = 1; 359 // If list_only is true then the contents of the files will not be populated 360 // in the response. Only filenames and sizes will be returned. 361 bool list_only = 2; 362 FileType type = 5; 363 // Each pattern given is matched with Files of the above type in the node 364 // using filepath.Glob(). The patterns only match to filenames and so path 365 // separators cannot be used. 366 // Example: * will match all files of requested type. 367 repeated string patterns = 6; 368 } 369 370 message GetFilesResponse { 371 repeated File files = 1; 372 } 373 374 message ProfileRequest { 375 // node_id is a string so that "local" can be used to specify that no 376 // forwarding is necessary. 377 string node_id = 1; 378 379 enum Type { HEAP = 0; } 380 // The type of profile to retrieve. 381 Type type = 5; 382 } 383 384 message MetricsRequest { 385 // node_id is a string so that "local" can be used to specify that no 386 // forwarding is necessary. 387 string node_id = 1; 388 } 389 390 message RaftRangeNode { 391 int32 node_id = 1 [ 392 (gogoproto.customname) = "NodeID", 393 (gogoproto.casttype) = 394 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 395 ]; 396 RangeInfo range = 2 [ (gogoproto.nullable) = false ]; 397 } 398 399 message RaftRangeError { string message = 1; } 400 401 message RaftRangeStatus { 402 int64 range_id = 1 [ 403 (gogoproto.customname) = "RangeID", 404 (gogoproto.casttype) = 405 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 406 ]; 407 repeated RaftRangeError errors = 2 [ (gogoproto.nullable) = false ]; 408 repeated RaftRangeNode nodes = 3 [ (gogoproto.nullable) = false ]; 409 } 410 411 message RaftDebugRequest { 412 repeated int64 range_ids = 1 [ 413 (gogoproto.customname) = "RangeIDs", 414 (gogoproto.casttype) = 415 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 416 ]; 417 } 418 419 message RaftDebugResponse { 420 map<int64, RaftRangeStatus> ranges = 1 [ 421 (gogoproto.nullable) = false, 422 (gogoproto.castkey) = 423 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 424 ]; 425 repeated RaftRangeError errors = 2 [ (gogoproto.nullable) = false ]; 426 } 427 428 // TxnInfo represents an in flight user transaction on some Session. 429 message TxnInfo { 430 bytes id = 1 [ 431 (gogoproto.customname) = "ID", 432 (gogoproto.nullable) = false, 433 (gogoproto.customtype) = 434 "github.com/cockroachdb/cockroach/pkg/util/uuid.UUID" 435 ]; 436 // The start timestamp of the transaction. 437 google.protobuf.Timestamp start = 2 438 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; 439 440 // txn_description is a text description of the underlying kv.Txn, intended 441 // for troubleshooting purposes. 442 string txn_description = 3; 443 } 444 445 // ActiveQuery represents a query in flight on some Session. 446 message ActiveQuery { 447 // ID of the query (uint128 presented as a hexadecimal string). 448 string id = 1 [ (gogoproto.customname) = "ID" ]; 449 // The UUID of the transaction this query is running in. 450 bytes txn_id = 7 [ 451 (gogoproto.customname) = "TxnID", 452 (gogoproto.nullable) = false, 453 (gogoproto.customtype) = 454 "github.com/cockroachdb/cockroach/pkg/util/uuid.UUID" 455 ]; 456 // SQL query string specified by the user. 457 string sql = 2; 458 // Start timestamp of this query. 459 google.protobuf.Timestamp start = 3 460 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; 461 // True if this query is distributed. 462 bool is_distributed = 4; 463 464 // Enum for phase of execution. 465 enum Phase { 466 PREPARING = 0; 467 EXECUTING = 1; 468 } 469 // phase stores the current phase of execution for this query. 470 Phase phase = 5; 471 472 float progress = 6; 473 } 474 475 // Request object for ListSessions and ListLocalSessions. 476 message ListSessionsRequest { 477 // Username of the user making this request. 478 string username = 1; 479 } 480 481 // Session represents one SQL session. 482 message Session { 483 // ID of node where this session exists. 484 int32 node_id = 1 [ 485 (gogoproto.customname) = "NodeID", 486 (gogoproto.casttype) = 487 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 488 ]; 489 // Username of the user for this session. 490 string username = 2; 491 // Connected client's IP address and port. 492 string client_address = 3; 493 // Application name specified by the client. 494 string application_name = 4; 495 // Queries in progress on this session. 496 repeated ActiveQuery active_queries = 5 [ (gogoproto.nullable) = false ]; 497 // Timestamp of session's start. 498 google.protobuf.Timestamp start = 6 499 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; 500 // ID of the current KV transaction for this session. Nil if the session 501 // doesn't currently have a transaction. 502 bytes kv_txn_id = 7 [ 503 (gogoproto.customname) = "KvTxnID", 504 (gogoproto.customtype) = 505 "github.com/cockroachdb/cockroach/pkg/util/uuid.UUID" 506 ]; 507 // Information about the txn in progress on this session. Nil if the 508 // session doesn't currently have a transaction. 509 TxnInfo active_txn = 12; 510 // SQL string of the last query executed on this session. 511 string last_active_query = 8; 512 // ID of the session (uint128 represented as raw bytes). 513 bytes id = 9 [ (gogoproto.customname) = "ID" ]; 514 // Number of currently allocated bytes in the session memory monitor. 515 int64 alloc_bytes = 10; 516 // High water mark of allocated bytes in the session memory monitor. 517 int64 max_alloc_bytes = 11; 518 } 519 520 // An error wrapper object for ListSessionsResponse. 521 message ListSessionsError { 522 // ID of node that was being contacted when this error occurred 523 int32 node_id = 1 [ 524 (gogoproto.customname) = "NodeID", 525 (gogoproto.casttype) = 526 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 527 ]; 528 // Error message. 529 string message = 2; 530 } 531 532 // Response object for ListSessions and ListLocalSessions. 533 message ListSessionsResponse { 534 // A list of sessions on this node or cluster. 535 repeated Session sessions = 1 [ (gogoproto.nullable) = false ]; 536 // Any errors that occurred during fan-out calls to other nodes. 537 repeated ListSessionsError errors = 2 [ (gogoproto.nullable) = false ]; 538 } 539 540 // Request object for issing a query cancel request. 541 message CancelQueryRequest { 542 // ID of gateway node for the query to be canceled. 543 // 544 // TODO(itsbilal): use [(gogoproto.customname) = "NodeID"] below. Need to 545 // figure out how to teach grpc-gateway about custom names. 546 // 547 // node_id is a string so that "local" can be used to specify that no 548 // forwarding is necessary. 549 string node_id = 1; 550 // ID of query to be canceled (converted to string). 551 string query_id = 2 [ (gogoproto.customname) = "QueryID" ]; 552 // Username of the user making this cancellation request. 553 string username = 3; 554 } 555 556 // Response returned by target query's gateway node. 557 message CancelQueryResponse { 558 // Whether the cancellation request succeeded and the query was canceled. 559 bool canceled = 1; 560 // Error message (accompanied with canceled = false). 561 string error = 2; 562 } 563 564 message CancelSessionRequest { 565 // TODO(abhimadan): use [(gogoproto.customname) = "NodeID"] below. Need to 566 // figure out how to teach grpc-gateway about custom names. 567 // 568 // node_id is a string so that "local" can be used to specify that no 569 // forwarding is necessary. 570 string node_id = 1; 571 bytes session_id = 2 [ (gogoproto.customname) = "SessionID" ]; 572 string username = 3; 573 } 574 575 message CancelSessionResponse { 576 bool canceled = 1; 577 string error = 2; 578 } 579 580 message SpanStatsRequest { 581 string node_id = 1 [ (gogoproto.customname) = "NodeID" ]; 582 bytes start_key = 2 583 [ (gogoproto.casttype) = 584 "github.com/cockroachdb/cockroach/pkg/roachpb.RKey" ]; 585 bytes end_key = 3 [ (gogoproto.casttype) = 586 "github.com/cockroachdb/cockroach/pkg/roachpb.RKey" ]; 587 } 588 589 message SpanStatsResponse { 590 int32 range_count = 2; 591 uint64 approximate_disk_bytes = 3; 592 cockroach.storage.enginepb.MVCCStats total_stats = 1 593 [ (gogoproto.nullable) = false ]; 594 } 595 596 message ProblemRangesRequest { 597 // If left empty, problem ranges for all nodes/stores will be returned. 598 string node_id = 1 [ (gogoproto.customname) = "NodeID" ]; 599 } 600 601 message ProblemRangesResponse { 602 message NodeProblems { 603 string error_message = 1; 604 repeated int64 unavailable_range_ids = 2 [ 605 (gogoproto.customname) = "UnavailableRangeIDs", 606 (gogoproto.casttype) = 607 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 608 ]; 609 repeated int64 raft_leader_not_lease_holder_range_ids = 3 [ 610 (gogoproto.customname) = "RaftLeaderNotLeaseHolderRangeIDs", 611 (gogoproto.casttype) = 612 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 613 ]; 614 repeated int64 no_raft_leader_range_ids = 4 [ 615 (gogoproto.customname) = "NoRaftLeaderRangeIDs", 616 (gogoproto.casttype) = 617 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 618 ]; 619 repeated int64 no_lease_range_ids = 5 [ 620 (gogoproto.customname) = "NoLeaseRangeIDs", 621 (gogoproto.casttype) = 622 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 623 ]; 624 repeated int64 underreplicated_range_ids = 6 [ 625 (gogoproto.customname) = "UnderreplicatedRangeIDs", 626 (gogoproto.casttype) = 627 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 628 ]; 629 repeated int64 overreplicated_range_ids = 9 [ 630 (gogoproto.customname) = "OverreplicatedRangeIDs", 631 (gogoproto.casttype) = 632 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 633 ]; 634 repeated int64 quiescent_equals_ticking_range_ids = 7 [ 635 (gogoproto.customname) = "QuiescentEqualsTickingRangeIDs", 636 (gogoproto.casttype) = 637 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 638 ]; 639 repeated int64 raft_log_too_large_range_ids = 8 [ 640 (gogoproto.customname) = "RaftLogTooLargeRangeIDs", 641 (gogoproto.casttype) = 642 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 643 ]; 644 } 645 reserved 1 to 7; 646 // NodeID is the node that submitted all the requests. 647 int32 node_id = 8 [ 648 (gogoproto.customname) = "NodeID", 649 (gogoproto.casttype) = 650 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 651 ]; 652 map<int32, NodeProblems> problems_by_node_id = 9 [ 653 (gogoproto.castkey) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID", 654 (gogoproto.customname) = "ProblemsByNodeID", 655 (gogoproto.nullable) = false 656 ]; 657 } 658 659 message HotRangesRequest { 660 // If left empty, hot ranges for all nodes/stores will be returned. 661 string node_id = 1 [(gogoproto.customname) = "NodeID"]; 662 } 663 664 message HotRangesResponse { 665 message HotRange { 666 cockroach.roachpb.RangeDescriptor desc = 1 [(gogoproto.nullable) = false]; 667 double queries_per_second = 2; 668 } 669 message StoreResponse { 670 int32 store_id = 1 [ 671 (gogoproto.customname) = "StoreID", 672 (gogoproto.casttype) = 673 "github.com/cockroachdb/cockroach/pkg/roachpb.StoreID" 674 ]; 675 repeated HotRange hot_ranges = 2 [(gogoproto.nullable) = false]; 676 } 677 message NodeResponse { 678 string error_message = 1; 679 repeated StoreResponse stores = 2; 680 } 681 // NodeID is the node that submitted all the requests. 682 int32 node_id = 1 [ 683 (gogoproto.customname) = "NodeID", 684 (gogoproto.casttype) = 685 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 686 ]; 687 map<int32, NodeResponse> hot_ranges_by_node_id = 2 [ 688 (gogoproto.castkey) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID", 689 (gogoproto.customname) = "HotRangesByNodeID", 690 (gogoproto.nullable) = false 691 ]; 692 } 693 694 message RangeRequest { 695 int64 range_id = 1; 696 } 697 698 message RangeResponse { 699 message NodeResponse { 700 bool response = 1; 701 string error_message = 2; 702 repeated RangeInfo infos = 3 [ (gogoproto.nullable) = false ]; 703 } 704 // NodeID is the node that submitted all the requests. 705 int32 node_id = 1 [ 706 (gogoproto.customname) = "NodeID", 707 (gogoproto.casttype) = 708 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 709 ]; 710 int64 range_id = 2 [ 711 (gogoproto.customname) = "RangeID", 712 (gogoproto.casttype) = 713 "github.com/cockroachdb/cockroach/pkg/roachpb.RangeID" 714 ]; 715 map<int32, NodeResponse> responses_by_node_id = 3 [ 716 (gogoproto.castkey) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID", 717 (gogoproto.customname) = "ResponsesByNodeID", 718 (gogoproto.nullable) = false 719 ]; 720 reserved 4; // Previously used. 721 } 722 723 // DiagnosticsRequest requests a diagnostics report. 724 message DiagnosticsRequest { 725 // node_id is a string so that "local" can be used to specify that no 726 // forwarding is necessary. 727 string node_id = 1; 728 } 729 730 message StoresRequest { 731 // node_id is a string so that "local" can be used to specify that no 732 // forwarding is necessary. 733 string node_id = 1; 734 } 735 736 message StoreDetails { 737 int32 store_id = 1 [ 738 (gogoproto.customname) = "StoreID", 739 (gogoproto.casttype) = 740 "github.com/cockroachdb/cockroach/pkg/roachpb.StoreID" 741 ]; 742 743 // TODO(mberhault): add a lot more information about stores. eg: 744 // - path 745 // - settings 746 // - encryption settings 747 748 // encryption_status is a serialized 749 // ccl/storageccl/engineccl/enginepbccl/stats.go::EncryptionStatus protobuf. 750 bytes encryption_status = 2; 751 752 // Basic file stats when encryption is enabled. 753 // Total files/bytes. 754 uint64 total_files = 3; 755 uint64 total_bytes = 4; 756 // Files/bytes using the active data key. 757 uint64 active_key_files = 5; 758 uint64 active_key_bytes = 6; 759 } 760 761 message StoresResponse { 762 repeated StoreDetails stores = 1 [ (gogoproto.nullable) = false ]; 763 } 764 765 message StatementsRequest { 766 string node_id = 1 [(gogoproto.customname) = "NodeID"]; 767 } 768 769 message StatementsResponse { 770 message ExtendedStatementStatisticsKey { 771 cockroach.sql.StatementStatisticsKey key_data = 1 [(gogoproto.nullable) = false]; 772 int32 node_id = 2 [(gogoproto.customname) = "NodeID", 773 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 774 } 775 776 message CollectedStatementStatistics { 777 ExtendedStatementStatisticsKey key = 1 [(gogoproto.nullable) = false]; 778 cockroach.sql.StatementStatistics stats = 2 [(gogoproto.nullable) = false]; 779 } 780 781 repeated CollectedStatementStatistics statements = 1 [(gogoproto.nullable) = false]; 782 // Timestamp of the last stats reset. 783 google.protobuf.Timestamp last_reset = 3 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; 784 // If set and non-empty, indicates the prefix to application_name 785 // used for statements/queries issued internally by CockroachDB. 786 string internal_app_name_prefix = 4; 787 } 788 789 message StatementDiagnosticsReport { 790 int64 id = 1; 791 bool completed = 2; 792 string statement_fingerprint = 3; 793 int64 statement_diagnostics_id = 4 794 [ (gogoproto.nullable) = true ]; 795 google.protobuf.Timestamp requested_at = 5 796 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; 797 } 798 799 message CreateStatementDiagnosticsReportRequest { 800 string statement_fingerprint = 1; 801 } 802 803 message CreateStatementDiagnosticsReportResponse { 804 StatementDiagnosticsReport report = 1; 805 } 806 807 message StatementDiagnosticsReportsRequest {} 808 809 message StatementDiagnosticsReportsResponse { 810 repeated StatementDiagnosticsReport reports = 1 [ (gogoproto.nullable) = false ]; 811 } 812 813 message StatementDiagnostics { 814 int64 id = 1; 815 string statement_fingerprint = 2; 816 google.protobuf.Timestamp collected_at = 3 817 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; 818 string trace = 4; 819 } 820 821 message StatementDiagnosticsRequest { 822 int64 statement_diagnostics_id = 1; 823 } 824 825 message StatementDiagnosticsResponse { 826 StatementDiagnostics diagnostics = 2; 827 } 828 829 message JobRegistryStatusRequest { 830 string node_id = 1; 831 } 832 833 message JobRegistryStatusResponse { 834 int32 node_id = 1 [ 835 (gogoproto.customname) = "NodeID", 836 (gogoproto.casttype) = 837 "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID" 838 ]; 839 message Job { 840 int64 id = 1; 841 } 842 repeated Job running_jobs = 2; 843 } 844 845 message JobStatusRequest { 846 int64 job_id = 1; 847 } 848 849 message JobStatusResponse { 850 cockroach.sql.jobs.jobspb.Job job = 1; 851 } 852 853 service Status { 854 rpc Certificates(CertificatesRequest) returns (CertificatesResponse) { 855 option (google.api.http) = { 856 get : "/_status/certificates/{node_id}" 857 }; 858 } 859 rpc Details(DetailsRequest) returns (DetailsResponse) { 860 option (google.api.http) = { 861 get : "/_status/details/{node_id}" 862 }; 863 } 864 rpc Nodes(NodesRequest) returns (NodesResponse) { 865 option (google.api.http) = { 866 get : "/_status/nodes" 867 }; 868 } 869 rpc Node(NodeRequest) returns (server.status.statuspb.NodeStatus) { 870 option (google.api.http) = { 871 get : "/_status/nodes/{node_id}" 872 }; 873 } 874 rpc RaftDebug(RaftDebugRequest) returns (RaftDebugResponse) { 875 option (google.api.http) = { 876 get : "/_status/raft" 877 }; 878 } 879 rpc Ranges(RangesRequest) returns (RangesResponse) { 880 option (google.api.http) = { 881 get : "/_status/ranges/{node_id}" 882 }; 883 } 884 rpc Gossip(GossipRequest) returns (gossip.InfoStatus) { 885 option (google.api.http) = { 886 get : "/_status/gossip/{node_id}" 887 }; 888 } 889 rpc EngineStats(EngineStatsRequest) returns (EngineStatsResponse) { 890 option (google.api.http) = { 891 get : "/_status/enginestats/{node_id}" 892 }; 893 } 894 rpc Allocator(AllocatorRequest) returns (AllocatorResponse) { 895 option (google.api.http) = { 896 get : "/_status/allocator/node/{node_id}" 897 }; 898 } 899 rpc AllocatorRange(AllocatorRangeRequest) returns (AllocatorRangeResponse) { 900 option (google.api.http) = { 901 get : "/_status/allocator/range/{range_id}" 902 }; 903 } 904 rpc ListSessions(ListSessionsRequest) returns (ListSessionsResponse) { 905 option (google.api.http) = { 906 get : "/_status/sessions" 907 }; 908 } 909 rpc ListLocalSessions(ListSessionsRequest) returns (ListSessionsResponse) { 910 option (google.api.http) = { 911 get : "/_status/local_sessions" 912 }; 913 } 914 rpc CancelQuery(CancelQueryRequest) returns (CancelQueryResponse) { 915 option (google.api.http) = { 916 get : "/_status/cancel_query/{node_id}" 917 }; 918 } 919 rpc CancelSession(CancelSessionRequest) returns (CancelSessionResponse) { 920 option (google.api.http) = { 921 get : "/_status/cancel_session/{node_id}" 922 }; 923 } 924 925 // SpanStats accepts a key span and node ID, and returns a set of stats 926 // summed from all ranges on the stores on that node which contain keys 927 // in that span. This is designed to compute stats specific to a SQL table: 928 // it will be called with the highest/lowest key for a SQL table, and return 929 // information about the resources on a node used by that table. 930 rpc SpanStats(SpanStatsRequest) returns (SpanStatsResponse) { 931 option (google.api.http) = { 932 post : "/_status/span" 933 body : "*" 934 }; 935 } 936 rpc Stacks(StacksRequest) returns (JSONResponse) { 937 option (google.api.http) = { 938 get : "/_status/stacks/{node_id}" 939 }; 940 } 941 rpc Profile(ProfileRequest) returns (JSONResponse) { 942 option (google.api.http) = { 943 get : "/_status/profile/{node_id}" 944 }; 945 } 946 rpc Metrics(MetricsRequest) returns (JSONResponse) { 947 option (google.api.http) = { 948 get : "/_status/metrics/{node_id}" 949 }; 950 } 951 rpc GetFiles(GetFilesRequest) returns (GetFilesResponse) { 952 option (google.api.http) = { 953 get : "/_status/files/{node_id}" 954 }; 955 } 956 rpc LogFilesList(LogFilesListRequest) returns (LogFilesListResponse) { 957 option (google.api.http) = { 958 get : "/_status/logfiles/{node_id}" 959 }; 960 } 961 rpc LogFile(LogFileRequest) returns (LogEntriesResponse) { 962 option (google.api.http) = { 963 get : "/_status/logfiles/{node_id}/{file}" 964 }; 965 } 966 rpc Logs(LogsRequest) returns (LogEntriesResponse) { 967 option (google.api.http) = { 968 get : "/_status/logs/{node_id}" 969 }; 970 } 971 rpc ProblemRanges(ProblemRangesRequest) returns (ProblemRangesResponse) { 972 option (google.api.http) = { 973 get : "/_status/problemranges" 974 }; 975 } 976 rpc HotRanges(HotRangesRequest) returns (HotRangesResponse) { 977 option (google.api.http) = { 978 get : "/_status/hotranges" 979 }; 980 } 981 rpc Range(RangeRequest) returns (RangeResponse) { 982 option (google.api.http) = { 983 get : "/_status/range/{range_id}" 984 }; 985 } 986 rpc Diagnostics(DiagnosticsRequest) 987 returns (cockroach.server.diagnosticspb.DiagnosticReport) { 988 option (google.api.http) = { 989 get : "/_status/diagnostics/{node_id}" 990 }; 991 } 992 rpc Stores(StoresRequest) returns (StoresResponse) { 993 option (google.api.http) = { 994 get : "/_status/stores/{node_id}" 995 }; 996 } 997 rpc Statements(StatementsRequest) returns (StatementsResponse) { 998 option (google.api.http) = { 999 get: "/_status/statements" 1000 }; 1001 } 1002 rpc CreateStatementDiagnosticsReport(CreateStatementDiagnosticsReportRequest) returns (CreateStatementDiagnosticsReportResponse) { 1003 option (google.api.http) = { 1004 post: "/_status/stmtdiagreports" 1005 body: "*" 1006 }; 1007 } 1008 rpc StatementDiagnosticsRequests(StatementDiagnosticsReportsRequest) returns (StatementDiagnosticsReportsResponse) { 1009 option (google.api.http) = { 1010 get: "/_status/stmtdiagreports" 1011 }; 1012 } 1013 rpc StatementDiagnostics(StatementDiagnosticsRequest) returns (StatementDiagnosticsResponse) { 1014 option (google.api.http) = { 1015 get: "/_status/stmtdiag/{statement_diagnostics_id}" 1016 }; 1017 } 1018 rpc JobRegistryStatus(JobRegistryStatusRequest) returns (JobRegistryStatusResponse) { 1019 option (google.api.http) = { 1020 get : "/_status/job_registry/{node_id}" 1021 }; 1022 } 1023 rpc JobStatus(JobStatusRequest) returns (JobStatusResponse) { 1024 option (google.api.http) = { 1025 get : "/_status/job/{job_id}" 1026 }; 1027 } 1028 }