Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/google/cloud/logging_v2/types/log_entry.py: 100%
41 statements
« prev ^ index » next coverage.py v7.2.2, created at 2023-03-26 07:30 +0000
« 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
18import proto # type: ignore
20from google.api import monitored_resource_pb2 # type: ignore
21from google.logging.type import http_request_pb2 # type: ignore
22from google.logging.type import log_severity_pb2 # type: ignore
23from google.protobuf import any_pb2 # type: ignore
24from google.protobuf import struct_pb2 # type: ignore
25from google.protobuf import timestamp_pb2 # type: ignore
28__protobuf__ = proto.module(
29 package="google.logging.v2",
30 manifest={
31 "LogEntry",
32 "LogEntryOperation",
33 "LogEntrySourceLocation",
34 "LogSplit",
35 },
36)
39class LogEntry(proto.Message):
40 r"""An individual entry in a log.
42 This message has `oneof`_ fields (mutually exclusive fields).
43 For each oneof, at most one member field can be set at the same time.
44 Setting any member of the oneof automatically clears all other
45 members.
47 .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
49 Attributes:
50 log_name (str):
51 Required. The resource name of the log to which this log
52 entry belongs:
54 ::
56 "projects/[PROJECT_ID]/logs/[LOG_ID]"
57 "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
58 "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
59 "folders/[FOLDER_ID]/logs/[LOG_ID]"
61 A project number may be used in place of PROJECT_ID. The
62 project number is translated to its corresponding PROJECT_ID
63 internally and the ``log_name`` field will contain
64 PROJECT_ID in queries and exports.
66 ``[LOG_ID]`` must be URL-encoded within ``log_name``.
67 Example:
68 ``"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"``.
70 ``[LOG_ID]`` must be less than 512 characters long and can
71 only include the following characters: upper and lower case
72 alphanumeric characters, forward-slash, underscore, hyphen,
73 and period.
75 For backward compatibility, if ``log_name`` begins with a
76 forward-slash, such as ``/projects/...``, then the log entry
77 is ingested as usual, but the forward-slash is removed.
78 Listing the log entry will not show the leading slash and
79 filtering for a log name with a leading slash will never
80 return any results.
81 resource (google.api.monitored_resource_pb2.MonitoredResource):
82 Required. The monitored resource that
83 produced this log entry.
84 Example: a log entry that reports a database
85 error would be associated with the monitored
86 resource designating the particular database
87 that reported the error.
88 proto_payload (google.protobuf.any_pb2.Any):
89 The log entry payload, represented as a
90 protocol buffer. Some Google Cloud Platform
91 services use this field for their log entry
92 payloads.
93 The following protocol buffer types are
94 supported; user-defined types are not supported:
96 "type.googleapis.com/google.cloud.audit.AuditLog"
97 "type.googleapis.com/google.appengine.logging.v1.RequestLog".
99 This field is a member of `oneof`_ ``payload``.
100 text_payload (str):
101 The log entry payload, represented as a
102 Unicode string (UTF-8).
104 This field is a member of `oneof`_ ``payload``.
105 json_payload (google.protobuf.struct_pb2.Struct):
106 The log entry payload, represented as a
107 structure that is expressed as a JSON object.
109 This field is a member of `oneof`_ ``payload``.
110 timestamp (google.protobuf.timestamp_pb2.Timestamp):
111 Optional. The time the event described by the log entry
112 occurred. This time is used to compute the log entry's age
113 and to enforce the logs retention period. If this field is
114 omitted in a new log entry, then Logging assigns it the
115 current time. Timestamps have nanosecond accuracy, but
116 trailing zeros in the fractional seconds might be omitted
117 when the timestamp is displayed.
119 Incoming log entries must have timestamps that don't exceed
120 the `logs retention
121 period <https://cloud.google.com/logging/quotas#logs_retention_periods>`__
122 in the past, and that don't exceed 24 hours in the future.
123 Log entries outside those time boundaries aren't ingested by
124 Logging.
125 receive_timestamp (google.protobuf.timestamp_pb2.Timestamp):
126 Output only. The time the log entry was
127 received by Logging.
128 severity (google.logging.type.log_severity_pb2.LogSeverity):
129 Optional. The severity of the log entry. The default value
130 is ``LogSeverity.DEFAULT``.
131 insert_id (str):
132 Optional. A unique identifier for the log entry. If you
133 provide a value, then Logging considers other log entries in
134 the same project, with the same ``timestamp``, and with the
135 same ``insert_id`` to be duplicates which are removed in a
136 single query result. However, there are no guarantees of
137 de-duplication in the export of logs.
139 If the ``insert_id`` is omitted when writing a log entry,
140 the Logging API assigns its own unique identifier in this
141 field.
143 In queries, the ``insert_id`` is also used to order log
144 entries that have the same ``log_name`` and ``timestamp``
145 values.
146 http_request (google.logging.type.http_request_pb2.HttpRequest):
147 Optional. Information about the HTTP request
148 associated with this log entry, if applicable.
149 labels (MutableMapping[str, str]):
150 Optional. A map of key, value pairs that provides additional
151 information about the log entry. The labels can be
152 user-defined or system-defined.
154 User-defined labels are arbitrary key, value pairs that you
155 can use to classify logs.
157 System-defined labels are defined by GCP services for
158 platform logs. They have two components - a service
159 namespace component and the attribute name. For example:
160 ``compute.googleapis.com/resource_name``.
162 Cloud Logging truncates label keys that exceed 512 B and
163 label values that exceed 64 KB upon their associated log
164 entry being written. The truncation is indicated by an
165 ellipsis at the end of the character string.
166 operation (google.cloud.logging_v2.types.LogEntryOperation):
167 Optional. Information about an operation
168 associated with the log entry, if applicable.
169 trace (str):
170 Optional. Resource name of the trace associated with the log
171 entry, if any. If it contains a relative resource name, the
172 name is assumed to be relative to
173 ``//tracing.googleapis.com``. Example:
174 ``projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824``
175 span_id (str):
176 Optional. The span ID within the trace associated with the
177 log entry.
179 For Trace spans, this is the same format that the Trace API
180 v2 uses: a 16-character hexadecimal encoding of an 8-byte
181 array, such as ``000000000000004a``.
182 trace_sampled (bool):
183 Optional. The sampling decision of the trace associated with
184 the log entry.
186 True means that the trace resource name in the ``trace``
187 field was sampled for storage in a trace backend. False
188 means that the trace was not sampled for storage when this
189 log entry was written, or the sampling decision was unknown
190 at the time. A non-sampled ``trace`` value is still useful
191 as a request correlation identifier. The default is False.
192 source_location (google.cloud.logging_v2.types.LogEntrySourceLocation):
193 Optional. Source code location information
194 associated with the log entry, if any.
195 split (google.cloud.logging_v2.types.LogSplit):
196 Optional. Information indicating this
197 LogEntry is part of a sequence of multiple log
198 entries split from a single LogEntry.
199 """
201 log_name: str = proto.Field(
202 proto.STRING,
203 number=12,
204 )
205 resource: monitored_resource_pb2.MonitoredResource = proto.Field(
206 proto.MESSAGE,
207 number=8,
208 message=monitored_resource_pb2.MonitoredResource,
209 )
210 proto_payload: any_pb2.Any = proto.Field(
211 proto.MESSAGE,
212 number=2,
213 oneof="payload",
214 message=any_pb2.Any,
215 )
216 text_payload: str = proto.Field(
217 proto.STRING,
218 number=3,
219 oneof="payload",
220 )
221 json_payload: struct_pb2.Struct = proto.Field(
222 proto.MESSAGE,
223 number=6,
224 oneof="payload",
225 message=struct_pb2.Struct,
226 )
227 timestamp: timestamp_pb2.Timestamp = proto.Field(
228 proto.MESSAGE,
229 number=9,
230 message=timestamp_pb2.Timestamp,
231 )
232 receive_timestamp: timestamp_pb2.Timestamp = proto.Field(
233 proto.MESSAGE,
234 number=24,
235 message=timestamp_pb2.Timestamp,
236 )
237 severity: log_severity_pb2.LogSeverity = proto.Field(
238 proto.ENUM,
239 number=10,
240 enum=log_severity_pb2.LogSeverity,
241 )
242 insert_id: str = proto.Field(
243 proto.STRING,
244 number=4,
245 )
246 http_request: http_request_pb2.HttpRequest = proto.Field(
247 proto.MESSAGE,
248 number=7,
249 message=http_request_pb2.HttpRequest,
250 )
251 labels: MutableMapping[str, str] = proto.MapField(
252 proto.STRING,
253 proto.STRING,
254 number=11,
255 )
256 operation: "LogEntryOperation" = proto.Field(
257 proto.MESSAGE,
258 number=15,
259 message="LogEntryOperation",
260 )
261 trace: str = proto.Field(
262 proto.STRING,
263 number=22,
264 )
265 span_id: str = proto.Field(
266 proto.STRING,
267 number=27,
268 )
269 trace_sampled: bool = proto.Field(
270 proto.BOOL,
271 number=30,
272 )
273 source_location: "LogEntrySourceLocation" = proto.Field(
274 proto.MESSAGE,
275 number=23,
276 message="LogEntrySourceLocation",
277 )
278 split: "LogSplit" = proto.Field(
279 proto.MESSAGE,
280 number=35,
281 message="LogSplit",
282 )
285class LogEntryOperation(proto.Message):
286 r"""Additional information about a potentially long-running
287 operation with which a log entry is associated.
289 Attributes:
290 id (str):
291 Optional. An arbitrary operation identifier.
292 Log entries with the same identifier are assumed
293 to be part of the same operation.
294 producer (str):
295 Optional. An arbitrary producer identifier. The combination
296 of ``id`` and ``producer`` must be globally unique. Examples
297 for ``producer``: ``"MyDivision.MyBigCompany.com"``,
298 ``"github.com/MyProject/MyApplication"``.
299 first (bool):
300 Optional. Set this to True if this is the
301 first log entry in the operation.
302 last (bool):
303 Optional. Set this to True if this is the
304 last log entry in the operation.
305 """
307 id: str = proto.Field(
308 proto.STRING,
309 number=1,
310 )
311 producer: str = proto.Field(
312 proto.STRING,
313 number=2,
314 )
315 first: bool = proto.Field(
316 proto.BOOL,
317 number=3,
318 )
319 last: bool = proto.Field(
320 proto.BOOL,
321 number=4,
322 )
325class LogEntrySourceLocation(proto.Message):
326 r"""Additional information about the source code location that
327 produced the log entry.
329 Attributes:
330 file (str):
331 Optional. Source file name. Depending on the
332 runtime environment, this might be a simple name
333 or a fully-qualified name.
334 line (int):
335 Optional. Line within the source file.
336 1-based; 0 indicates no line number available.
337 function (str):
338 Optional. Human-readable name of the function or method
339 being invoked, with optional context such as the class or
340 package name. This information may be used in contexts such
341 as the logs viewer, where a file and line number are less
342 meaningful. The format can vary by language. For example:
343 ``qual.if.ied.Class.method`` (Java), ``dir/package.func``
344 (Go), ``function`` (Python).
345 """
347 file: str = proto.Field(
348 proto.STRING,
349 number=1,
350 )
351 line: int = proto.Field(
352 proto.INT64,
353 number=2,
354 )
355 function: str = proto.Field(
356 proto.STRING,
357 number=3,
358 )
361class LogSplit(proto.Message):
362 r"""Additional information used to correlate multiple log
363 entries. Used when a single LogEntry would exceed the Google
364 Cloud Logging size limit and is split across multiple log
365 entries.
367 Attributes:
368 uid (str):
369 A globally unique identifier for all log entries in a
370 sequence of split log entries. All log entries with the same
371 \|LogSplit.uid\| are assumed to be part of the same sequence
372 of split log entries.
373 index (int):
374 The index of this LogEntry in the sequence of split log
375 entries. Log entries are given \|index\| values 0, 1, ...,
376 n-1 for a sequence of n log entries.
377 total_splits (int):
378 The total number of log entries that the
379 original LogEntry was split into.
380 """
382 uid: str = proto.Field(
383 proto.STRING,
384 number=1,
385 )
386 index: int = proto.Field(
387 proto.INT32,
388 number=2,
389 )
390 total_splits: int = proto.Field(
391 proto.INT32,
392 number=3,
393 )
396__all__ = tuple(sorted(__protobuf__.manifest))