Debian Codegraph @

opentelemetry/proto/logs/v1/logs.proto

raw
1 // Copyright 2020, OpenTelemetry Authors
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 syntax = "proto3";
16
17 package opentelemetry.proto.logs.v1;
18
19 import "opentelemetry/proto/common/v1/common.proto";
20 import "opentelemetry/proto/resource/v1/resource.proto";
21
22 option csharp_namespace = "OpenTelemetry.Proto.Logs.V1";
23 option java_multiple_files = true;
24 option java_package = "io.opentelemetry.proto.logs.v1";
25 option java_outer_classname = "LogsProto";
26 option go_package = "go.opentelemetry.io/proto/otlp/logs/v1";
27
28 // LogsData represents the logs data that can be stored in a persistent storage,
29 // OR can be embedded by other protocols that transfer OTLP logs data but do not
30 // implement the OTLP protocol.
31 //
32 // The main difference between this message and collector protocol is that
33 // in this message there will not be any "control" or "metadata" specific to
34 // OTLP protocol.
35 //
36 // When new fields are added into this message, the OTLP request MUST be updated
37 // as well.
38 message LogsData {
39 // An array of ResourceLogs.
40 // For data coming from a single resource this array will typically contain
41 // one element. Intermediary nodes that receive data from multiple origins
42 // typically batch the data before forwarding further and in that case this
43 // array will contain multiple elements.
44 repeated ResourceLogs resource_logs = 1;
45 }
46
47 // A collection of ScopeLogs from a Resource.
48 message ResourceLogs {
49 reserved 1000;
50
51 // The resource for the logs in this message.
52 // If this field is not set then resource info is unknown.
53 opentelemetry.proto.resource.v1.Resource resource = 1;
54
55 // A list of ScopeLogs that originate from a resource.
56 repeated ScopeLogs scope_logs = 2;
57
58 // The Schema URL, if known. This is the identifier of the Schema that the resource data
59 // is recorded in. Notably, the last part of the URL path is the version number of the
60 // schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see
61 // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
62 // This schema_url applies to the data in the "resource" field. It does not apply
63 // to the data in the "scope_logs" field which have their own schema_url field.
64 string schema_url = 3;
65 }
66
67 // A collection of Logs produced by a Scope.
68 message ScopeLogs {
69 // The instrumentation scope information for the logs in this message.
70 // Semantically when InstrumentationScope isn't set, it is equivalent with
71 // an empty instrumentation scope name (unknown).
72 opentelemetry.proto.common.v1.InstrumentationScope scope = 1;
73
74 // A list of log records.
75 repeated LogRecord log_records = 2;
76
77 // The Schema URL, if known. This is the identifier of the Schema that the log data
78 // is recorded in. Notably, the last part of the URL path is the version number of the
79 // schema: http[s]://server[:port]/path/<version>. To learn more about Schema URL see
80 // https://opentelemetry.io/docs/specs/otel/schemas/#schema-url
81 // This schema_url applies to all logs in the "logs" field.
82 string schema_url = 3;
83 }
84
85 // Possible values for LogRecord.SeverityNumber.
86 enum SeverityNumber {
87 // UNSPECIFIED is the default SeverityNumber, it MUST NOT be used.
88 SEVERITY_NUMBER_UNSPECIFIED = 0;
89 SEVERITY_NUMBER_TRACE = 1;
90 SEVERITY_NUMBER_TRACE2 = 2;
91 SEVERITY_NUMBER_TRACE3 = 3;
92 SEVERITY_NUMBER_TRACE4 = 4;
93 SEVERITY_NUMBER_DEBUG = 5;
94 SEVERITY_NUMBER_DEBUG2 = 6;
95 SEVERITY_NUMBER_DEBUG3 = 7;
96 SEVERITY_NUMBER_DEBUG4 = 8;
97 SEVERITY_NUMBER_INFO = 9;
98 SEVERITY_NUMBER_INFO2 = 10;
99 SEVERITY_NUMBER_INFO3 = 11;
100 SEVERITY_NUMBER_INFO4 = 12;
101 SEVERITY_NUMBER_WARN = 13;
102 SEVERITY_NUMBER_WARN2 = 14;
103 SEVERITY_NUMBER_WARN3 = 15;
104 SEVERITY_NUMBER_WARN4 = 16;
105 SEVERITY_NUMBER_ERROR = 17;
106 SEVERITY_NUMBER_ERROR2 = 18;
107 SEVERITY_NUMBER_ERROR3 = 19;
108 SEVERITY_NUMBER_ERROR4 = 20;
109 SEVERITY_NUMBER_FATAL = 21;
110 SEVERITY_NUMBER_FATAL2 = 22;
111 SEVERITY_NUMBER_FATAL3 = 23;
112 SEVERITY_NUMBER_FATAL4 = 24;
113 }
114
115 // LogRecordFlags represents constants used to interpret the
116 // LogRecord.flags field, which is protobuf 'fixed32' type and is to
117 // be used as bit-fields. Each non-zero value defined in this enum is
118 // a bit-mask. To extract the bit-field, for example, use an
119 // expression like:
120 //
121 // (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK)
122 //
123 enum LogRecordFlags {
124 // The zero value for the enum. Should not be used for comparisons.
125 // Instead use bitwise "and" with the appropriate mask as shown above.
126 LOG_RECORD_FLAGS_DO_NOT_USE = 0;
127
128 // Bits 0-7 are used for trace flags.
129 LOG_RECORD_FLAGS_TRACE_FLAGS_MASK = 0x000000FF;
130
131 // Bits 8-31 are reserved for future use.
132 }
133
134 // A log record according to OpenTelemetry Log Data Model:
135 // https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md
136 message LogRecord {
137 reserved 4;
138
139 // time_unix_nano is the time when the event occurred.
140 // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
141 // Value of 0 indicates unknown or missing timestamp.
142 fixed64 time_unix_nano = 1;
143
144 // Time when the event was observed by the collection system.
145 // For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK)
146 // this timestamp is typically set at the generation time and is equal to Timestamp.
147 // For events originating externally and collected by OpenTelemetry (e.g. using
148 // Collector) this is the time when OpenTelemetry's code observed the event measured
149 // by the clock of the OpenTelemetry code. This field MUST be set once the event is
150 // observed by OpenTelemetry.
151 //
152 // For converting OpenTelemetry log data to formats that support only one timestamp or
153 // when receiving OpenTelemetry log data by recipients that support only one timestamp
154 // internally the following logic is recommended:
155 // - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano.
156 //
157 // Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
158 // Value of 0 indicates unknown or missing timestamp.
159 fixed64 observed_time_unix_nano = 11;
160
161 // Numerical value of the severity, normalized to values described in Log Data Model.
162 // [Optional].
163 SeverityNumber severity_number = 2;
164
165 // The severity text (also known as log level). The original string representation as
166 // it is known at the source. [Optional].
167 string severity_text = 3;
168
169 // A value containing the body of the log record. Can be for example a human-readable
170 // string message (including multi-line) describing the event in a free form or it can
171 // be a structured data composed of arrays and maps of other values. [Optional].
172 opentelemetry.proto.common.v1.AnyValue body = 5;
173
174 // Additional attributes that describe the specific event occurrence. [Optional].
175 // Attribute keys MUST be unique (it is not allowed to have more than one
176 // attribute with the same key).
177 repeated opentelemetry.proto.common.v1.KeyValue attributes = 6;
178 uint32 dropped_attributes_count = 7;
179
180 // Flags, a bit field. 8 least significant bits are the trace flags as
181 // defined in W3C Trace Context specification. 24 most significant bits are reserved
182 // and must be set to 0. Readers must not assume that 24 most significant bits
183 // will be zero and must correctly mask the bits when reading 8-bit trace flag (use
184 // flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK). [Optional].
185 fixed32 flags = 8;
186
187 // A unique identifier for a trace. All logs from the same trace share
188 // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR
189 // of length other than 16 bytes is considered invalid (empty string in OTLP/JSON
190 // is zero-length and thus is also invalid).
191 //
192 // This field is optional.
193 //
194 // The receivers SHOULD assume that the log record is not associated with a
195 // trace if any of the following is true:
196 // - the field is not present,
197 // - the field contains an invalid value.
198 bytes trace_id = 9;
199
200 // A unique identifier for a span within a trace, assigned when the span
201 // is created. The ID is an 8-byte array. An ID with all zeroes OR of length
202 // other than 8 bytes is considered invalid (empty string in OTLP/JSON
203 // is zero-length and thus is also invalid).
204 //
205 // This field is optional. If the sender specifies a valid span_id then it SHOULD also
206 // specify a valid trace_id.
207 //
208 // The receivers SHOULD assume that the log record is not associated with a
209 // span if any of the following is true:
210 // - the field is not present,
211 // - the field contains an invalid value.
212 bytes span_id = 10;
213
214 // A unique identifier of event category/type.
215 // All events with the same event_name are expected to conform to the same
216 // schema for both their attributes and their body.
217 //
218 // Recommended to be fully qualified and short (no longer than 256 characters).
219 //
220 // Presence of event_name on the log record identifies this record
221 // as an event.
222 //
223 // [Optional].
224 string event_name = 12;
225 }