Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/google/cloud/errorreporting_v1beta1/types/common.py: 100%

43 statements  

« prev     ^ index     » next       coverage.py v7.2.2, created at 2023-03-26 07:30 +0000

1# -*- coding: utf-8 -*- 

2# Copyright 2022 Google LLC 

3# 

4# Licensed under the Apache License, Version 2.0 (the "License"); 

5# you may not use this file except in compliance with the License. 

6# You may obtain a copy of the License at 

7# 

8# http://www.apache.org/licenses/LICENSE-2.0 

9# 

10# Unless required by applicable law or agreed to in writing, software 

11# distributed under the License is distributed on an "AS IS" BASIS, 

12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 

13# See the License for the specific language governing permissions and 

14# limitations under the License. 

15# 

16from __future__ import annotations 

17 

18from typing import MutableMapping, MutableSequence 

19 

20import proto # type: ignore 

21 

22from google.protobuf import timestamp_pb2 # type: ignore 

23 

24 

25__protobuf__ = proto.module( 

26 package="google.devtools.clouderrorreporting.v1beta1", 

27 manifest={ 

28 "ResolutionStatus", 

29 "ErrorGroup", 

30 "TrackingIssue", 

31 "ErrorEvent", 

32 "ServiceContext", 

33 "ErrorContext", 

34 "HttpRequestContext", 

35 "SourceLocation", 

36 }, 

37) 

38 

39 

40class ResolutionStatus(proto.Enum): 

41 r"""Resolution status of an error group. 

42 

43 Values: 

44 RESOLUTION_STATUS_UNSPECIFIED (0): 

45 Status is unknown. When left unspecified in 

46 requests, it is treated like OPEN. 

47 OPEN (1): 

48 The error group is not being addressed. This 

49 is the default for new groups. It is also used 

50 for errors re-occurring after marked RESOLVED. 

51 ACKNOWLEDGED (2): 

52 Error Group manually acknowledged, it can 

53 have an issue link attached. 

54 RESOLVED (3): 

55 Error Group manually resolved, more events 

56 for this group are not expected to occur. 

57 MUTED (4): 

58 The error group is muted and excluded by 

59 default on group stats requests. 

60 """ 

61 RESOLUTION_STATUS_UNSPECIFIED = 0 

62 OPEN = 1 

63 ACKNOWLEDGED = 2 

64 RESOLVED = 3 

65 MUTED = 4 

66 

67 

68class ErrorGroup(proto.Message): 

69 r"""Description of a group of similar error events. 

70 

71 Attributes: 

72 name (str): 

73 The group resource name. 

74 Example: 

75 <code>projects/my-project-123/groups/CNSgkpnppqKCUw</code> 

76 group_id (str): 

77 Group IDs are unique for a given project. If 

78 the same kind of error occurs in different 

79 service contexts, it will receive the same group 

80 ID. 

81 tracking_issues (MutableSequence[google.cloud.errorreporting_v1beta1.types.TrackingIssue]): 

82 Associated tracking issues. 

83 resolution_status (google.cloud.errorreporting_v1beta1.types.ResolutionStatus): 

84 Error group's resolution status. 

85 An unspecified resolution status will be 

86 interpreted as OPEN 

87 """ 

88 

89 name: str = proto.Field( 

90 proto.STRING, 

91 number=1, 

92 ) 

93 group_id: str = proto.Field( 

94 proto.STRING, 

95 number=2, 

96 ) 

97 tracking_issues: MutableSequence["TrackingIssue"] = proto.RepeatedField( 

98 proto.MESSAGE, 

99 number=3, 

100 message="TrackingIssue", 

101 ) 

102 resolution_status: "ResolutionStatus" = proto.Field( 

103 proto.ENUM, 

104 number=5, 

105 enum="ResolutionStatus", 

106 ) 

107 

108 

109class TrackingIssue(proto.Message): 

110 r"""Information related to tracking the progress on resolving the 

111 error. 

112 

113 Attributes: 

114 url (str): 

115 A URL pointing to a related entry in an issue tracking 

116 system. Example: 

117 ``https://github.com/user/project/issues/4`` 

118 """ 

119 

120 url: str = proto.Field( 

121 proto.STRING, 

122 number=1, 

123 ) 

124 

125 

126class ErrorEvent(proto.Message): 

127 r"""An error event which is returned by the Error Reporting 

128 system. 

129 

130 Attributes: 

131 event_time (google.protobuf.timestamp_pb2.Timestamp): 

132 Time when the event occurred as provided in 

133 the error report. If the report did not contain 

134 a timestamp, the time the error was received by 

135 the Error Reporting system is used. 

136 service_context (google.cloud.errorreporting_v1beta1.types.ServiceContext): 

137 The ``ServiceContext`` for which this error was reported. 

138 message (str): 

139 The stack trace that was reported or logged 

140 by the service. 

141 context (google.cloud.errorreporting_v1beta1.types.ErrorContext): 

142 Data about the context in which the error 

143 occurred. 

144 """ 

145 

146 event_time: timestamp_pb2.Timestamp = proto.Field( 

147 proto.MESSAGE, 

148 number=1, 

149 message=timestamp_pb2.Timestamp, 

150 ) 

151 service_context: "ServiceContext" = proto.Field( 

152 proto.MESSAGE, 

153 number=2, 

154 message="ServiceContext", 

155 ) 

156 message: str = proto.Field( 

157 proto.STRING, 

158 number=3, 

159 ) 

160 context: "ErrorContext" = proto.Field( 

161 proto.MESSAGE, 

162 number=5, 

163 message="ErrorContext", 

164 ) 

165 

