metrics.proto 12 KB

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