metrics.proto 12 KB

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