|
14 | 14 |
|
15 | 15 | #include "google/cloud/bigquery/v2/minimal/internal/job_query_stats.h" |
16 | 16 | #include "google/cloud/bigquery/v2/minimal/internal/json_utils.h" |
| 17 | +#include "google/cloud/internal/debug_string.h" |
| 18 | +#include "google/cloud/internal/format_time_point.h" |
17 | 19 |
|
18 | 20 | namespace google { |
19 | 21 | namespace cloud { |
@@ -479,6 +481,258 @@ bool operator==(RowAccessPolicyReference const& lhs, |
479 | 481 | lhs.table_id == rhs.table_id && lhs.policy_id == rhs.policy_id; |
480 | 482 | } |
481 | 483 |
|
| 484 | +std::string ExplainQueryStep::DebugString(absl::string_view name, |
| 485 | + TracingOptions const& options, |
| 486 | + int indent) const { |
| 487 | + return internal::DebugFormatter(name, options, indent) |
| 488 | + .StringField("kind", kind) |
| 489 | + .Field("substeps", substeps) |
| 490 | + .Build(); |
| 491 | +} |
| 492 | + |
| 493 | +std::string ComputeMode::DebugString(absl::string_view name, |
| 494 | + TracingOptions const& options, |
| 495 | + int indent) const { |
| 496 | + return internal::DebugFormatter(name, options, indent) |
| 497 | + .StringField("value", value) |
| 498 | + .Build(); |
| 499 | +} |
| 500 | + |
| 501 | +std::string ExplainQueryStage::DebugString(absl::string_view eq_name, |
| 502 | + TracingOptions const& options, |
| 503 | + int indent) const { |
| 504 | + return internal::DebugFormatter(eq_name, options, indent) |
| 505 | + .StringField("name", name) |
| 506 | + .StringField("status", status) |
| 507 | + .Field("id", id) |
| 508 | + .Field("shuffle_output_bytes", shuffle_output_bytes) |
| 509 | + .Field("shuffle_output_bytes_spilled", shuffle_output_bytes_spilled) |
| 510 | + .Field("records_read", records_read) |
| 511 | + .Field("records_written", records_written) |
| 512 | + .Field("parallel_inputs", parallel_inputs) |
| 513 | + .Field("completed_parallel_inputs", completed_parallel_inputs) |
| 514 | + .Field("start_time", start_time) |
| 515 | + .Field("end_time", end_time) |
| 516 | + .Field("slot_time", slot_time) |
| 517 | + .Field("wait_avg_time_spent", wait_avg_time_spent) |
| 518 | + .Field("wait_max_time_spent", wait_max_time_spent) |
| 519 | + .Field("read_avg_time_spent", read_avg_time_spent) |
| 520 | + .Field("read_max_time_spent", read_max_time_spent) |
| 521 | + .Field("write_avg_time_spent", write_avg_time_spent) |
| 522 | + .Field("write_max_time_spent", write_max_time_spent) |
| 523 | + .Field("compute_avg_time_spent", compute_avg_time_spent) |
| 524 | + .Field("compute_max_time_spent", compute_max_time_spent) |
| 525 | + .Field("wait_ratio_avg", wait_ratio_avg) |
| 526 | + .Field("wait_ratio_max", wait_ratio_max) |
| 527 | + .Field("read_ratio_avg", read_ratio_avg) |
| 528 | + .Field("read_ratio_max", read_ratio_max) |
| 529 | + .Field("compute_ratio_avg", compute_ratio_avg) |
| 530 | + .Field("compute_ratio_max", compute_ratio_max) |
| 531 | + .Field("write_ratio_avg", write_ratio_avg) |
| 532 | + .Field("write_ratio_max", write_ratio_max) |
| 533 | + .Field("steps", steps) |
| 534 | + .SubMessage("compute_mode", compute_mode) |
| 535 | + .Build(); |
| 536 | +} |
| 537 | + |
| 538 | +std::string QueryTimelineSample::DebugString(absl::string_view name, |
| 539 | + TracingOptions const& options, |
| 540 | + int indent) const { |
| 541 | + return internal::DebugFormatter(name, options, indent) |
| 542 | + .Field("elapsed_time", elapsed_time) |
| 543 | + .Field("total_slot_time", total_slot_time) |
| 544 | + .Field("pending_units", pending_units) |
| 545 | + .Field("completed_units", completed_units) |
| 546 | + .Field("active_units", active_units) |
| 547 | + .Field("estimated_runnable_units", estimated_runnable_units) |
| 548 | + .Build(); |
| 549 | +} |
| 550 | + |
| 551 | +std::string DmlStats::DebugString(absl::string_view name, |
| 552 | + TracingOptions const& options, |
| 553 | + int indent) const { |
| 554 | + return internal::DebugFormatter(name, options, indent) |
| 555 | + .Field("inserted_row_count", inserted_row_count) |
| 556 | + .Field("deleted_row_count", deleted_row_count) |
| 557 | + .Field("updated_row_count", updated_row_count) |
| 558 | + .Build(); |
| 559 | +} |
| 560 | + |
| 561 | +std::string RowAccessPolicyReference::DebugString(absl::string_view name, |
| 562 | + TracingOptions const& options, |
| 563 | + int indent) const { |
| 564 | + return internal::DebugFormatter(name, options, indent) |
| 565 | + .StringField("project_id", project_id) |
| 566 | + .StringField("dataset_id", dataset_id) |
| 567 | + .StringField("table_id", table_id) |
| 568 | + .StringField("policy_id", policy_id) |
| 569 | + .Build(); |
| 570 | +} |
| 571 | + |
| 572 | +std::string IndexUsageMode::DebugString(absl::string_view name, |
| 573 | + TracingOptions const& options, |
| 574 | + int indent) const { |
| 575 | + return internal::DebugFormatter(name, options, indent) |
| 576 | + .StringField("value", value) |
| 577 | + .Build(); |
| 578 | +} |
| 579 | + |
| 580 | +std::string IndexedUnusedReasonCode::DebugString(absl::string_view name, |
| 581 | + TracingOptions const& options, |
| 582 | + int indent) const { |
| 583 | + return internal::DebugFormatter(name, options, indent) |
| 584 | + .StringField("value", value) |
| 585 | + .Build(); |
| 586 | +} |
| 587 | + |
| 588 | +std::string IndexUnusedReason::DebugString(absl::string_view name, |
| 589 | + TracingOptions const& options, |
| 590 | + int indent) const { |
| 591 | + return internal::DebugFormatter(name, options, indent) |
| 592 | + .StringField("message", message) |
| 593 | + .StringField("index_name", index_name) |
| 594 | + .SubMessage("base_table", base_table) |
| 595 | + .SubMessage("code", code) |
| 596 | + .Build(); |
| 597 | +} |
| 598 | + |
| 599 | +std::string SearchStatistics::DebugString(absl::string_view name, |
| 600 | + TracingOptions const& options, |
| 601 | + int indent) const { |
| 602 | + return internal::DebugFormatter(name, options, indent) |
| 603 | + .Field("index_unused_reasons", index_unused_reasons) |
| 604 | + .SubMessage("index_usage_mode", index_usage_mode) |
| 605 | + .Build(); |
| 606 | +} |
| 607 | + |
| 608 | +std::string InputDataChange::DebugString(absl::string_view name, |
| 609 | + TracingOptions const& options, |
| 610 | + int indent) const { |
| 611 | + return internal::DebugFormatter(name, options, indent) |
| 612 | + .Field("records_read_diff_percentage", |
| 613 | + static_cast<double>(records_read_diff_percentage)) |
| 614 | + .Build(); |
| 615 | +} |
| 616 | + |
| 617 | +std::string StagePerformanceChangeInsight::DebugString( |
| 618 | + absl::string_view name, TracingOptions const& options, int indent) const { |
| 619 | + return internal::DebugFormatter(name, options, indent) |
| 620 | + .Field("stage_id", stage_id) |
| 621 | + .SubMessage("input_data_change", input_data_change) |
| 622 | + .Build(); |
| 623 | +} |
| 624 | + |
| 625 | +std::string StagePerformanceStandaloneInsight::DebugString( |
| 626 | + absl::string_view name, TracingOptions const& options, int indent) const { |
| 627 | + return internal::DebugFormatter(name, options, indent) |
| 628 | + .Field("stage_id", stage_id) |
| 629 | + .Field("slot_contention", slot_contention) |
| 630 | + .Field("insufficient_shuffle_quota", insufficient_shuffle_quota) |
| 631 | + .Build(); |
| 632 | +} |
| 633 | + |
| 634 | +std::string PerformanceInsights::DebugString(absl::string_view name, |
| 635 | + TracingOptions const& options, |
| 636 | + int indent) const { |
| 637 | + return internal::DebugFormatter(name, options, indent) |
| 638 | + .Field("avg_previous_execution_time", avg_previous_execution_time) |
| 639 | + .SubMessage("stage_performance_standalone_insights", |
| 640 | + stage_performance_standalone_insights) |
| 641 | + .SubMessage("stage_performance_change_insights", |
| 642 | + stage_performance_change_insights) |
| 643 | + .Build(); |
| 644 | +} |
| 645 | + |
| 646 | +std::string RejectedReason::DebugString(absl::string_view name, |
| 647 | + TracingOptions const& options, |
| 648 | + int indent) const { |
| 649 | + return internal::DebugFormatter(name, options, indent) |
| 650 | + .StringField("value", value) |
| 651 | + .Build(); |
| 652 | +} |
| 653 | + |
| 654 | +std::string MaterializedView::DebugString(absl::string_view name, |
| 655 | + TracingOptions const& options, |
| 656 | + int indent) const { |
| 657 | + return internal::DebugFormatter(name, options, indent) |
| 658 | + .Field("chosen", chosen) |
| 659 | + .Field("estimated_bytes_saved", estimated_bytes_saved) |
| 660 | + .SubMessage("rejected_reason", rejected_reason) |
| 661 | + .SubMessage("table_reference", table_reference) |
| 662 | + .Build(); |
| 663 | +} |
| 664 | + |
| 665 | +std::string MaterializedViewStatistics::DebugString( |
| 666 | + absl::string_view name, TracingOptions const& options, int indent) const { |
| 667 | + return internal::DebugFormatter(name, options, indent) |
| 668 | + .Field("materialized_view", materialized_view) |
| 669 | + .Build(); |
| 670 | +} |
| 671 | + |
| 672 | +std::string MetadataCacheUnusedReason::DebugString( |
| 673 | + absl::string_view name, TracingOptions const& options, int indent) const { |
| 674 | + return internal::DebugFormatter(name, options, indent) |
| 675 | + .StringField("value", value) |
| 676 | + .Build(); |
| 677 | +} |
| 678 | + |
| 679 | +std::string TableMetadataCacheUsage::DebugString(absl::string_view name, |
| 680 | + TracingOptions const& options, |
| 681 | + int indent) const { |
| 682 | + return internal::DebugFormatter(name, options, indent) |
| 683 | + .StringField("explanation", explanation) |
| 684 | + .SubMessage("unused_reason", unused_reason) |
| 685 | + .SubMessage("table_reference", table_reference) |
| 686 | + .Build(); |
| 687 | +} |
| 688 | + |
| 689 | +std::string MetadataCacheStatistics::DebugString(absl::string_view name, |
| 690 | + TracingOptions const& options, |
| 691 | + int indent) const { |
| 692 | + return internal::DebugFormatter(name, options, indent) |
| 693 | + .Field("table_metadata_cache_usage", table_metadata_cache_usage) |
| 694 | + .Build(); |
| 695 | +} |
| 696 | + |
| 697 | +std::string JobQueryStatistics::DebugString(absl::string_view name, |
| 698 | + TracingOptions const& options, |
| 699 | + int indent) const { |
| 700 | + return internal::DebugFormatter(name, options, indent) |
| 701 | + .Field("estimated_bytes_processed", estimated_bytes_processed) |
| 702 | + .Field("total_partitions_processed", total_partitions_processed) |
| 703 | + .Field("total_bytes_processed", total_bytes_processed) |
| 704 | + .Field("total_bytes_billed", total_bytes_billed) |
| 705 | + .Field("billing_tier", billing_tier) |
| 706 | + .Field("num_dml_affected_rows", num_dml_affected_rows) |
| 707 | + .Field("ddl_affected_row_access_policy_count", |
| 708 | + ddl_affected_row_access_policy_count) |
| 709 | + .StringField("total_bytes_processed_accuracy", |
| 710 | + total_bytes_processed_accuracy) |
| 711 | + .StringField("statement_type", statement_type) |
| 712 | + .StringField("ddl_operation_performed", ddl_operation_performed) |
| 713 | + .Field("total_slot_time", total_slot_time) |
| 714 | + .Field("cache_hit", cache_hit) |
| 715 | + .Field("query_plan", query_plan) |
| 716 | + .Field("timeline", timeline) |
| 717 | + .Field("referenced_tables", referenced_tables) |
| 718 | + .Field("referenced_routines", referenced_routines) |
| 719 | + .SubMessage("schema", schema) |
| 720 | + .SubMessage("dml_stats", dml_stats) |
| 721 | + .SubMessage("ddl_target_table", ddl_target_table) |
| 722 | + .SubMessage("ddl_destination_table", ddl_destination_table) |
| 723 | + .SubMessage("ddl_target_row_access_policy", ddl_target_row_access_policy) |
| 724 | + .SubMessage("ddl_target_routine", ddl_target_routine) |
| 725 | + .SubMessage("ddl_target_dataset", ddl_target_dataset) |
| 726 | + .SubMessage("dcl_target_table", dcl_target_table) |
| 727 | + .SubMessage("dcl_target_view", dcl_target_view) |
| 728 | + .SubMessage("dcl_target_dataset", dcl_target_dataset) |
| 729 | + .SubMessage("search_statistics", search_statistics) |
| 730 | + .SubMessage("performance_insights", performance_insights) |
| 731 | + .SubMessage("materialized_view_statistics", materialized_view_statistics) |
| 732 | + .SubMessage("metadata_cache_statistics", metadata_cache_statistics) |
| 733 | + .Build(); |
| 734 | +} |
| 735 | + |
482 | 736 | GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END |
483 | 737 | } // namespace bigquery_v2_minimal_internal |
484 | 738 | } // namespace cloud |
|
0 commit comments