166 

167class ServiceContext(proto.Message): 

168 r"""Describes a running service that sends errors. 

169 Its version changes over time and multiple versions can run in 

170 parallel. 

171 

172 Attributes: 

173 service (str): 

174 An identifier of the service, such as the name of the 

175 executable, job, or Google App Engine service name. This 

176 field is expected to have a low number of values that are 

177 relatively stable over time, as opposed to ``version``, 

178 which can be changed whenever new code is deployed. 

179 

180 Contains the service name for error reports extracted from 

181 Google App Engine logs or ``default`` if the App Engine 

182 default service is used. 

183 version (str): 

184 Represents the source code version that the 

185 developer provided, which could represent a 

186 version label or a Git SHA-1 hash, for example. 

187 For App Engine standard environment, the version 

188 is set to the version of the app. 

189 resource_type (str): 

190 Type of the MonitoredResource. List of 

191 possible values: 

192 https://cloud.google.com/monitoring/api/resources 

193 Value is set automatically for incoming errors 

194 and must not be set when reporting errors. 

195 """ 

196 

197 service: str = proto.Field( 

198 proto.STRING, 

199 number=2, 

200 ) 

201 version: str = proto.Field( 

202 proto.STRING, 

203 number=3, 

204 ) 

205 resource_type: str = proto.Field( 

206 proto.STRING, 

207 number=4, 

208 ) 

209 

210 

211class ErrorContext(proto.Message): 

212 r"""A description of the context in which an error occurred. 

213 This data should be provided by the application when reporting 

214 an error, unless the 

215 error report has been generated automatically from Google App 

216 Engine logs. 

217 

218 Attributes: 

219 http_request (google.cloud.errorreporting_v1beta1.types.HttpRequestContext): 

220 The HTTP request which was processed when the 

221 error was triggered. 

222 user (str): 

223 The user who caused or was affected by the crash. This can 

224 be a user ID, an email address, or an arbitrary token that 

225 uniquely identifies the user. When sending an error report, 

226 leave this field empty if the user was not logged in. In 

227 this case the Error Reporting system will use other data, 

228 such as remote IP address, to distinguish affected users. 

229 See ``affected_users_count`` in ``ErrorGroupStats``. 

230 report_location (google.cloud.errorreporting_v1beta1.types.SourceLocation): 

231 The location in the source code where the 

232 decision was made to report the error, usually 

233 the place where it was logged. For a logged 

234 exception this would be the source line where 

235 the exception is logged, usually close to the 

236 place where it was caught. 

237 """ 

238 

239 http_request: "HttpRequestContext" = proto.Field( 

240 proto.MESSAGE, 

241 number=1, 

242 message="HttpRequestContext", 

243 ) 

244 user: str = proto.Field( 

245 proto.STRING, 

246 number=2, 

247 ) 

248 report_location: "SourceLocation" = proto.Field( 

249 proto.MESSAGE, 

250 number=3, 

251 message="SourceLocation", 

252 ) 

253 

254 

255class HttpRequestContext(proto.Message): 

256 r"""HTTP request data that is related to a reported error. 

257 This data should be provided by the application when reporting 

258 an error, unless the 

259 error report has been generated automatically from Google App 

260 Engine logs. 

261 

262 Attributes: 

263 method (str): 

264 The type of HTTP request, such as ``GET``, ``POST``, etc. 

265 url (str): 

266 The URL of the request. 

267 user_agent (str): 

268 The user agent information that is provided 

269 with the request. 

270 referrer (str): 

271 The referrer information that is provided 

272 with the request. 

273 response_status_code (int): 

274 The HTTP response status code for the 

275 request. 

276 remote_ip (str): 

277 The IP address from which the request 

278 originated. This can be IPv4, IPv6, or a token 

279 which is derived from the IP address, depending 

280 on the data that has been provided in the error 

281 report. 

282 """ 

283 

284 method: str = proto.Field( 

285 proto.STRING, 

286 number=1, 

287 ) 

288 url: str = proto.Field( 

289 proto.STRING, 

290 number=2, 

291 ) 

292 user_agent: str = proto.Field( 

293 proto.STRING, 

294 number=3, 

295 ) 

296 referrer: str = proto.Field( 

297 proto.STRING, 

298 number=4, 

299 ) 

300 response_status_code: int = proto.Field( 

301 proto.INT32, 

302 number=5, 

303 ) 

304 remote_ip: str = proto.Field( 

305 proto.STRING, 

306 number=6, 

307 ) 

308 

309 

310class SourceLocation(proto.Message): 

311 r"""Indicates a location in the source code of the service for which 

312 errors are reported. ``functionName`` must be provided by the 

313 application when reporting an error, unless the error report 

314 contains a ``message`` with a supported exception stack trace. All 

315 fields are optional for the later case. 

316 

317 Attributes: 

318 file_path (str): 

319 The source code filename, which can include a 

320 truncated relative path, or a full path from a 

321 production machine. 

322 line_number (int): 

323 1-based. 0 indicates that the line number is 

324 unknown. 

325 function_name (str): 

326 Human-readable name of a function or method. The value can 

327 include optional context like the class or package name. For 

328 example, ``my.package.MyClass.method`` in case of Java. 

329 """ 

330 

331 file_path: str = proto.Field( 

332 proto.STRING, 

333 number=1, 

334 ) 

335 line_number: int = proto.Field( 

336 proto.INT32, 

337 number=2, 

338 ) 

339 function_name: str = proto.Field( 

340 proto.STRING, 

341 number=4, 

342 ) 

343 

344 

345__all__ = tuple(sorted(__protobuf__.manifest))