Skip to content

Commit

Permalink
server: new statement details endpoint
Browse files Browse the repository at this point in the history
New endpoint for Statement Details. The endpoint returns:
- Statement: the total stats for that statement fingerprint
- StatementsPerAggregatedTs: returns the statement from the period
selected but each aggregated timestamp is an entry. This list
can be used on the overview page on the Statement Details for
the creation of charts by aggregation timestamp.
- StatementsPerPlanHash: returns the statement from the period
selected but each plan hash is an entry. This list can be used
on the Explain Plan tab of the Statement Details, to show the
execution stats per Plan.

Partially addresses #72129

Release note (api change): New Statement Details endpoint that returns
the details for a selected statement, and its execution separated by
aggregation timestamp (statementsPerAggregatedTs) and by plan hash
(statementsPerPlanHash).
  • Loading branch information
maryliag committed Feb 28, 2022
1 parent f2a722f commit f3f1ad3
Show file tree
Hide file tree
Showing 5 changed files with 597 additions and 15 deletions.
98 changes: 98 additions & 0 deletions docs/generated/http/full.md
Original file line number Diff line number Diff line change
Expand Up @@ -3723,6 +3723,104 @@ Support status: [reserved](#support-status)



## StatementDetails

`GET /_status/stmtdetails/{fingerprint_id}`



Support status: [reserved](#support-status)

#### Request Parameters




StatementDetailsRequest requests the details of a Statement, based on its keys.


| Field | Type | Label | Description | Support status |
| ----- | ---- | ----- | ----------- | -------------- |
| fingerprint_id | [string](#cockroach.server.serverpb.StatementDetailsRequest-string) | | fingerprint_id is generated by ConstructStatementFingerprintID using: query, failed, implicitTxn and database. So we don't need to add them to the request. | [reserved](#support-status) |
| app_names | [string](#cockroach.server.serverpb.StatementDetailsRequest-string) | repeated | | [reserved](#support-status) |
| start | [int64](#cockroach.server.serverpb.StatementDetailsRequest-int64) | | Unix time range for aggregated statements. | [reserved](#support-status) |
| end | [int64](#cockroach.server.serverpb.StatementDetailsRequest-int64) | | | [reserved](#support-status) |







#### Response Parameters







| Field | Type | Label | Description | Support status |
| ----- | ---- | ----- | ----------- | -------------- |
| statement | [StatementDetailsResponse.CollectedStatementSummary](#cockroach.server.serverpb.StatementDetailsResponse-cockroach.server.serverpb.StatementDetailsResponse.CollectedStatementSummary) | | statement returns the total statistics for the statement. | [reserved](#support-status) |
| statements_per_aggregated_ts | [StatementDetailsResponse.CollectedStatementGroupedByAggregatedTs](#cockroach.server.serverpb.StatementDetailsResponse-cockroach.server.serverpb.StatementDetailsResponse.CollectedStatementGroupedByAggregatedTs) | repeated | statements_per_aggregated_ts returns the same statement from above, but with its statistics separated by the aggregated timestamp. | [reserved](#support-status) |
| statements_per_plan_hash | [StatementDetailsResponse.CollectedStatementGroupedByPlanHash](#cockroach.server.serverpb.StatementDetailsResponse-cockroach.server.serverpb.StatementDetailsResponse.CollectedStatementGroupedByPlanHash) | repeated | statements_per_plan_hash returns the same statement from above, but with its statistics separated by the plan hash. | [reserved](#support-status) |
| internal_app_name_prefix | [string](#cockroach.server.serverpb.StatementDetailsResponse-string) | | If set and non-empty, indicates the prefix to application_name used for statements/queries issued internally by CockroachDB. | [reserved](#support-status) |






<a name="cockroach.server.serverpb.StatementDetailsResponse-cockroach.server.serverpb.StatementDetailsResponse.CollectedStatementSummary"></a>
#### StatementDetailsResponse.CollectedStatementSummary



| Field | Type | Label | Description | Support status |
| ----- | ---- | ----- | ----------- | -------------- |
| key_data | [cockroach.sql.StatementStatisticsKey](#cockroach.server.serverpb.StatementDetailsResponse-cockroach.sql.StatementStatisticsKey) | | | [reserved](#support-status) |
| formatted_query | [string](#cockroach.server.serverpb.StatementDetailsResponse-string) | | Formatted query is the return of the key_data.query after prettify_statement. The value from the key_data cannot be replaced by the fomratted value, because is used as is for diagnostic bundle. | [reserved](#support-status) |
| app_names | [string](#cockroach.server.serverpb.StatementDetailsResponse-string) | repeated | | [reserved](#support-status) |
| stats | [cockroach.sql.StatementStatistics](#cockroach.server.serverpb.StatementDetailsResponse-cockroach.sql.StatementStatistics) | | | [reserved](#support-status) |
| aggregation_interval | [google.protobuf.Duration](#cockroach.server.serverpb.StatementDetailsResponse-google.protobuf.Duration) | | | [reserved](#support-status) |





<a name="cockroach.server.serverpb.StatementDetailsResponse-cockroach.server.serverpb.StatementDetailsResponse.CollectedStatementGroupedByAggregatedTs"></a>
#### StatementDetailsResponse.CollectedStatementGroupedByAggregatedTs



| Field | Type | Label | Description | Support status |
| ----- | ---- | ----- | ----------- | -------------- |
| stats | [cockroach.sql.StatementStatistics](#cockroach.server.serverpb.StatementDetailsResponse-cockroach.sql.StatementStatistics) | | | [reserved](#support-status) |
| aggregation_interval | [google.protobuf.Duration](#cockroach.server.serverpb.StatementDetailsResponse-google.protobuf.Duration) | | | [reserved](#support-status) |
| aggregated_ts | [google.protobuf.Timestamp](#cockroach.server.serverpb.StatementDetailsResponse-google.protobuf.Timestamp) | | | [reserved](#support-status) |





<a name="cockroach.server.serverpb.StatementDetailsResponse-cockroach.server.serverpb.StatementDetailsResponse.CollectedStatementGroupedByPlanHash"></a>
#### StatementDetailsResponse.CollectedStatementGroupedByPlanHash



| Field | Type | Label | Description | Support status |
| ----- | ---- | ----- | ----------- | -------------- |
| stats | [cockroach.sql.StatementStatistics](#cockroach.server.serverpb.StatementDetailsResponse-cockroach.sql.StatementStatistics) | | | [reserved](#support-status) |
| aggregation_interval | [google.protobuf.Duration](#cockroach.server.serverpb.StatementDetailsResponse-google.protobuf.Duration) | | | [reserved](#support-status) |
| explain_plan | [string](#cockroach.server.serverpb.StatementDetailsResponse-string) | | | [reserved](#support-status) |
| plan_hash | [uint64](#cockroach.server.serverpb.StatementDetailsResponse-uint64) | | | [reserved](#support-status) |






## CreateStatementDiagnosticsReport

`POST /_status/stmtdiagreports`
Expand Down
Loading

0 comments on commit f3f1ad3

Please sign in to comment.