error_stats_service.proto 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  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.devtools.clouderrorreporting.v1beta1;
  16. import "google/api/annotations.proto";
  17. import "google/api/client.proto";
  18. import "google/api/field_behavior.proto";
  19. import "google/api/resource.proto";
  20. import "google/devtools/clouderrorreporting/v1beta1/common.proto";
  21. import "google/protobuf/duration.proto";
  22. import "google/protobuf/timestamp.proto";
  23. option cc_enable_arenas = true;
  24. option csharp_namespace = "Google.Cloud.ErrorReporting.V1Beta1";
  25. option go_package = "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1;clouderrorreporting";
  26. option java_multiple_files = true;
  27. option java_outer_classname = "ErrorStatsServiceProto";
  28. option java_package = "com.google.devtools.clouderrorreporting.v1beta1";
  29. option php_namespace = "Google\\Cloud\\ErrorReporting\\V1beta1";
  30. option ruby_package = "Google::Cloud::ErrorReporting::V1beta1";
  31. // An API for retrieving and managing error statistics as well as data for
  32. // individual events.
  33. service ErrorStatsService {
  34. option (google.api.default_host) = "clouderrorreporting.googleapis.com";
  35. option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform";
  36. // Lists the specified groups.
  37. rpc ListGroupStats(ListGroupStatsRequest) returns (ListGroupStatsResponse) {
  38. option (google.api.http) = {
  39. get: "/v1beta1/{project_name=projects/*}/groupStats"
  40. };
  41. option (google.api.method_signature) = "project_name,time_range";
  42. }
  43. // Lists the specified events.
  44. rpc ListEvents(ListEventsRequest) returns (ListEventsResponse) {
  45. option (google.api.http) = {
  46. get: "/v1beta1/{project_name=projects/*}/events"
  47. };
  48. option (google.api.method_signature) = "project_name,group_id";
  49. }
  50. // Deletes all error events of a given project.
  51. rpc DeleteEvents(DeleteEventsRequest) returns (DeleteEventsResponse) {
  52. option (google.api.http) = {
  53. delete: "/v1beta1/{project_name=projects/*}/events"
  54. };
  55. option (google.api.method_signature) = "project_name";
  56. }
  57. }
  58. // Specifies a set of `ErrorGroupStats` to return.
  59. message ListGroupStatsRequest {
  60. // Required. The resource name of the Google Cloud Platform project. Written
  61. // as `projects/{projectID}` or `projects/{projectNumber}`, where `{projectID}`
  62. // and `{projectNumber}` can be found in the
  63. // [Google Cloud Console](https://support.google.com/cloud/answer/6158840).
  64. //
  65. // Examples: `projects/my-project-123`, `projects/5551234`.
  66. string project_name = 1 [
  67. (google.api.field_behavior) = REQUIRED,
  68. (google.api.resource_reference) = {
  69. type: "cloudresourcemanager.googleapis.com/Project"
  70. }
  71. ];
  72. // Optional. List all <code>ErrorGroupStats</code> with these IDs.
  73. repeated string group_id = 2 [(google.api.field_behavior) = OPTIONAL];
  74. // Optional. List only <code>ErrorGroupStats</code> which belong to a service
  75. // context that matches the filter.
  76. // Data for all service contexts is returned if this field is not specified.
  77. ServiceContextFilter service_filter = 3 [(google.api.field_behavior) = OPTIONAL];
  78. // Optional. List data for the given time range.
  79. // If not set, a default time range is used. The field
  80. // <code>time_range_begin</code> in the response will specify the beginning
  81. // of this time range.
  82. // Only <code>ErrorGroupStats</code> with a non-zero count in the given time
  83. // range are returned, unless the request contains an explicit
  84. // <code>group_id</code> list. If a <code>group_id</code> list is given, also
  85. // <code>ErrorGroupStats</code> with zero occurrences are returned.
  86. QueryTimeRange time_range = 5 [(google.api.field_behavior) = OPTIONAL];
  87. // Optional. The preferred duration for a single returned `TimedCount`.
  88. // If not set, no timed counts are returned.
  89. google.protobuf.Duration timed_count_duration = 6 [(google.api.field_behavior) = OPTIONAL];
  90. // Optional. The alignment of the timed counts to be returned.
  91. // Default is `ALIGNMENT_EQUAL_AT_END`.
  92. TimedCountAlignment alignment = 7 [(google.api.field_behavior) = OPTIONAL];
  93. // Optional. Time where the timed counts shall be aligned if rounded
  94. // alignment is chosen. Default is 00:00 UTC.
  95. google.protobuf.Timestamp alignment_time = 8 [(google.api.field_behavior) = OPTIONAL];
  96. // Optional. The sort order in which the results are returned.
  97. // Default is `COUNT_DESC`.
  98. ErrorGroupOrder order = 9 [(google.api.field_behavior) = OPTIONAL];
  99. // Optional. The maximum number of results to return per response.
  100. // Default is 20.
  101. int32 page_size = 11 [(google.api.field_behavior) = OPTIONAL];
  102. // Optional. A `next_page_token` provided by a previous response. To view
  103. // additional results, pass this token along with the identical query
  104. // parameters as the first request.
  105. string page_token = 12 [(google.api.field_behavior) = OPTIONAL];
  106. }
  107. // Contains a set of requested error group stats.
  108. message ListGroupStatsResponse {
  109. // The error group stats which match the given request.
  110. repeated ErrorGroupStats error_group_stats = 1;
  111. // If non-empty, more results are available.
  112. // Pass this token, along with the same query parameters as the first
  113. // request, to view the next page of results.
  114. string next_page_token = 2;
  115. // The timestamp specifies the start time to which the request was restricted.
  116. // The start time is set based on the requested time range. It may be adjusted
  117. // to a later time if a project has exceeded the storage quota and older data
  118. // has been deleted.
  119. google.protobuf.Timestamp time_range_begin = 4;
  120. }
  121. // Data extracted for a specific group based on certain filter criteria,
  122. // such as a given time period and/or service filter.
  123. message ErrorGroupStats {
  124. // Group data that is independent of the filter criteria.
  125. ErrorGroup group = 1;
  126. // Approximate total number of events in the given group that match
  127. // the filter criteria.
  128. int64 count = 2;
  129. // Approximate number of affected users in the given group that
  130. // match the filter criteria.
  131. // Users are distinguished by data in the `ErrorContext` of the
  132. // individual error events, such as their login name or their remote
  133. // IP address in case of HTTP requests.
  134. // The number of affected users can be zero even if the number of
  135. // errors is non-zero if no data was provided from which the
  136. // affected user could be deduced.
  137. // Users are counted based on data in the request
  138. // context that was provided in the error report. If more users are
  139. // implicitly affected, such as due to a crash of the whole service,
  140. // this is not reflected here.
  141. int64 affected_users_count = 3;
  142. // Approximate number of occurrences over time.
  143. // Timed counts returned by ListGroups are guaranteed to be:
  144. //
  145. // - Inside the requested time interval
  146. // - Non-overlapping, and
  147. // - Ordered by ascending time.
  148. repeated TimedCount timed_counts = 4;
  149. // Approximate first occurrence that was ever seen for this group
  150. // and which matches the given filter criteria, ignoring the
  151. // time_range that was specified in the request.
  152. google.protobuf.Timestamp first_seen_time = 5;
  153. // Approximate last occurrence that was ever seen for this group and
  154. // which matches the given filter criteria, ignoring the time_range
  155. // that was specified in the request.
  156. google.protobuf.Timestamp last_seen_time = 6;
  157. // Service contexts with a non-zero error count for the given filter
  158. // criteria. This list can be truncated if multiple services are affected.
  159. // Refer to `num_affected_services` for the total count.
  160. repeated ServiceContext affected_services = 7;
  161. // The total number of services with a non-zero error count for the given
  162. // filter criteria.
  163. int32 num_affected_services = 8;
  164. // An arbitrary event that is chosen as representative for the whole group.
  165. // The representative event is intended to be used as a quick preview for
  166. // the whole group. Events in the group are usually sufficiently similar
  167. // to each other such that showing an arbitrary representative provides
  168. // insight into the characteristics of the group as a whole.
  169. ErrorEvent representative = 9;
  170. }
  171. // The number of errors in a given time period.
  172. // All numbers are approximate since the error events are sampled
  173. // before counting them.
  174. message TimedCount {
  175. // Approximate number of occurrences in the given time period.
  176. int64 count = 1;
  177. // Start of the time period to which `count` refers (included).
  178. google.protobuf.Timestamp start_time = 2;
  179. // End of the time period to which `count` refers (excluded).
  180. google.protobuf.Timestamp end_time = 3;
  181. }
  182. // Specifies how the time periods of error group counts are aligned.
  183. enum TimedCountAlignment {
  184. // No alignment specified.
  185. ERROR_COUNT_ALIGNMENT_UNSPECIFIED = 0;
  186. // The time periods shall be consecutive, have width equal to the
  187. // requested duration, and be aligned at the `alignment_time` provided in
  188. // the request.
  189. // The `alignment_time` does not have to be inside the query period but
  190. // even if it is outside, only time periods are returned which overlap
  191. // with the query period.
  192. // A rounded alignment will typically result in a
  193. // different size of the first or the last time period.
  194. ALIGNMENT_EQUAL_ROUNDED = 1;
  195. // The time periods shall be consecutive, have width equal to the
  196. // requested duration, and be aligned at the end of the requested time
  197. // period. This can result in a different size of the
  198. // first time period.
  199. ALIGNMENT_EQUAL_AT_END = 2;
  200. }
  201. // A sorting order of error groups.
  202. enum ErrorGroupOrder {
  203. // No group order specified.
  204. GROUP_ORDER_UNSPECIFIED = 0;
  205. // Total count of errors in the given time window in descending order.
  206. COUNT_DESC = 1;
  207. // Timestamp when the group was last seen in the given time window
  208. // in descending order.
  209. LAST_SEEN_DESC = 2;
  210. // Timestamp when the group was created in descending order.
  211. CREATED_DESC = 3;
  212. // Number of affected users in the given time window in descending order.
  213. AFFECTED_USERS_DESC = 4;
  214. }
  215. // Specifies a set of error events to return.
  216. message ListEventsRequest {
  217. // Required. The resource name of the Google Cloud Platform project. Written
  218. // as `projects/{projectID}`, where `{projectID}` is the
  219. // [Google Cloud Platform project
  220. // ID](https://support.google.com/cloud/answer/6158840).
  221. //
  222. // Example: `projects/my-project-123`.
  223. string project_name = 1 [
  224. (google.api.field_behavior) = REQUIRED,
  225. (google.api.resource_reference) = {
  226. type: "cloudresourcemanager.googleapis.com/Project"
  227. }
  228. ];
  229. // Required. The group for which events shall be returned.
  230. string group_id = 2 [(google.api.field_behavior) = REQUIRED];
  231. // Optional. List only ErrorGroups which belong to a service context that
  232. // matches the filter.
  233. // Data for all service contexts is returned if this field is not specified.
  234. ServiceContextFilter service_filter = 3 [(google.api.field_behavior) = OPTIONAL];
  235. // Optional. List only data for the given time range.
  236. // If not set a default time range is used. The field time_range_begin
  237. // in the response will specify the beginning of this time range.
  238. QueryTimeRange time_range = 4 [(google.api.field_behavior) = OPTIONAL];
  239. // Optional. The maximum number of results to return per response.
  240. int32 page_size = 6 [(google.api.field_behavior) = OPTIONAL];
  241. // Optional. A `next_page_token` provided by a previous response.
  242. string page_token = 7 [(google.api.field_behavior) = OPTIONAL];
  243. }
  244. // Contains a set of requested error events.
  245. message ListEventsResponse {
  246. // The error events which match the given request.
  247. repeated ErrorEvent error_events = 1;
  248. // If non-empty, more results are available.
  249. // Pass this token, along with the same query parameters as the first
  250. // request, to view the next page of results.
  251. string next_page_token = 2;
  252. // The timestamp specifies the start time to which the request was restricted.
  253. google.protobuf.Timestamp time_range_begin = 4;
  254. }
  255. // Requests might be rejected or the resulting timed count durations might be
  256. // adjusted for lower durations.
  257. message QueryTimeRange {
  258. // The supported time ranges.
  259. enum Period {
  260. // Do not use.
  261. PERIOD_UNSPECIFIED = 0;
  262. // Retrieve data for the last hour.
  263. // Recommended minimum timed count duration: 1 min.
  264. PERIOD_1_HOUR = 1;
  265. // Retrieve data for the last 6 hours.
  266. // Recommended minimum timed count duration: 10 min.
  267. PERIOD_6_HOURS = 2;
  268. // Retrieve data for the last day.
  269. // Recommended minimum timed count duration: 1 hour.
  270. PERIOD_1_DAY = 3;
  271. // Retrieve data for the last week.
  272. // Recommended minimum timed count duration: 6 hours.
  273. PERIOD_1_WEEK = 4;
  274. // Retrieve data for the last 30 days.
  275. // Recommended minimum timed count duration: 1 day.
  276. PERIOD_30_DAYS = 5;
  277. }
  278. // Restricts the query to the specified time range.
  279. Period period = 1;
  280. }
  281. // Specifies criteria for filtering a subset of service contexts.
  282. // The fields in the filter correspond to the fields in `ServiceContext`.
  283. // Only exact, case-sensitive matches are supported.
  284. // If a field is unset or empty, it matches arbitrary values.
  285. message ServiceContextFilter {
  286. // Optional. The exact value to match against
  287. // [`ServiceContext.service`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
  288. string service = 2 [(google.api.field_behavior) = OPTIONAL];
  289. // Optional. The exact value to match against
  290. // [`ServiceContext.version`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
  291. string version = 3 [(google.api.field_behavior) = OPTIONAL];
  292. // Optional. The exact value to match against
  293. // [`ServiceContext.resource_type`](/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type).
  294. string resource_type = 4 [(google.api.field_behavior) = OPTIONAL];
  295. }
  296. // Deletes all events in the project.
  297. message DeleteEventsRequest {
  298. // Required. The resource name of the Google Cloud Platform project. Written
  299. // as `projects/{projectID}`, where `{projectID}` is the
  300. // [Google Cloud Platform project
  301. // ID](https://support.google.com/cloud/answer/6158840).
  302. //
  303. // Example: `projects/my-project-123`.
  304. string project_name = 1 [
  305. (google.api.field_behavior) = REQUIRED,
  306. (google.api.resource_reference) = {
  307. type: "cloudresourcemanager.googleapis.com/Project"
  308. }
  309. ];
  310. }
  311. // Response message for deleting error events.
  312. message DeleteEventsResponse {
  313. }