1// Copyright 2022 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.dataflow.v1beta3; 18 19import "google/api/annotations.proto"; 20import "google/api/client.proto"; 21import "google/protobuf/struct.proto"; 22import "google/protobuf/timestamp.proto"; 23 24option csharp_namespace = "Google.Cloud.Dataflow.V1Beta3"; 25option go_package = "cloud.google.com/go/dataflow/apiv1beta3/dataflowpb;dataflowpb"; 26option java_multiple_files = true; 27option java_outer_classname = "MetricsProto"; 28option java_package = "com.google.dataflow.v1beta3"; 29option php_namespace = "Google\\Cloud\\Dataflow\\V1beta3"; 30option ruby_package = "Google::Cloud::Dataflow::V1beta3"; 31 32// The Dataflow Metrics API lets you monitor the progress of Dataflow 33// jobs. 34service MetricsV1Beta3 { 35 option (google.api.default_host) = "dataflow.googleapis.com"; 36 option (google.api.oauth_scopes) = 37 "https://www.googleapis.com/auth/cloud-platform," 38 "https://www.googleapis.com/auth/compute," 39 "https://www.googleapis.com/auth/compute.readonly," 40 "https://www.googleapis.com/auth/userinfo.email"; 41 42 // Request the job status. 43 // 44 // To request the status of a job, we recommend using 45 // `projects.locations.jobs.getMetrics` with a [regional endpoint] 46 // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints). Using 47 // `projects.jobs.getMetrics` is not recommended, as you can only request the 48 // status of jobs that are running in `us-central1`. 49 rpc GetJobMetrics(GetJobMetricsRequest) returns (JobMetrics) { 50 option (google.api.http) = { 51 get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/metrics" 52 additional_bindings { 53 get: "/v1b3/projects/{project_id}/jobs/{job_id}/metrics" 54 } 55 }; 56 } 57 58 // Request detailed information about the execution status of the job. 59 // 60 // EXPERIMENTAL. This API is subject to change or removal without notice. 61 rpc GetJobExecutionDetails(GetJobExecutionDetailsRequest) returns (JobExecutionDetails) { 62 option (google.api.http) = { 63 get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/executionDetails" 64 }; 65 } 66 67 // Request detailed information about the execution status of a stage of the 68 // job. 69 // 70 // EXPERIMENTAL. This API is subject to change or removal without notice. 71 rpc GetStageExecutionDetails(GetStageExecutionDetailsRequest) returns (StageExecutionDetails) { 72 option (google.api.http) = { 73 get: "/v1b3/projects/{project_id}/locations/{location}/jobs/{job_id}/stages/{stage_id}/executionDetails" 74 }; 75 } 76} 77 78// Identifies a metric, by describing the source which generated the 79// metric. 80message MetricStructuredName { 81 // Origin (namespace) of metric name. May be blank for user-define metrics; 82 // will be "dataflow" for metrics defined by the Dataflow service or SDK. 83 string origin = 1; 84 85 // Worker-defined metric name. 86 string name = 2; 87 88 // Zero or more labeled fields which identify the part of the job this 89 // metric is associated with, such as the name of a step or collection. 90 // 91 // For example, built-in counters associated with steps will have 92 // context['step'] = <step-name>. Counters associated with PCollections 93 // in the SDK will have context['pcollection'] = <pcollection-name>. 94 map<string, string> context = 3; 95} 96 97// Describes the state of a metric. 98message MetricUpdate { 99 // Name of the metric. 100 MetricStructuredName name = 1; 101 102 // Metric aggregation kind. The possible metric aggregation kinds are 103 // "Sum", "Max", "Min", "Mean", "Set", "And", "Or", and "Distribution". 104 // The specified aggregation kind is case-insensitive. 105 // 106 // If omitted, this is not an aggregated value but instead 107 // a single metric sample value. 108 string kind = 2; 109 110 // True if this metric is reported as the total cumulative aggregate 111 // value accumulated since the worker started working on this WorkItem. 112 // By default this is false, indicating that this metric is reported 113 // as a delta that is not associated with any WorkItem. 114 bool cumulative = 3; 115 116 // Worker-computed aggregate value for aggregation kinds "Sum", "Max", "Min", 117 // "And", and "Or". The possible value types are Long, Double, and Boolean. 118 google.protobuf.Value scalar = 4; 119 120 // Worker-computed aggregate value for the "Mean" aggregation kind. 121 // This holds the sum of the aggregated values and is used in combination 122 // with mean_count below to obtain the actual mean aggregate value. 123 // The only possible value types are Long and Double. 124 google.protobuf.Value mean_sum = 5; 125 126 // Worker-computed aggregate value for the "Mean" aggregation kind. 127 // This holds the count of the aggregated values and is used in combination 128 // with mean_sum above to obtain the actual mean aggregate value. 129 // The only possible value type is Long. 130 google.protobuf.Value mean_count = 6; 131 132 // Worker-computed aggregate value for the "Set" aggregation kind. The only 133 // possible value type is a list of Values whose type can be Long, Double, 134 // or String, according to the metric's type. All Values in the list must 135 // be of the same type. 136 google.protobuf.Value set = 7; 137 138 // A struct value describing properties of a distribution of numeric values. 139 google.protobuf.Value distribution = 11; 140 141 // A struct value describing properties of a Gauge. 142 // Metrics of gauge type show the value of a metric across time, and is 143 // aggregated based on the newest value. 144 google.protobuf.Value gauge = 12; 145 146 // Worker-computed aggregate value for internal use by the Dataflow 147 // service. 148 google.protobuf.Value internal = 8; 149 150 // Timestamp associated with the metric value. Optional when workers are 151 // reporting work progress; it will be filled in responses from the 152 // metrics API. 153 google.protobuf.Timestamp update_time = 9; 154} 155 156// Request to get job metrics. 157message GetJobMetricsRequest { 158 // A project id. 159 string project_id = 1; 160 161 // The job to get metrics for. 162 string job_id = 2; 163 164 // Return only metric data that has changed since this time. 165 // Default is to return all information about all metrics for the job. 166 google.protobuf.Timestamp start_time = 3; 167 168 // The [regional endpoint] 169 // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that 170 // contains the job specified by job_id. 171 string location = 4; 172} 173 174// JobMetrics contains a collection of metrics describing the detailed progress 175// of a Dataflow job. Metrics correspond to user-defined and system-defined 176// metrics in the job. 177// 178// This resource captures only the most recent values of each metric; 179// time-series data can be queried for them (under the same metric names) 180// from Cloud Monitoring. 181message JobMetrics { 182 // Timestamp as of which metric values are current. 183 google.protobuf.Timestamp metric_time = 1; 184 185 // All metrics for this job. 186 repeated MetricUpdate metrics = 2; 187} 188 189// Request to get job execution details. 190message GetJobExecutionDetailsRequest { 191 // A project id. 192 string project_id = 1; 193 194 // The job to get execution details for. 195 string job_id = 2; 196 197 // The [regional endpoint] 198 // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that 199 // contains the job specified by job_id. 200 string location = 3; 201 202 // If specified, determines the maximum number of stages to 203 // return. If unspecified, the service may choose an appropriate 204 // default, or may return an arbitrarily large number of results. 205 int32 page_size = 4; 206 207 // If supplied, this should be the value of next_page_token returned 208 // by an earlier call. This will cause the next page of results to 209 // be returned. 210 string page_token = 5; 211} 212 213// Information about the progress of some component of job execution. 214message ProgressTimeseries { 215 // A point in the timeseries. 216 message Point { 217 // The timestamp of the point. 218 google.protobuf.Timestamp time = 1; 219 220 // The value of the point. 221 double value = 2; 222 } 223 224 // The current progress of the component, in the range [0,1]. 225 double current_progress = 1; 226 227 // History of progress for the component. 228 // 229 // Points are sorted by time. 230 repeated Point data_points = 2; 231} 232 233// The state of some component of job execution. 234enum ExecutionState { 235 // The component state is unknown or unspecified. 236 EXECUTION_STATE_UNKNOWN = 0; 237 238 // The component is not yet running. 239 EXECUTION_STATE_NOT_STARTED = 1; 240 241 // The component is currently running. 242 EXECUTION_STATE_RUNNING = 2; 243 244 // The component succeeded. 245 EXECUTION_STATE_SUCCEEDED = 3; 246 247 // The component failed. 248 EXECUTION_STATE_FAILED = 4; 249 250 // Execution of the component was cancelled. 251 EXECUTION_STATE_CANCELLED = 5; 252} 253 254// Information about a particular execution stage of a job. 255message StageSummary { 256 // ID of this stage 257 string stage_id = 1; 258 259 // State of this stage. 260 ExecutionState state = 2; 261 262 // Start time of this stage. 263 google.protobuf.Timestamp start_time = 3; 264 265 // End time of this stage. 266 // 267 // If the work item is completed, this is the actual end time of the stage. 268 // Otherwise, it is the predicted end time. 269 google.protobuf.Timestamp end_time = 4; 270 271 // Progress for this stage. 272 // Only applicable to Batch jobs. 273 ProgressTimeseries progress = 5; 274 275 // Metrics for this stage. 276 repeated MetricUpdate metrics = 6; 277} 278 279// Information about the execution of a job. 280message JobExecutionDetails { 281 // The stages of the job execution. 282 repeated StageSummary stages = 1; 283 284 // If present, this response does not contain all requested tasks. To obtain 285 // the next page of results, repeat the request with page_token set to this 286 // value. 287 string next_page_token = 2; 288} 289 290// Request to get information about a particular execution stage of a job. 291// Currently only tracked for Batch jobs. 292message GetStageExecutionDetailsRequest { 293 // A project id. 294 string project_id = 1; 295 296 // The job to get execution details for. 297 string job_id = 2; 298 299 // The [regional endpoint] 300 // (https://cloud.google.com/dataflow/docs/concepts/regional-endpoints) that 301 // contains the job specified by job_id. 302 string location = 3; 303 304 // The stage for which to fetch information. 305 string stage_id = 4; 306 307 // If specified, determines the maximum number of work items to 308 // return. If unspecified, the service may choose an appropriate 309 // default, or may return an arbitrarily large number of results. 310 int32 page_size = 5; 311 312 // If supplied, this should be the value of next_page_token returned 313 // by an earlier call. This will cause the next page of results to 314 // be returned. 315 string page_token = 6; 316 317 // Lower time bound of work items to include, by start time. 318 google.protobuf.Timestamp start_time = 7; 319 320 // Upper time bound of work items to include, by start time. 321 google.protobuf.Timestamp end_time = 8; 322} 323 324// Information about an individual work item execution. 325message WorkItemDetails { 326 // Name of this work item. 327 string task_id = 1; 328 329 // Attempt ID of this work item 330 string attempt_id = 2; 331 332 // Start time of this work item attempt. 333 google.protobuf.Timestamp start_time = 3; 334 335 // End time of this work item attempt. 336 // 337 // If the work item is completed, this is the actual end time of the work 338 // item. Otherwise, it is the predicted end time. 339 google.protobuf.Timestamp end_time = 4; 340 341 // State of this work item. 342 ExecutionState state = 5; 343 344 // Progress of this work item. 345 ProgressTimeseries progress = 6; 346 347 // Metrics for this work item. 348 repeated MetricUpdate metrics = 7; 349} 350 351// Information about a worker 352message WorkerDetails { 353 // Name of this worker 354 string worker_name = 1; 355 356 // Work items processed by this worker, sorted by time. 357 repeated WorkItemDetails work_items = 2; 358} 359 360// Information about the workers and work items within a stage. 361message StageExecutionDetails { 362 // Workers that have done work on the stage. 363 repeated WorkerDetails workers = 1; 364 365 // If present, this response does not contain all requested tasks. To obtain 366 // the next page of results, repeat the request with page_token set to this 367 // value. 368 string next_page_token = 2; 369} 370