Skip to content

Commit f6e936c

Browse files
authored
Add protos as an artifact to library (#7205)
1 parent 326cb68 commit f6e936c

File tree

11 files changed

+1608
-0
lines changed

11 files changed

+1608
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
// Copyright 2018 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+
//
15+
16+
syntax = "proto3";
17+
18+
package google.logging.type;
19+
20+
import "google/api/annotations.proto";
21+
import "google/protobuf/duration.proto";
22+
23+
option csharp_namespace = "Google.Cloud.Logging.Type";
24+
option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype";
25+
option java_multiple_files = true;
26+
option java_outer_classname = "HttpRequestProto";
27+
option java_package = "com.google.logging.type";
28+
option php_namespace = "Google\\Cloud\\Logging\\Type";
29+
30+
31+
// A common proto for logging HTTP requests. Only contains semantics
32+
// defined by the HTTP specification. Product-specific logging
33+
// information MUST be defined in a separate message.
34+
message HttpRequest {
35+
// The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
36+
string request_method = 1;
37+
38+
// The scheme (http, https), the host name, the path and the query
39+
// portion of the URL that was requested.
40+
// Example: `"http://example.com/some/info?color=red"`.
41+
string request_url = 2;
42+
43+
// The size of the HTTP request message in bytes, including the request
44+
// headers and the request body.
45+
int64 request_size = 3;
46+
47+
// The response code indicating the status of response.
48+
// Examples: 200, 404.
49+
int32 status = 4;
50+
51+
// The size of the HTTP response message sent back to the client, in bytes,
52+
// including the response headers and the response body.
53+
int64 response_size = 5;
54+
55+
// The user agent sent by the client. Example:
56+
// `"Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)"`.
57+
string user_agent = 6;
58+
59+
// The IP address (IPv4 or IPv6) of the client that issued the HTTP
60+
// request. Examples: `"192.168.1.1"`, `"FE80::0202:B3FF:FE1E:8329"`.
61+
string remote_ip = 7;
62+
63+
// The IP address (IPv4 or IPv6) of the origin server that the request was
64+
// sent to.
65+
string server_ip = 13;
66+
67+
// The referer URL of the request, as defined in
68+
// [HTTP/1.1 Header Field Definitions](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
69+
string referer = 8;
70+
71+
// The request processing latency on the server, from the time the request was
72+
// received until the response was sent.
73+
google.protobuf.Duration latency = 14;
74+
75+
// Whether or not a cache lookup was attempted.
76+
bool cache_lookup = 11;
77+
78+
// Whether or not an entity was served from cache
79+
// (with or without validation).
80+
bool cache_hit = 9;
81+
82+
// Whether or not the response was validated with the origin server before
83+
// being served from cache. This field is only meaningful if `cache_hit` is
84+
// True.
85+
bool cache_validated_with_origin_server = 10;
86+
87+
// The number of HTTP response bytes inserted into cache. Set only when a
88+
// cache fill was attempted.
89+
int64 cache_fill_bytes = 12;
90+
91+
// Protocol used for the request. Examples: "HTTP/1.1", "HTTP/2", "websocket"
92+
string protocol = 15;
93+
}
Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,193 @@
1+
// Copyright 2018 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+
//
15+
16+
syntax = "proto3";
17+
18+
package google.logging.v2;
19+
20+
import "google/api/annotations.proto";
21+
import "google/api/monitored_resource.proto";
22+
import "google/logging/type/http_request.proto";
23+
import "google/logging/type/log_severity.proto";
24+
import "google/protobuf/any.proto";
25+
import "google/protobuf/struct.proto";
26+
import "google/protobuf/timestamp.proto";
27+
28+
option cc_enable_arenas = true;
29+
option csharp_namespace = "Google.Cloud.Logging.V2";
30+
option go_package = "google.golang.org/genproto/googleapis/logging/v2;logging";
31+
option java_multiple_files = true;
32+
option java_outer_classname = "LogEntryProto";
33+
option java_package = "com.google.logging.v2";
34+
option php_namespace = "Google\\Cloud\\Logging\\V2";
35+
36+
37+
// An individual entry in a log.
38+
message LogEntry {
39+
// Required. The resource name of the log to which this log entry belongs:
40+
//
41+
// "projects/[PROJECT_ID]/logs/[LOG_ID]"
42+
// "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
43+
// "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
44+
// "folders/[FOLDER_ID]/logs/[LOG_ID]"
45+
//
46+
// A project number may optionally be used in place of PROJECT_ID. The
47+
// project number is translated to its corresponding PROJECT_ID internally
48+
// and the `log_name` field will contain PROJECT_ID in queries and exports.
49+
//
50+
// `[LOG_ID]` must be URL-encoded within `log_name`. Example:
51+
// `"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"`.
52+
// `[LOG_ID]` must be less than 512 characters long and can only include the
53+
// following characters: upper and lower case alphanumeric characters,
54+
// forward-slash, underscore, hyphen, and period.
55+
//
56+
// For backward compatibility, if `log_name` begins with a forward-slash, such
57+
// as `/projects/...`, then the log entry is ingested as usual but the
58+
// forward-slash is removed. Listing the log entry will not show the leading
59+
// slash and filtering for a log name with a leading slash will never return
60+
// any results.
61+
string log_name = 12;
62+
63+
// Required. The primary monitored resource associated with this log entry.
64+
// Example: a log entry that reports a database error would be
65+
// associated with the monitored resource designating the particular
66+
// database that reported the error.
67+
google.api.MonitoredResource resource = 8;
68+
69+
// Optional. The log entry payload, which can be one of multiple types.
70+
oneof payload {
71+
// The log entry payload, represented as a protocol buffer. Some
72+
// Google Cloud Platform services use this field for their log
73+
// entry payloads.
74+
google.protobuf.Any proto_payload = 2;
75+
76+
// The log entry payload, represented as a Unicode string (UTF-8).
77+
string text_payload = 3;
78+
79+
// The log entry payload, represented as a structure that is
80+
// expressed as a JSON object.
81+
google.protobuf.Struct json_payload = 6;
82+
}
83+
84+
// Optional. The time the event described by the log entry occurred.
85+
// This time is used to compute the log entry's age and to enforce
86+
// the logs retention period. If this field is omitted in a new log
87+
// entry, then Logging assigns it the current time.
88+
// Timestamps have nanosecond accuracy, but trailing zeros in the fractional
89+
// seconds might be omitted when the timestamp is displayed.
90+
//
91+
// Incoming log entries should have timestamps that are no more than
92+
// the [logs retention period](/logging/quotas) in the past,
93+
// and no more than 24 hours in the future. Log entries outside those time
94+
// boundaries will not be available when calling `entries.list`, but
95+
// those log entries can still be exported with
96+
// [LogSinks](/logging/docs/api/tasks/exporting-logs).
97+
google.protobuf.Timestamp timestamp = 9;
98+
99+
// Output only. The time the log entry was received by Logging.
100+
google.protobuf.Timestamp receive_timestamp = 24;
101+
102+
// Optional. The severity of the log entry. The default value is
103+
// `LogSeverity.DEFAULT`.
104+
google.logging.type.LogSeverity severity = 10;
105+
106+
// Optional. A unique identifier for the log entry. If you provide a value,
107+
// then Logging considers other log entries in the same project,
108+
// with the same `timestamp`, and with the same `insert_id` to be duplicates
109+
// which can be removed. If omitted in new log entries, then
110+
// Logging assigns its own unique identifier. The `insert_id` is also used
111+
// to order log entries that have the same `timestamp` value.
112+
string insert_id = 4;
113+
114+
// Optional. Information about the HTTP request associated with this
115+
// log entry, if applicable.
116+
google.logging.type.HttpRequest http_request = 7;
117+
118+
// Optional. A set of user-defined (key, value) data that provides additional
119+
// information about the log entry.
120+
map<string, string> labels = 11;
121+
122+
// Output only. Additional metadata about the monitored resource.
123+
// Only `k8s_container`, `k8s_pod`, and `k8s_node` MonitoredResources have
124+
// this field populated.
125+
google.api.MonitoredResourceMetadata metadata = 25;
126+
127+
// Optional. Information about an operation associated with the log entry, if
128+
// applicable.
129+
LogEntryOperation operation = 15;
130+
131+
// Optional. Resource name of the trace associated with the log entry, if any.
132+
// If it contains a relative resource name, the name is assumed to be relative
133+
// to `//tracing.googleapis.com`. Example:
134+
// `projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824`
135+
string trace = 22;
136+
137+
// Optional. The span ID within the trace associated with the log entry.
138+
// For Trace spans, this is the same format that the Trace
139+
// API v2 uses: a 16-character hexadecimal encoding of an 8-byte array, such
140+
// as <code>"000000000000004a"</code>.
141+
string span_id = 27;
142+
143+
// Optional. The sampling decision of the trace associated with the log entry.
144+
// True means that the trace resource name in the `trace` field was sampled
145+
// for storage in a trace backend. False means that the trace was not sampled
146+
// for storage when this log entry was written, or the sampling decision was
147+
// unknown at the time. A non-sampled `trace` value is still useful as a
148+
// request correlation identifier. The default is False.
149+
bool trace_sampled = 30;
150+
151+
// Optional. Source code location information associated with the log entry,
152+
// if any.
153+
LogEntrySourceLocation source_location = 23;
154+
}
155+
156+
// Additional information about a potentially long-running operation with which
157+
// a log entry is associated.
158+
message LogEntryOperation {
159+
// Optional. An arbitrary operation identifier. Log entries with the
160+
// same identifier are assumed to be part of the same operation.
161+
string id = 1;
162+
163+
// Optional. An arbitrary producer identifier. The combination of
164+
// `id` and `producer` must be globally unique. Examples for `producer`:
165+
// `"MyDivision.MyBigCompany.com"`, `"github.com/MyProject/MyApplication"`.
166+
string producer = 2;
167+
168+
// Optional. Set this to True if this is the first log entry in the operation.
169+
bool first = 3;
170+
171+
// Optional. Set this to True if this is the last log entry in the operation.
172+
bool last = 4;
173+
}
174+
175+
// Additional information about the source code location that produced the log
176+
// entry.
177+
message LogEntrySourceLocation {
178+
// Optional. Source file name. Depending on the runtime environment, this
179+
// might be a simple name or a fully-qualified name.
180+
string file = 1;
181+
182+
// Optional. Line within the source file. 1-based; 0 indicates no line number
183+
// available.
184+
int64 line = 2;
185+
186+
// Optional. Human-readable name of the function or method being invoked, with
187+
// optional context such as the class or package name. This information may be
188+
// used in contexts such as the logs viewer, where a file and line number are
189+
// less meaningful. The format can vary by language. For example:
190+
// `qual.if.ied.Class.method` (Java), `dir/package.func` (Go), `function`
191+
// (Python).
192+
string function = 3;
193+
}

google/cloud/logging_v2/proto/log_entry_pb2.py

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright 2018 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+
//
15+
16+
syntax = "proto3";
17+
18+
package google.logging.type;
19+
20+
import "google/api/annotations.proto";
21+
22+
option csharp_namespace = "Google.Cloud.Logging.Type";
23+
option go_package = "google.golang.org/genproto/googleapis/logging/type;ltype";
24+
option java_multiple_files = true;
25+
option java_outer_classname = "LogSeverityProto";
26+
option java_package = "com.google.logging.type";
27+
option php_namespace = "Google\\Cloud\\Logging\\Type";
28+
29+
30+
// The severity of the event described in a log entry, expressed as one of the
31+
// standard severity levels listed below. For your reference, the levels are
32+
// assigned the listed numeric values. The effect of using numeric values other
33+
// than those listed is undefined.
34+
//
35+
// You can filter for log entries by severity. For example, the following
36+
// filter expression will match log entries with severities `INFO`, `NOTICE`,
37+
// and `WARNING`:
38+
//
39+
// severity > DEBUG AND severity <= WARNING
40+
//
41+
// If you are writing log entries, you should map other severity encodings to
42+
// one of these standard levels. For example, you might map all of Java's FINE,
43+
// FINER, and FINEST levels to `LogSeverity.DEBUG`. You can preserve the
44+
// original severity level in the log entry payload if you wish.
45+
enum LogSeverity {
46+
// (0) The log entry has no assigned severity level.
47+
DEFAULT = 0;
48+
49+
// (100) Debug or trace information.
50+
DEBUG = 100;
51+
52+
// (200) Routine information, such as ongoing status or performance.
53+
INFO = 200;
54+
55+
// (300) Normal but significant events, such as start up, shut down, or
56+
// a configuration change.
57+
NOTICE = 300;
58+
59+
// (400) Warning events might cause problems.
60+
WARNING = 400;
61+
62+
// (500) Error events are likely to cause problems.
63+
ERROR = 500;
64+
65+
// (600) Critical events cause more severe problems or outages.
66+
CRITICAL = 600;
67+
68+
// (700) A person must take an action immediately.
69+
ALERT = 700;
70+
71+
// (800) One or more systems are unusable.
72+
EMERGENCY = 800;
73+
}

0 commit comments

Comments
 (0)