google-cloud-error_reporting 0.35.1 → 0.42.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -2
  3. data/CHANGELOG.md +47 -0
  4. data/CONTRIBUTING.md +4 -7
  5. data/LOGGING.md +1 -1
  6. data/OVERVIEW.md +1 -2
  7. data/TROUBLESHOOTING.md +2 -8
  8. data/lib/google-cloud-error_reporting.rb +8 -14
  9. data/lib/google/cloud/error_reporting.rb +16 -13
  10. data/lib/google/cloud/error_reporting/async_error_reporter.rb +2 -2
  11. data/lib/google/cloud/error_reporting/credentials.rb +2 -2
  12. data/lib/google/cloud/error_reporting/error_event.rb +14 -18
  13. data/lib/google/cloud/error_reporting/middleware.rb +8 -13
  14. data/lib/google/cloud/error_reporting/rails.rb +2 -2
  15. data/lib/google/cloud/error_reporting/service.rb +15 -36
  16. data/lib/google/cloud/error_reporting/version.rb +1 -1
  17. metadata +11 -72
  18. data/lib/google/cloud/error_reporting/v1beta1.rb +0 -19
  19. data/lib/google/cloud/error_reporting/v1beta1/credentials.rb +0 -41
  20. data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/common.rb +0 -158
  21. data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/error_group_service.rb +0 -41
  22. data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/error_stats_service.rb +0 -314
  23. data/lib/google/cloud/error_reporting/v1beta1/doc/google/devtools/clouderrorreporting/v1beta1/report_errors_service.rb +0 -79
  24. data/lib/google/cloud/error_reporting/v1beta1/doc/google/protobuf/duration.rb +0 -91
  25. data/lib/google/cloud/error_reporting/v1beta1/doc/google/protobuf/timestamp.rb +0 -113
  26. data/lib/google/cloud/error_reporting/v1beta1/error_group_service_client.rb +0 -285
  27. data/lib/google/cloud/error_reporting/v1beta1/error_group_service_client_config.json +0 -36
  28. data/lib/google/cloud/error_reporting/v1beta1/error_stats_service_client.rb +0 -457
  29. data/lib/google/cloud/error_reporting/v1beta1/error_stats_service_client_config.json +0 -41
  30. data/lib/google/cloud/error_reporting/v1beta1/report_errors_service_client.rb +0 -254
  31. data/lib/google/cloud/error_reporting/v1beta1/report_errors_service_client_config.json +0 -31
  32. data/lib/google/devtools/clouderrorreporting/v1beta1/common_pb.rb +0 -64
  33. data/lib/google/devtools/clouderrorreporting/v1beta1/error_group_service_pb.rb +0 -30
  34. data/lib/google/devtools/clouderrorreporting/v1beta1/error_group_service_services_pb.rb +0 -50
  35. data/lib/google/devtools/clouderrorreporting/v1beta1/error_stats_service_pb.rb +0 -116
  36. data/lib/google/devtools/clouderrorreporting/v1beta1/error_stats_service_services_pb.rb +0 -52
  37. data/lib/google/devtools/clouderrorreporting/v1beta1/report_errors_service_pb.rb +0 -38
  38. data/lib/google/devtools/clouderrorreporting/v1beta1/report_errors_service_services_pb.rb +0 -55
