Update
Updates the specified regression dashboard.
- TypeScript
- Python
import {
cloudApi,
decodeMessage,
serviceClients,
Session,
waitForOperation,
} from "@yandex-cloud/nodejs-sdk";
const Aggregation = cloudApi.loadtesting.api_report_kpi.Aggregation;
const Comparison = cloudApi.loadtesting.api_report_kpi.Comparison;
const Dashboard = cloudApi.loadtesting.api_regression_dashboard.Dashboard;
const QuantileType = cloudApi.loadtesting.api_common_quantiles.QuantileType;
const TitleWidget_TitleSize =
cloudApi.loadtesting.api_regression_widget.TitleWidget_TitleSize;
const UpdateRegressionDashboardRequest =
cloudApi.loadtesting.api_regression_dashboard_service
.UpdateRegressionDashboardRequest;
(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(
serviceClients.RegressionDashboardServiceClient
);
const operation = await client.update(
UpdateRegressionDashboardRequest.fromPartial({
dashboardId: "dashboardId",
// etag: "etag",
// updateMask: {
// paths: ["paths"]
// },
// name: "name",
// description: "description",
// content: {
// widgets: [{
// position: {
// x: 0,
// y: 0,
// width: 0,
// height: 0
// },
// chart: {
// id: "id",
// name: "name",
// description: "description",
// filterStr: "filterStr",
// testCase: "testCase",
// kpis: [{
// selector: {
// responseTime: {
// quantile: QuantileType.QUANTILE_TYPE_50
// },
// instances: {
// agg: Aggregation.AGGREGATION_MIN
// },
// imbalanceRps: {
// },
// protocolCodesAbsolute: {
// codesPatterns: ["codesPatterns"]
// },
// protocolCodesRelative: {
// codesPatterns: ["codesPatterns"]
// },
// networkCodesAbsolute: {
// codesPatterns: ["codesPatterns"]
// },
// networkCodesRelative: {
// codesPatterns: ["codesPatterns"]
// }
// },
// threshold: {
// value: 0,
// comparison: Comparison.COMPARISON_LT
// }
// }]
// },
// text: {
// text: "text"
// },
// title: {
// text: "text",
// size: TitleWidget_TitleSize.TITLE_SIZE_XS
// }
// }]
// }
})
);
const finishedOp = await waitForOperation(operation, session);
if (finishedOp.response) {
const result = decodeMessage<typeof regression.Dashboard>(
finishedOp.response
);
console.log(result);
}
})();
import os
import grpc
import yandexcloud
from yandex.cloud.loadtesting.api.v1.report.kpi_pb2 import Aggregation
from yandex.cloud.loadtesting.api.v1.regression.widget_pb2 import ChartWidget
from yandex.cloud.loadtesting.api.v1.report.kpi_pb2 import Comparison
from yandex.cloud.loadtesting.api.v1.regression.dashboard_pb2 import Dashboard
from yandex.cloud.loadtesting.api.v1.report.kpi_pb2 import Kpi
from yandex.cloud.loadtesting.api.v1.report.kpi_pb2 import KpiSelector
from yandex.cloud.loadtesting.api.v1.report.kpi_pb2 import KpiThreshold
from yandex.cloud.loadtesting.api.v1.common.quantiles_pb2 import QuantileType
from yandex.cloud.loadtesting.api.v1.regression_dashboard_service_pb2_grpc import (
RegressionDashboardServiceStub,
)
from yandex.cloud.loadtesting.api.v1.regression.widget_pb2 import TextWidget
from yandex.cloud.loadtesting.api.v1.regression.widget_pb2 import TitleWidget
from yandex.cloud.loadtesting.api.v1.regression_dashboard_service_pb2 import (
UpdateRegressionDashboardMetadata,
)
from yandex.cloud.loadtesting.api.v1.regression_dashboard_service_pb2 import (
UpdateRegressionDashboardRequest,
)
from yandex.cloud.loadtesting.api.v1.regression.widget_pb2 import Widget
token = os.getenv("YC_OAUTH_TOKEN")
sdk = yandexcloud.SDK(token=token)
service = sdk.client(RegressionDashboardServiceStub)
operation = service.Update(
UpdateRegressionDashboardRequest(
dashboard_id="dashboardId",
# etag = "etag",
# update_mask = FieldMask.FromJsonString("field1,field2"),
# name = "name",
# description = "description",
# content = Dashboard.Content(
# widgets = [Widget(
# position = Widget.LayoutPosition(
# x = 0,
# y = 0,
# width = 0,
# height = 0
# ),
# chart = ChartWidget(
# id = "id",
# name = "name",
# description = "description",
# filter_str = "filterStr",
# test_case = "testCase",
# kpis = [Kpi(
# selector = KpiSelector(
# response_time = KpiSelector.ResponseTime(
# quantile = QuantileType.QUANTILE_TYPE_50
# ),
# instances = KpiSelector.Instances(
# agg = Aggregation.AGGREGATION_MIN
# ),
# imbalance_rps = KpiSelector.ImbalanceRps(
# ),
# protocol_codes_absolute = KpiSelector.ProtocolCodesAbsolute(
# codes_patterns = ["codesPatterns"]
# ),
# protocol_codes_relative = KpiSelector.ProtocolCodesRelative(
# codes_patterns = ["codesPatterns"]
# ),
# network_codes_absolute = KpiSelector.NetworkCodesAbsolute(
# codes_patterns = ["codesPatterns"]
# ),
# network_codes_relative = KpiSelector.NetworkCodesRelative(
# codes_patterns = ["codesPatterns"]
# )
# ),
# threshold = KpiThreshold(
# value = 0,
# comparison = Comparison.COMPARISON_LT
# )
# )]
# ),
# text = TextWidget(
# text = "text"
# ),
# title = TitleWidget(
# text = "text",
# size = TitleWidget.TitleSize.TITLE_SIZE_XS
# )
# )]
# )
)
)
operation_result = sdk.wait_operation_and_get_result(
operation,
response_type=regression.Dashboard,
meta_type=UpdateRegressionDashboardMetadata,
)
print(operation_result)
UpdateRegressionDashboardRequest
dashboardId
: string
ID of the dashboards to update.
etag
: string
The current etag of the dashboard.
updateMask
: google.protobuf.FieldMask
Field mask that specifies which attributes of the dashboard are going to be updated.
name
: string
New name of the dashboard.
description
: string
New description of the dashboard.
content
: regression.Dashboard.Content
New content of the dashboard.
Content
Content of regression dashboard.
widgets
: Widget
Widgets.
Widget
Regression dashboard widget.
LayoutPosition
Widget position.
x
: int64
X.
y
: int64
Y.
width
: int64
Width.
height
: int64
Height.
position
: LayoutPosition
Widget position.
One of widget
LayoutPosition
Widget position.
x
: int64
X.
y
: int64
Y.
width
: int64
Width.
height
: int64
Height.
ChartWidget
Regression chart.
id
: string
ID of the chart.
name
: string
Name of the chart.
description
: string
Description of the chart.
filterStr
: string
Test filter selector to show KPI values for.
testCase
: string
Test case to show KPI values for.
kpis
: report.Kpi
KPIs to show.
TextWidget
Text widget.
text
: string
Text string.
TitleWidget
Title widget.
TitleSize
Title size.
TITLE_SIZE_UNSPECIFIED
Unspecified.
TITLE_SIZE_XS
Extra small.
TITLE_SIZE_S
Small.
TITLE_SIZE_M
Medium.
TITLE_SIZE_L
Large.
text
: string
Title string.
size
: TitleSize
Title size.
Kpi
KPI (Key Performance Indicator) represents some integral indicator measured during test.
selector
: KpiSelector
Kind of KPI.
threshold
: KpiThreshold
A condition that should be specified.
KpiSelector
KPI selector.
ResponseTime
Response time.
quantile
: common.QuantileType
Cummulative quantile (percentile).
Instances
Aggregated number of instances.
agg
: Aggregation
Aggregation function.
ImbalanceRps
Imbalance RPS.
ProtocolCodesAbsolute
codesPatterns
: string
Protocol (HTTP, GRPC) code patterns to match.
All successful HTTP responses: '2xx', '3xx'. All failed HTTP responses: ['0', '4xx', '5xx'][2].
ProtocolCodesRelative
codesPatterns
: string
Protocol (HTTP, GRPC) code patterns to match.
All successful HTTP responses: '2xx', '3xx'. All failed HTTP responses: ['0', '4xx', '5xx'][4].
NetworkCodesAbsolute
codesPatterns
: string
Network code patterns to match.
All successful network responses: '0'. All failed network responses: 'xx', 'xxx'.
NetworkCodesRelative
codesPatterns
: string
Network code patterns to match.
All successful network responses: '0'. All failed network responses: 'xx', 'xxx'.
One of kind
responseTime
: ResponseTimeResponse time cummulative quantile (percentile).
instances
: InstancesA number of instances throughout the test.
imbalanceRps
: ImbalanceRpsAn RPS at the moment the test has been auto-stopped.
protocolCodesAbsolute
: ProtocolCodesAbsoluteA total number of requests completed with certain protocol (HTTP, GRPC, etc.) codes.
protocolCodesRelative
: ProtocolCodesRelativeA percentage of requests completed with certain protocol (HTTP, GRPC, etc.) codes.
networkCodesAbsolute
: NetworkCodesAbsoluteA total number of requests completed with certain network codes.
networkCodesRelative
: NetworkCodesRelativeA percentage of requests completed with certain network codes.
KpiThreshold
KPI threshold represents a condition that an actual value of test's KPI should satisfy.
value
: double
Value for comparison with an actual KPI value.
comparison
: Comparison
Comparison operator for comparing actual with the threshold value.
Rule: actual (</<=/>/>=) reference
ResponseTime
Response time.
quantile
: common.QuantileType
Cummulative quantile (percentile).
Instances
Aggregated number of instances.
agg
: Aggregation
Aggregation function.
ImbalanceRps
Imbalance RPS.
ProtocolCodesAbsolute
codesPatterns
: string
Protocol (HTTP, GRPC) code patterns to match.
All successful HTTP responses: '2xx', '3xx'. All failed HTTP responses: ['0', '4xx', '5xx'][10].
ProtocolCodesRelative
codesPatterns
: string
Protocol (HTTP, GRPC) code patterns to match.
All successful HTTP responses: '2xx', '3xx'. All failed HTTP responses: ['0', '4xx', '5xx'][12].
NetworkCodesAbsolute
codesPatterns
: string
Network code patterns to match.
All successful network responses: '0'. All failed network responses: 'xx', 'xxx'.
NetworkCodesRelative
codesPatterns
: string
Network code patterns to match.
All successful network responses: '0'. All failed network responses: 'xx', 'xxx'.
Operation
An Operation resource. For more information, see Operation.
id
: string
ID of the operation.
description
: string
Description of the operation. 0-256 characters long.
createdAt
: google.protobuf.Timestamp
Creation timestamp.
createdBy
: string
ID of the user or service account who initiated the operation.
modifiedAt
: google.protobuf.Timestamp
The time when the Operation resource was last modified.
done
: bool
If the value is false
, it means the operation is still in progress.
If true
, the operation is completed, and either error
or response
is available.
metadata
: google.protobuf.Any
Service-specific metadata associated with the operation. It typically contains the ID of the target resource that the operation is performed on. Any method that returns a long-running operation should document the metadata type, if any.
One of result
The operation result.
If done == false
and there was no failure detected, neither error
nor response
is set.
If done == false
and there was a failure detected, error
is set.
If done == true
, exactly one of error
or response
is set.
error
: google.rpc.StatusThe error result of the operation in case of failure or cancellation.
response
: google.protobuf.AnyThe normal response of the operation in case of success.
If the original method returns no data on success, such as Delete, the response is google.protobuf.Empty. If the original method is the standard Create/Update, the response should be the target resource of the operation. Any method that returns a long-running operation should document the response type, if any.
[2]: #protocolcodesrelative'0', '4xx', '5xx'
[4]: #protocolcodesrelative'0', '4xx', '5xx'
[10]: #protocolcodesrelative'0', '4xx', '5xx'
[12]: #protocolcodesrelative'0', '4xx', '5xx'