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

53 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 typing import MutableMapping, MutableSequence 

17 

18from google.logging.type import log_severity_pb2 # type: ignore 

19from google.protobuf import duration_pb2 # type: ignore 

20from google.protobuf import timestamp_pb2 # type: ignore 

21import proto # type: ignore 

22 

23__protobuf__ = proto.module( 

24 package="google.appengine.logging.v1", 

25 manifest={ 

26 "LogLine", 

27 "SourceLocation", 

28 "SourceReference", 

29 "RequestLog", 

30 }, 

31) 

32 

33 

34class LogLine(proto.Message): 

35 r"""Application log line emitted while processing a request. 

36 

37 Attributes: 

38 time (google.protobuf.timestamp_pb2.Timestamp): 

39 Approximate time when this log entry was 

40 made. 

41 severity (google.logging.type.log_severity_pb2.LogSeverity): 

42 Severity of this log entry. 

43 log_message (str): 

44 App-provided log message. 

45 source_location (google.cloud.appengine_logging_v1.types.SourceLocation): 

46 Where in the source code this log message was 

47 written. 

48 """ 

49 

50 time: timestamp_pb2.Timestamp = proto.Field( 

51 proto.MESSAGE, 

52 number=1, 

53 message=timestamp_pb2.Timestamp, 

54 ) 

55 severity: log_severity_pb2.LogSeverity = proto.Field( 

56 proto.ENUM, 

57 number=2, 

58 enum=log_severity_pb2.LogSeverity, 

59 ) 

60 log_message: str = proto.Field( 

61 proto.STRING, 

62 number=3, 

63 ) 

64 source_location: "SourceLocation" = proto.Field( 

65 proto.MESSAGE, 

66 number=4, 

67 message="SourceLocation", 

68 ) 

69 

70 

71class SourceLocation(proto.Message): 

72 r"""Specifies a location in a source code file. 

73 

74 Attributes: 

75 file (str): 

76 Source file name. Depending on the runtime 

77 environment, this might be a simple name or a 

78 fully-qualified name. 

79 line (int): 

80 Line within the source file. 

81 function_name (str): 

82 Human-readable name of the function or method being invoked, 

83 with optional context such as the class or package name. 

84 This information is used in contexts such as the logs 

85 viewer, where a file and line number are less meaningful. 

86 The format can vary by language. For example: 

87 ``qual.if.ied.Class.method`` (Java), ``dir/package.func`` 

88 (Go), ``function`` (Python). 

89 """ 

90 

91 file: str = proto.Field( 

92 proto.STRING, 

93 number=1, 

94 ) 

95 line: int = proto.Field( 

96 proto.INT64, 

97 number=2, 

98 ) 

99 function_name: str = proto.Field( 

100 proto.STRING, 

101 number=3, 

102 ) 

103 

104 

105class SourceReference(proto.Message): 

106 r"""A reference to a particular snapshot of the source tree used 

107 to build and deploy an application. 

108 

109 Attributes: 

110 repository (str): 

111 Optional. A URI string identifying the 

112 repository. Example: 

113 "https://github.com/GoogleCloudPlatform/kubernetes.git". 

114 revision_id (str): 

115 The canonical and persistent identifier of 

116 the deployed revision. Example (git): 

117 "0035781c50ec7aa23385dc841529ce8a4b70db1b". 

118 """ 

119 

120 repository: str = proto.Field( 

121 proto.STRING, 

122 number=1, 

123 ) 

124 revision_id: str = proto.Field( 

125 proto.STRING, 

126 number=2, 

127 ) 

128 

129 

130class RequestLog(proto.Message): 

131 r"""Complete log information about a single HTTP request to an 

132 App Engine application. 

133 

134 Attributes: 

135 app_id (str): 

136 Application that handled this request. 

137 module_id (str): 

138 Module of the application that handled this 

139 request. 

140 version_id (str): 

141 Version of the application that handled this 

142 request. 

143 request_id (str): 

144 Globally unique identifier for a request, 

145 which is based on the request start time. 

146 Request IDs for requests which started later 

147 will compare greater as strings than those for 

148 requests which started earlier. 

149 ip (str): 

150 Origin IP address. 

151 start_time (google.protobuf.timestamp_pb2.Timestamp): 

152 Time when the request started. 

153 end_time (google.protobuf.timestamp_pb2.Timestamp): 

154 Time when the request finished. 

155 latency (google.protobuf.duration_pb2.Duration): 

156 Latency of the request. 

157 mega_cycles (int): 

158 Number of CPU megacycles used to process 

159 request. 

160 method (str): 

161 Request method. Example: ``"GET"``, ``"HEAD"``, ``"PUT"``, 

162 ``"POST"``, ``"DELETE"``. 

163 resource (str): 

164 Contains the path and query portion of the URL that was 

165 requested. For example, if the URL was 

166 "http://example.com/app?name=val", the resource would be 

167 "/app?name=val". The fragment identifier, which is 

168 identified by the ``#`` character, is not included. 

169 http_version (str): 

170 HTTP version of request. Example: ``"HTTP/1.1"``. 

171 status (int): 

172 HTTP response status code. Example: 200, 404. 

173 response_size (int): 

174 Size in bytes sent back to client by request. 

175 referrer (str): 

176 Referrer URL of request. 

177 user_agent (str): 

178 User agent that made the request. 

179 nickname (str): 

180 The logged-in user who made the request. 

181 

182 Most likely, this is the part of the user's email before the 

183 ``@`` sign. The field value is the same for different 

184 requests from the same user, but different users can have 

185 similar names. This information is also available to the 

186 application via the App Engine Users API. 

187 

188 This field will be populated starting with App Engine 

189 1.9.21. 

190 url_map_entry (str): 

191 File or class that handled the request. 

192 host (str): 

193 Internet host and port number of the resource 

194 being requested. 

195 cost (float): 

196 An indication of the relative cost of serving 

197 this request. 

198 task_queue_name (str): 

199 Queue name of the request, in the case of an 

200 offline request. 

201 task_name (str): 

202 Task name of the request, in the case of an 

203 offline request. 

204 was_loading_request (bool): 

205 Whether this was a loading request for the 

206 instance. 

207 pending_time (google.protobuf.duration_pb2.Duration): 

208 Time this request spent in the pending 

209 request queue. 

210 instance_index (int): 

211 If the instance processing this request 

212 belongs to a manually scaled module, then this 

213 is the 0-based index of the instance. Otherwise, 

214 this value is -1. 

215 finished (bool): 

216 Whether this request is finished or active. 

217 first (bool): 

218 Whether this is the first ``RequestLog`` entry for this 

219 request. If an active request has several ``RequestLog`` 

220 entries written to Stackdriver Logging, then this field will 

221 be set for one of them. 

222 instance_id (str): 

223 An identifier for the instance that handled 

224 the request. 

225 line (MutableSequence[google.cloud.appengine_logging_v1.types.LogLine]): 

226 A list of log lines emitted by the 

227 application while serving this request. 

228 app_engine_release (str): 

229 App Engine release version. 

230 trace_id (str): 

231 Stackdriver Trace identifier for this 

232 request. 

233 trace_sampled (bool): 

234 If true, the value in the 'trace_id' field was sampled for 

235 storage in a trace backend. 

236 source_reference (MutableSequence[google.cloud.appengine_logging_v1.types.SourceReference]): 

237 Source code for the application that handled 

238 this request. There can be more than one source 

239 reference per deployed application if source 

240 code is distributed among multiple repositories. 

241 """ 