@@ -1,41 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
15
-
16
- module Google
17
- module Devtools
18
- module Clouderrorreporting
19
- module V1beta1
20
- # A request to return an individual group.
21
- # @!attribute [rw] group_name
22
- # @return [String]
23
- # Required. The group resource name. Written as
24
- # <code>projects/<var>projectID</var>/groups/<var>group_name</var></code>.
25
- # Call
26
- # <a href="/error-reporting/reference/rest/v1beta1/projects.groupStats/list">
27
- # <code>groupStats.list</code></a> to return a list of groups belonging to
28
- # this project.
29
- #
30
- # Example: <code>projects/my-project-123/groups/my-group</code>
31
- class GetGroupRequest; end
32
-
33
- # A request to replace the existing data for the given group.
34
- # @!attribute [rw] group
35
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
36
- # Required. The group which replaces the resource on the server.
37
- class UpdateGroupRequest; end
38
- end
39
- end
40
- end
41
- end
@@ -1,314 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
15
-
16
- module Google
17
- module Devtools
18
- module Clouderrorreporting
19
- module V1beta1
20
- # Specifies a set of `ErrorGroupStats` to return.
21
- # @!attribute [rw] project_name
22
- # @return [String]
23
- # Required. The resource name of the Google Cloud Platform project. Written
24
- # as <code>projects/</code> plus the
25
- # <a href="https://support.google.com/cloud/answer/6158840">Google Cloud
26
- # Platform project ID</a>.
27
- #
28
- # Example: <code>projects/my-project-123</code>.
29
- # @!attribute [rw] group_id
30
- # @return [Array<String>]
31
- # Optional. List all <code>ErrorGroupStats</code> with these IDs.
32
- # @!attribute [rw] service_filter
33
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ServiceContextFilter]
34
- # Optional. List only <code>ErrorGroupStats</code> which belong to a service
35
- # context that matches the filter.
36
- # Data for all service contexts is returned if this field is not specified.
37
- # @!attribute [rw] time_range
38
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange]
39
- # Optional. List data for the given time range.
40
- # If not set, a default time range is used. The field
41
- # <code>time_range_begin</code> in the response will specify the beginning
42
- # of this time range.
43
- # Only <code>ErrorGroupStats</code> with a non-zero count in the given time
44
- # range are returned, unless the request contains an explicit
45
- # <code>group_id</code> list. If a <code>group_id</code> list is given, also
46
- # <code>ErrorGroupStats</code> with zero occurrences are returned.
47
- # @!attribute [rw] timed_count_duration
48
- # @return [Google::Protobuf::Duration]
49
- # Optional. The preferred duration for a single returned `TimedCount`.
50
- # If not set, no timed counts are returned.
51
- # @!attribute [rw] alignment
52
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::TimedCountAlignment]
53
- # Optional. The alignment of the timed counts to be returned.
54
- # Default is `ALIGNMENT_EQUAL_AT_END`.
55
- # @!attribute [rw] alignment_time
56
- # @return [Google::Protobuf::Timestamp]
57
- # Optional. Time where the timed counts shall be aligned if rounded
58
- # alignment is chosen. Default is 00:00 UTC.
59
- # @!attribute [rw] order
60
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupOrder]
61
- # Optional. The sort order in which the results are returned.
62
- # Default is `COUNT_DESC`.
63
- # @!attribute [rw] page_size
64
- # @return [Integer]
65
- # Optional. The maximum number of results to return per response.
66
- # Default is 20.
67
- # @!attribute [rw] page_token
68
- # @return [String]
69
- # Optional. A `next_page_token` provided by a previous response. To view
70
- # additional results, pass this token along with the identical query
71
- # parameters as the first request.
72
- class ListGroupStatsRequest; end
73
-
74
- # Contains a set of requested error group stats.
75
- # @!attribute [rw] error_group_stats
76
- # @return [Array<Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroupStats>]
77
- # The error group stats which match the given request.
78
- # @!attribute [rw] next_page_token
79
- # @return [String]
80
- # If non-empty, more results are available.
81
- # Pass this token, along with the same query parameters as the first
82
- # request, to view the next page of results.
83
- # @!attribute [rw] time_range_begin
84
- # @return [Google::Protobuf::Timestamp]
85
- # The timestamp specifies the start time to which the request was restricted.
86
- # The start time is set based on the requested time range. It may be adjusted
87
- # to a later time if a project has exceeded the storage quota and older data
88
- # has been deleted.
89
- class ListGroupStatsResponse; end
90
-
91
- # Data extracted for a specific group based on certain filter criteria,
92
- # such as a given time period and/or service filter.
93
- # @!attribute [rw] group
94
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorGroup]
95
- # Group data that is independent of the filter criteria.
96
- # @!attribute [rw] count
97
- # @return [Integer]
98
- # Approximate total number of events in the given group that match
99
- # the filter criteria.
100
- # @!attribute [rw] affected_users_count
101
- # @return [Integer]
102
- # Approximate number of affected users in the given group that
103
- # match the filter criteria.
104
- # Users are distinguished by data in the `ErrorContext` of the
105
- # individual error events, such as their login name or their remote
106
- # IP address in case of HTTP requests.
107
- # The number of affected users can be zero even if the number of
108
- # errors is non-zero if no data was provided from which the
109
- # affected user could be deduced.
110
- # Users are counted based on data in the request
111
- # context that was provided in the error report. If more users are
112
- # implicitly affected, such as due to a crash of the whole service,
113
- # this is not reflected here.
114
- # @!attribute [rw] timed_counts
115
- # @return [Array<Google::Devtools::Clouderrorreporting::V1beta1::TimedCount>]
116
- # Approximate number of occurrences over time.
117
- # Timed counts returned by ListGroups are guaranteed to be:
118
- #
119
- # * Inside the requested time interval
120
- # * Non-overlapping, and
121
- # * Ordered by ascending time.
122
- # @!attribute [rw] first_seen_time
123
- # @return [Google::Protobuf::Timestamp]
124
- # Approximate first occurrence that was ever seen for this group
125
- # and which matches the given filter criteria, ignoring the
126
- # time_range that was specified in the request.
127
- # @!attribute [rw] last_seen_time
128
- # @return [Google::Protobuf::Timestamp]
129
- # Approximate last occurrence that was ever seen for this group and
130
- # which matches the given filter criteria, ignoring the time_range
131
- # that was specified in the request.
132
- # @!attribute [rw] affected_services
133
- # @return [Array<Google::Devtools::Clouderrorreporting::V1beta1::ServiceContext>]
134
- # Service contexts with a non-zero error count for the given filter
135
- # criteria. This list can be truncated if multiple services are affected.
136
- # Refer to `num_affected_services` for the total count.
137
- # @!attribute [rw] num_affected_services
138
- # @return [Integer]
139
- # The total number of services with a non-zero error count for the given
140
- # filter criteria.
141
- # @!attribute [rw] representative
142
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorEvent]
143
- # An arbitrary event that is chosen as representative for the whole group.
144
- # The representative event is intended to be used as a quick preview for
145
- # the whole group. Events in the group are usually sufficiently similar
146
- # to each other such that showing an arbitrary representative provides
147
- # insight into the characteristics of the group as a whole.
148
- class ErrorGroupStats; end
149
-
150
- # The number of errors in a given time period.
151
- # All numbers are approximate since the error events are sampled
152
- # before counting them.
153
- # @!attribute [rw] count
154
- # @return [Integer]
155
- # Approximate number of occurrences in the given time period.
156
- # @!attribute [rw] start_time
157
- # @return [Google::Protobuf::Timestamp]
158
- # Start of the time period to which `count` refers (included).
159
- # @!attribute [rw] end_time
160
- # @return [Google::Protobuf::Timestamp]
161
- # End of the time period to which `count` refers (excluded).
162
- class TimedCount; end
163
-
164
- # Specifies a set of error events to return.
165
- # @!attribute [rw] project_name
166
- # @return [String]
167
- # Required. The resource name of the Google Cloud Platform project. Written
168
- # as `projects/` plus the
169
- # [Google Cloud Platform project
170
- # ID](https://support.google.com/cloud/answer/6158840).
171
- # Example: `projects/my-project-123`.
172
- # @!attribute [rw] group_id
173
- # @return [String]
174
- # Required. The group for which events shall be returned.
175
- # @!attribute [rw] service_filter
176
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ServiceContextFilter]
177
- # Optional. List only ErrorGroups which belong to a service context that
178
- # matches the filter.
179
- # Data for all service contexts is returned if this field is not specified.
180
- # @!attribute [rw] time_range
181
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange]
182
- # Optional. List only data for the given time range.
183
- # If not set a default time range is used. The field time_range_begin
184
- # in the response will specify the beginning of this time range.
185
- # @!attribute [rw] page_size
186
- # @return [Integer]
187
- # Optional. The maximum number of results to return per response.
188
- # @!attribute [rw] page_token
189
- # @return [String]
190
- # Optional. A `next_page_token` provided by a previous response.
191
- class ListEventsRequest; end
192
-
193
- # Contains a set of requested error events.
194
- # @!attribute [rw] error_events
195
- # @return [Array<Google::Devtools::Clouderrorreporting::V1beta1::ErrorEvent>]
196
- # The error events which match the given request.
197
- # @!attribute [rw] next_page_token
198
- # @return [String]
199
- # If non-empty, more results are available.
200
- # Pass this token, along with the same query parameters as the first
201
- # request, to view the next page of results.
202
- # @!attribute [rw] time_range_begin
203
- # @return [Google::Protobuf::Timestamp]
204
- # The timestamp specifies the start time to which the request was restricted.
205
- class ListEventsResponse; end
206
-
207
- # Requests might be rejected or the resulting timed count durations might be
208
- # adjusted for lower durations.
209
- # @!attribute [rw] period
210
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::QueryTimeRange::Period]
211
- # Restricts the query to the specified time range.
212
- class QueryTimeRange
213
- # The supported time ranges.
214
- module Period
215
- # Do not use.
216
- PERIOD_UNSPECIFIED = 0
217
-
218
- # Retrieve data for the last hour.
219
- # Recommended minimum timed count duration: 1 min.
220
- PERIOD_1_HOUR = 1
221
-
222
- # Retrieve data for the last 6 hours.
223
- # Recommended minimum timed count duration: 10 min.
224
- PERIOD_6_HOURS = 2
225
-
226
- # Retrieve data for the last day.
227
- # Recommended minimum timed count duration: 1 hour.
228
- PERIOD_1_DAY = 3
229
-
230
- # Retrieve data for the last week.
231
- # Recommended minimum timed count duration: 6 hours.
232
- PERIOD_1_WEEK = 4
233
-
234
- # Retrieve data for the last 30 days.
235
- # Recommended minimum timed count duration: 1 day.
236
- PERIOD_30_DAYS = 5
237
- end
238
- end
239
-
240
- # Specifies criteria for filtering a subset of service contexts.
241
- # The fields in the filter correspond to the fields in `ServiceContext`.
242
- # Only exact, case-sensitive matches are supported.
243
- # If a field is unset or empty, it matches arbitrary values.
244
- # @!attribute [rw] service
245
- # @return [String]
246
- # Optional. The exact value to match against
247
- # [`ServiceContext.service`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.service).
248
- # @!attribute [rw] version
249
- # @return [String]
250
- # Optional. The exact value to match against
251
- # [`ServiceContext.version`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.version).
252
- # @!attribute [rw] resource_type
253
- # @return [String]
254
- # Optional. The exact value to match against
255
- # [`ServiceContext.resource_type`](https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext#FIELDS.resource_type).
256
- class ServiceContextFilter; end
257
-
258
- # Deletes all events in the project.
259
- # @!attribute [rw] project_name
260
- # @return [String]
261
- # Required. The resource name of the Google Cloud Platform project. Written
262
- # as `projects/` plus the
263
- # [Google Cloud Platform project
264
- # ID](https://support.google.com/cloud/answer/6158840).
265
- # Example: `projects/my-project-123`.
266
- class DeleteEventsRequest; end
267
-
268
- # Response message for deleting error events.
269
- class DeleteEventsResponse; end
270
-
271
- # A sorting order of error groups.
272
- module ErrorGroupOrder
273
- # No group order specified.
274
- GROUP_ORDER_UNSPECIFIED = 0
275
-
276
- # Total count of errors in the given time window in descending order.
277
- COUNT_DESC = 1
278
-
279
- # Timestamp when the group was last seen in the given time window
280
- # in descending order.
281
- LAST_SEEN_DESC = 2
282
-
283
- # Timestamp when the group was created in descending order.
284
- CREATED_DESC = 3
285
-
286
- # Number of affected users in the given time window in descending order.
287
- AFFECTED_USERS_DESC = 4
288
- end
289
-
290
- # Specifies how the time periods of error group counts are aligned.
291
- module TimedCountAlignment
292
- # No alignment specified.
293
- ERROR_COUNT_ALIGNMENT_UNSPECIFIED = 0
294
-
295
- # The time periods shall be consecutive, have width equal to the
296
- # requested duration, and be aligned at the `alignment_time` provided in
297
- # the request.
298
- # The `alignment_time` does not have to be inside the query period but
299
- # even if it is outside, only time periods are returned which overlap
300
- # with the query period.
301
- # A rounded alignment will typically result in a
302
- # different size of the first or the last time period.
303
- ALIGNMENT_EQUAL_ROUNDED = 1
304
-
305
- # The time periods shall be consecutive, have width equal to the
306
- # requested duration, and be aligned at the end of the requested time
307
- # period. This can result in a different size of the
308
- # first time period.
309
- ALIGNMENT_EQUAL_AT_END = 2
310
- end
311
- end
312
- end
313
- end
314
- end
@@ -1,79 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
15
-
16
- module Google
17
- module Devtools
18
- module Clouderrorreporting
19
- module V1beta1
20
- # A request for reporting an individual error event.
21
- # @!attribute [rw] project_name
22
- # @return [String]
23
- # Required. The resource name of the Google Cloud Platform project. Written
24
- # as `projects/` plus the
25
- # [Google Cloud Platform project
26
- # ID](https://support.google.com/cloud/answer/6158840). Example:
27
- # `projects/my-project-123`.
28
- # @!attribute [rw] event
29
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ReportedErrorEvent]
30
- # Required. The error event to be reported.
31
- class ReportErrorEventRequest; end
32
-
33
- # Response for reporting an individual error event.
34
- # Data may be added to this message in the future.
35
- class ReportErrorEventResponse; end
36
-
37
- # An error event which is reported to the Error Reporting system.
38
- # @!attribute [rw] event_time
39
- # @return [Google::Protobuf::Timestamp]
40
- # Optional. Time when the event occurred.
41
- # If not provided, the time when the event was received by the
42
- # Error Reporting system will be used.
43
- # @!attribute [rw] service_context
44
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ServiceContext]
45
- # Required. The service context in which this error has occurred.
46
- # @!attribute [rw] message
47
- # @return [String]
48
- # Required. The error message.
49
- # If no `context.reportLocation` is provided, the message must contain a
50
- # header (typically consisting of the exception type name and an error
51
- # message) and an exception stack trace in one of the supported programming
52
- # languages and formats.
53
- # Supported languages are Java, Python, JavaScript, Ruby, C#, PHP, and Go.
54
- # Supported stack trace formats are:
55
- #
56
- # * **Java**: Must be the return value of
57
- # [`Throwable.printStackTrace()`](https://docs.oracle.com/javase/7/docs/api/java/lang/Throwable.html#printStackTrace%28%29).
58
- # * **Python**: Must be the return value of
59
- # [`traceback.format_exc()`](https://docs.python.org/2/library/traceback.html#traceback.format_exc).
60
- # * **JavaScript**: Must be the value of
61
- # [`error.stack`](https://github.com/v8/v8/wiki/Stack-Trace-API) as returned
62
- # by V8.
63
- # * **Ruby**: Must contain frames returned by
64
- # [`Exception.backtrace`](https://ruby-doc.org/core-2.2.0/Exception.html#method-i-backtrace).
65
- # * **C#**: Must be the return value of
66
- # [`Exception.ToString()`](https://msdn.microsoft.com/en-us/library/system.exception.tostring.aspx).
67
- # * **PHP**: Must start with `PHP (Notice|Parse error|Fatal error|Warning)`
68
- # and contain the result of
69
- # [`(string)$exception`](http://php.net/manual/en/exception.tostring.php).
70
- # * **Go**: Must be the return value of
71
- # [`runtime.Stack()`](https://golang.org/pkg/runtime/debug/#Stack).
72
- # @!attribute [rw] context
73
- # @return [Google::Devtools::Clouderrorreporting::V1beta1::ErrorContext]
74
- # Optional. A description of the context in which the error occurred.
75
- class ReportedErrorEvent; end
76
- end
77
- end
78
- end
79
- end
@@ -1,91 +0,0 @@
1
- # Copyright 2020 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
- # https://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
-
15
-
16
- module Google
17
- module Protobuf
18
- # A Duration represents a signed, fixed-length span of time represented
19
- # as a count of seconds and fractions of seconds at nanosecond
20
- # resolution. It is independent of any calendar and concepts like "day"
21
- # or "month". It is related to Timestamp in that the difference between
22
- # two Timestamp values is a Duration and it can be added or subtracted
23
- # from a Timestamp. Range is approximately +-10,000 years.
24
- #
25
- # = Examples
26
- #
27
- # Example 1: Compute Duration from two Timestamps in pseudo code.
28
- #
29
- # Timestamp start = ...;
30
- # Timestamp end = ...;
31
- # Duration duration = ...;
32
- #
33
- # duration.seconds = end.seconds - start.seconds;
34
- # duration.nanos = end.nanos - start.nanos;
35
- #
36
- # if (duration.seconds < 0 && duration.nanos > 0) {
37
- # duration.seconds += 1;
38
- # duration.nanos -= 1000000000;
39
- # } else if (durations.seconds > 0 && duration.nanos < 0) {
40
- # duration.seconds -= 1;
41
- # duration.nanos += 1000000000;
42
- # }
43
- #
44
- # Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
45
- #
46
- # Timestamp start = ...;
47
- # Duration duration = ...;
48
- # Timestamp end = ...;
49
- #
50
- # end.seconds = start.seconds + duration.seconds;
51
- # end.nanos = start.nanos + duration.nanos;
52
- #
53
- # if (end.nanos < 0) {
54
- # end.seconds -= 1;
55
- # end.nanos += 1000000000;
56
- # } else if (end.nanos >= 1000000000) {
57
- # end.seconds += 1;
58
- # end.nanos -= 1000000000;
59
- # }
60
- #
61
- # Example 3: Compute Duration from datetime.timedelta in Python.
62
- #
63
- # td = datetime.timedelta(days=3, minutes=10)
64
- # duration = Duration()
65
- # duration.FromTimedelta(td)
66
- #
67
- # = JSON Mapping
68
- #
69
- # In JSON format, the Duration type is encoded as a string rather than an
70
- # object, where the string ends in the suffix "s" (indicating seconds) and
71
- # is preceded by the number of seconds, with nanoseconds expressed as
72
- # fractional seconds. For example, 3 seconds with 0 nanoseconds should be
73
- # encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
74
- # be expressed in JSON format as "3.000000001s", and 3 seconds and 1
75
- # microsecond should be expressed in JSON format as "3.000001s".
76
- # @!attribute [rw] seconds
77
- # @return [Integer]
78
- # Signed seconds of the span of time. Must be from -315,576,000,000
79
- # to +315,576,000,000 inclusive. Note: these bounds are computed from:
80
- # 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
81
- # @!attribute [rw] nanos
82
- # @return [Integer]
83
- # Signed fractions of a second at nanosecond resolution of the span
84
- # of time. Durations less than one second are represented with a 0
85
- # `seconds` field and a positive or negative `nanos` field. For durations
86
- # of one second or more, a non-zero value for the `nanos` field must be
87
- # of the same sign as the `seconds` field. Must be from -999,999,999
88
- # to +999,999,999 inclusive.
89
- class Duration; end
90
- end
91
- end