242 

243 app_id: str = proto.Field( 

244 proto.STRING, 

245 number=1, 

246 ) 

247 module_id: str = proto.Field( 

248 proto.STRING, 

249 number=37, 

250 ) 

251 version_id: str = proto.Field( 

252 proto.STRING, 

253 number=2, 

254 ) 

255 request_id: str = proto.Field( 

256 proto.STRING, 

257 number=3, 

258 ) 

259 ip: str = proto.Field( 

260 proto.STRING, 

261 number=4, 

262 ) 

263 start_time: timestamp_pb2.Timestamp = proto.Field( 

264 proto.MESSAGE, 

265 number=6, 

266 message=timestamp_pb2.Timestamp, 

267 ) 

268 end_time: timestamp_pb2.Timestamp = proto.Field( 

269 proto.MESSAGE, 

270 number=7, 

271 message=timestamp_pb2.Timestamp, 

272 ) 

273 latency: duration_pb2.Duration = proto.Field( 

274 proto.MESSAGE, 

275 number=8, 

276 message=duration_pb2.Duration, 

277 ) 

278 mega_cycles: int = proto.Field( 

279 proto.INT64, 

280 number=9, 

281 ) 

282 method: str = proto.Field( 

283 proto.STRING, 

284 number=10, 

285 ) 

286 resource: str = proto.Field( 

287 proto.STRING, 

288 number=11, 

289 ) 

290 http_version: str = proto.Field( 

291 proto.STRING, 

292 number=12, 

293 ) 

294 status: int = proto.Field( 

295 proto.INT32, 

296 number=13, 

297 ) 

298 response_size: int = proto.Field( 

299 proto.INT64, 

300 number=14, 

301 ) 

302 referrer: str = proto.Field( 

303 proto.STRING, 

304 number=15, 

305 ) 

306 user_agent: str = proto.Field( 

307 proto.STRING, 

308 number=16, 

309 ) 

310 nickname: str = proto.Field( 

311 proto.STRING, 

312 number=40, 

313 ) 

314 url_map_entry: str = proto.Field( 

315 proto.STRING, 

316 number=17, 

317 ) 

318 host: str = proto.Field( 

319 proto.STRING, 

320 number=20, 

321 ) 

322 cost: float = proto.Field( 

323 proto.DOUBLE, 

324 number=21, 

325 ) 

326 task_queue_name: str = proto.Field( 

327 proto.STRING, 

328 number=22, 

329 ) 

330 task_name: str = proto.Field( 

331 proto.STRING, 

332 number=23, 

333 ) 

334 was_loading_request: bool = proto.Field( 

335 proto.BOOL, 

336 number=24, 

337 ) 

338 pending_time: duration_pb2.Duration = proto.Field( 

339 proto.MESSAGE, 

340 number=25, 

341 message=duration_pb2.Duration, 

342 ) 

343 instance_index: int = proto.Field( 

344 proto.INT32, 

345 number=26, 

346 ) 

347 finished: bool = proto.Field( 

348 proto.BOOL, 

349 number=27, 

350 ) 

351 first: bool = proto.Field( 

352 proto.BOOL, 

353 number=42, 

354 ) 

355 instance_id: str = proto.Field( 

356 proto.STRING, 

357 number=28, 

358 ) 

359 line: MutableSequence["LogLine"] = proto.RepeatedField( 

360 proto.MESSAGE, 

361 number=29, 

362 message="LogLine", 

363 ) 

364 app_engine_release: str = proto.Field( 

365 proto.STRING, 

366 number=38, 

367 ) 

368 trace_id: str = proto.Field( 

369 proto.STRING, 

370 number=39, 

371 ) 

372 trace_sampled: bool = proto.Field( 

373 proto.BOOL, 

374 number=43, 

375 ) 

376 source_reference: MutableSequence["SourceReference"] = proto.RepeatedField( 

377 proto.MESSAGE, 

378 number=41, 

379 message="SourceReference", 

380 ) 

381 

382 

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