opentelemetry_proto/proto/tonic/opentelemetry.proto.logs.v1.rs
1// This file is @generated by prost-build.
2/// LogsData represents the logs data that can be stored in a persistent storage,
3/// OR can be embedded by other protocols that transfer OTLP logs data but do not
4/// implement the OTLP protocol.
5///
6/// The main difference between this message and collector protocol is that
7/// in this message there will not be any "control" or "metadata" specific to
8/// OTLP protocol.
9///
10/// When new fields are added into this message, the OTLP request MUST be updated
11/// as well.
12#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
13#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
14#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
15#[derive(Clone, PartialEq, ::prost::Message)]
16pub struct LogsData {
17 /// An array of ResourceLogs.
18 /// For data coming from a single resource this array will typically contain
19 /// one element. Intermediary nodes that receive data from multiple origins
20 /// typically batch the data before forwarding further and in that case this
21 /// array will contain multiple elements.
22 #[prost(message, repeated, tag = "1")]
23 pub resource_logs: ::prost::alloc::vec::Vec<ResourceLogs>,
24}
25/// A collection of ScopeLogs from a Resource.
26#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
27#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
28#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
29#[cfg_attr(feature = "with-serde", serde(default))]
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct ResourceLogs {
32 /// The resource for the logs in this message.
33 /// If this field is not set then resource info is unknown.
34 #[prost(message, optional, tag = "1")]
35 pub resource: ::core::option::Option<super::super::resource::v1::Resource>,
36 /// A list of ScopeLogs that originate from a resource.
37 #[prost(message, repeated, tag = "2")]
38 pub scope_logs: ::prost::alloc::vec::Vec<ScopeLogs>,
39 /// The Schema URL, if known. This is the identifier of the Schema that the resource data
40 /// is recorded in. Notably, the last part of the URL path is the version number of the
41 /// schema: http\[s\]://server\[:port\]/path/<version>. To learn more about Schema URL see
42 /// <https://opentelemetry.io/docs/specs/otel/schemas/#schema-url>
43 /// This schema_url applies to the data in the "resource" field. It does not apply
44 /// to the data in the "scope_logs" field which have their own schema_url field.
45 #[prost(string, tag = "3")]
46 pub schema_url: ::prost::alloc::string::String,
47}
48/// A collection of Logs produced by a Scope.
49#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
50#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
51#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
52#[cfg_attr(feature = "with-serde", serde(default))]
53#[derive(Clone, PartialEq, ::prost::Message)]
54pub struct ScopeLogs {
55 /// The instrumentation scope information for the logs in this message.
56 /// Semantically when InstrumentationScope isn't set, it is equivalent with
57 /// an empty instrumentation scope name (unknown).
58 #[prost(message, optional, tag = "1")]
59 pub scope: ::core::option::Option<super::super::common::v1::InstrumentationScope>,
60 /// A list of log records.
61 #[prost(message, repeated, tag = "2")]
62 pub log_records: ::prost::alloc::vec::Vec<LogRecord>,
63 /// The Schema URL, if known. This is the identifier of the Schema that the log data
64 /// is recorded in. Notably, the last part of the URL path is the version number of the
65 /// schema: http\[s\]://server\[:port\]/path/<version>. To learn more about Schema URL see
66 /// <https://opentelemetry.io/docs/specs/otel/schemas/#schema-url>
67 /// This schema_url applies to all logs in the "logs" field.
68 #[prost(string, tag = "3")]
69 pub schema_url: ::prost::alloc::string::String,
70}
71/// A log record according to OpenTelemetry Log Data Model:
72/// <https://github.com/open-telemetry/oteps/blob/main/text/logs/0097-log-data-model.md>
73#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
74#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
75#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
76#[cfg_attr(feature = "with-serde", serde(default))]
77#[derive(Clone, PartialEq, ::prost::Message)]
78pub struct LogRecord {
79 /// time_unix_nano is the time when the event occurred.
80 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
81 /// Value of 0 indicates unknown or missing timestamp.
82 #[prost(fixed64, tag = "1")]
83 #[cfg_attr(
84 feature = "with-serde",
85 serde(
86 serialize_with = "crate::proto::serializers::serialize_u64_to_string",
87 deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
88 )
89 )]
90 pub time_unix_nano: u64,
91 /// Time when the event was observed by the collection system.
92 /// For events that originate in OpenTelemetry (e.g. using OpenTelemetry Logging SDK)
93 /// this timestamp is typically set at the generation time and is equal to Timestamp.
94 /// For events originating externally and collected by OpenTelemetry (e.g. using
95 /// Collector) this is the time when OpenTelemetry's code observed the event measured
96 /// by the clock of the OpenTelemetry code. This field MUST be set once the event is
97 /// observed by OpenTelemetry.
98 ///
99 /// For converting OpenTelemetry log data to formats that support only one timestamp or
100 /// when receiving OpenTelemetry log data by recipients that support only one timestamp
101 /// internally the following logic is recommended:
102 ///
103 /// * Use time_unix_nano if it is present, otherwise use observed_time_unix_nano.
104 ///
105 /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
106 /// Value of 0 indicates unknown or missing timestamp.
107 #[prost(fixed64, tag = "11")]
108 #[cfg_attr(
109 feature = "with-serde",
110 serde(
111 serialize_with = "crate::proto::serializers::serialize_u64_to_string",
112 deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
113 )
114 )]
115 pub observed_time_unix_nano: u64,
116 /// Numerical value of the severity, normalized to values described in Log Data Model.
117 /// \[Optional\].
118 #[prost(enumeration = "SeverityNumber", tag = "2")]
119 pub severity_number: i32,
120 /// The severity text (also known as log level). The original string representation as
121 /// it is known at the source. \[Optional\].
122 #[prost(string, tag = "3")]
123 pub severity_text: ::prost::alloc::string::String,
124 /// A value containing the body of the log record. Can be for example a human-readable
125 /// string message (including multi-line) describing the event in a free form or it can
126 /// be a structured data composed of arrays and maps of other values. \[Optional\].
127 #[prost(message, optional, tag = "5")]
128 pub body: ::core::option::Option<super::super::common::v1::AnyValue>,
129 /// Additional attributes that describe the specific event occurrence. \[Optional\].
130 /// Attribute keys MUST be unique (it is not allowed to have more than one
131 /// attribute with the same key).
132 #[prost(message, repeated, tag = "6")]
133 pub attributes: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
134 #[prost(uint32, tag = "7")]
135 pub dropped_attributes_count: u32,
136 /// Flags, a bit field. 8 least significant bits are the trace flags as
137 /// defined in W3C Trace Context specification. 24 most significant bits are reserved
138 /// and must be set to 0. Readers must not assume that 24 most significant bits
139 /// will be zero and must correctly mask the bits when reading 8-bit trace flag (use
140 /// flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK). \[Optional\].
141 #[prost(fixed32, tag = "8")]
142 pub flags: u32,
143 /// A unique identifier for a trace. All logs from the same trace share
144 /// the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR
145 /// of length other than 16 bytes is considered invalid (empty string in OTLP/JSON
146 /// is zero-length and thus is also invalid).
147 ///
148 /// This field is optional.
149 ///
150 /// The receivers SHOULD assume that the log record is not associated with a
151 /// trace if any of the following is true:
152 ///
153 /// * the field is not present,
154 /// * the field contains an invalid value.
155 #[prost(bytes = "vec", tag = "9")]
156 #[cfg_attr(
157 feature = "with-serde",
158 serde(
159 serialize_with = "crate::proto::serializers::serialize_to_hex_string",
160 deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
161 )
162 )]
163 pub trace_id: ::prost::alloc::vec::Vec<u8>,
164 /// A unique identifier for a span within a trace, assigned when the span
165 /// is created. The ID is an 8-byte array. An ID with all zeroes OR of length
166 /// other than 8 bytes is considered invalid (empty string in OTLP/JSON
167 /// is zero-length and thus is also invalid).
168 ///
169 /// This field is optional. If the sender specifies a valid span_id then it SHOULD also
170 /// specify a valid trace_id.
171 ///
172 /// The receivers SHOULD assume that the log record is not associated with a
173 /// span if any of the following is true:
174 ///
175 /// * the field is not present,
176 /// * the field contains an invalid value.
177 #[prost(bytes = "vec", tag = "10")]
178 #[cfg_attr(
179 feature = "with-serde",
180 serde(
181 serialize_with = "crate::proto::serializers::serialize_to_hex_string",
182 deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
183 )
184 )]
185 pub span_id: ::prost::alloc::vec::Vec<u8>,
186 /// A unique identifier of event category/type.
187 /// All events with the same event_name are expected to conform to the same
188 /// schema for both their attributes and their body.
189 ///
190 /// Recommended to be fully qualified and short (no longer than 256 characters).
191 ///
192 /// Presence of event_name on the log record identifies this record
193 /// as an event.
194 ///
195 /// \[Optional\].
196 #[prost(string, tag = "12")]
197 pub event_name: ::prost::alloc::string::String,
198}
199/// Possible values for LogRecord.SeverityNumber.
200#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
201#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
202#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
203#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
204#[repr(i32)]
205pub enum SeverityNumber {
206 /// UNSPECIFIED is the default SeverityNumber, it MUST NOT be used.
207 Unspecified = 0,
208 Trace = 1,
209 Trace2 = 2,
210 Trace3 = 3,
211 Trace4 = 4,
212 Debug = 5,
213 Debug2 = 6,
214 Debug3 = 7,
215 Debug4 = 8,
216 Info = 9,
217 Info2 = 10,
218 Info3 = 11,
219 Info4 = 12,
220 Warn = 13,
221 Warn2 = 14,
222 Warn3 = 15,
223 Warn4 = 16,
224 Error = 17,
225 Error2 = 18,
226 Error3 = 19,
227 Error4 = 20,
228 Fatal = 21,
229 Fatal2 = 22,
230 Fatal3 = 23,
231 Fatal4 = 24,
232}
233impl SeverityNumber {
234 /// String value of the enum field names used in the ProtoBuf definition.
235 ///
236 /// The values are not transformed in any way and thus are considered stable
237 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
238 pub fn as_str_name(&self) -> &'static str {
239 match self {
240 Self::Unspecified => "SEVERITY_NUMBER_UNSPECIFIED",
241 Self::Trace => "SEVERITY_NUMBER_TRACE",
242 Self::Trace2 => "SEVERITY_NUMBER_TRACE2",
243 Self::Trace3 => "SEVERITY_NUMBER_TRACE3",
244 Self::Trace4 => "SEVERITY_NUMBER_TRACE4",
245 Self::Debug => "SEVERITY_NUMBER_DEBUG",
246 Self::Debug2 => "SEVERITY_NUMBER_DEBUG2",
247 Self::Debug3 => "SEVERITY_NUMBER_DEBUG3",
248 Self::Debug4 => "SEVERITY_NUMBER_DEBUG4",
249 Self::Info => "SEVERITY_NUMBER_INFO",
250 Self::Info2 => "SEVERITY_NUMBER_INFO2",
251 Self::Info3 => "SEVERITY_NUMBER_INFO3",
252 Self::Info4 => "SEVERITY_NUMBER_INFO4",
253 Self::Warn => "SEVERITY_NUMBER_WARN",
254 Self::Warn2 => "SEVERITY_NUMBER_WARN2",
255 Self::Warn3 => "SEVERITY_NUMBER_WARN3",
256 Self::Warn4 => "SEVERITY_NUMBER_WARN4",
257 Self::Error => "SEVERITY_NUMBER_ERROR",
258 Self::Error2 => "SEVERITY_NUMBER_ERROR2",
259 Self::Error3 => "SEVERITY_NUMBER_ERROR3",
260 Self::Error4 => "SEVERITY_NUMBER_ERROR4",
261 Self::Fatal => "SEVERITY_NUMBER_FATAL",
262 Self::Fatal2 => "SEVERITY_NUMBER_FATAL2",
263 Self::Fatal3 => "SEVERITY_NUMBER_FATAL3",
264 Self::Fatal4 => "SEVERITY_NUMBER_FATAL4",
265 }
266 }
267 /// Creates an enum from field names used in the ProtoBuf definition.
268 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
269 match value {
270 "SEVERITY_NUMBER_UNSPECIFIED" => Some(Self::Unspecified),
271 "SEVERITY_NUMBER_TRACE" => Some(Self::Trace),
272 "SEVERITY_NUMBER_TRACE2" => Some(Self::Trace2),
273 "SEVERITY_NUMBER_TRACE3" => Some(Self::Trace3),
274 "SEVERITY_NUMBER_TRACE4" => Some(Self::Trace4),
275 "SEVERITY_NUMBER_DEBUG" => Some(Self::Debug),
276 "SEVERITY_NUMBER_DEBUG2" => Some(Self::Debug2),
277 "SEVERITY_NUMBER_DEBUG3" => Some(Self::Debug3),
278 "SEVERITY_NUMBER_DEBUG4" => Some(Self::Debug4),
279 "SEVERITY_NUMBER_INFO" => Some(Self::Info),
280 "SEVERITY_NUMBER_INFO2" => Some(Self::Info2),
281 "SEVERITY_NUMBER_INFO3" => Some(Self::Info3),
282 "SEVERITY_NUMBER_INFO4" => Some(Self::Info4),
283 "SEVERITY_NUMBER_WARN" => Some(Self::Warn),
284 "SEVERITY_NUMBER_WARN2" => Some(Self::Warn2),
285 "SEVERITY_NUMBER_WARN3" => Some(Self::Warn3),
286 "SEVERITY_NUMBER_WARN4" => Some(Self::Warn4),
287 "SEVERITY_NUMBER_ERROR" => Some(Self::Error),
288 "SEVERITY_NUMBER_ERROR2" => Some(Self::Error2),
289 "SEVERITY_NUMBER_ERROR3" => Some(Self::Error3),
290 "SEVERITY_NUMBER_ERROR4" => Some(Self::Error4),
291 "SEVERITY_NUMBER_FATAL" => Some(Self::Fatal),
292 "SEVERITY_NUMBER_FATAL2" => Some(Self::Fatal2),
293 "SEVERITY_NUMBER_FATAL3" => Some(Self::Fatal3),
294 "SEVERITY_NUMBER_FATAL4" => Some(Self::Fatal4),
295 _ => None,
296 }
297 }
298}
299/// LogRecordFlags represents constants used to interpret the
300/// LogRecord.flags field, which is protobuf 'fixed32' type and is to
301/// be used as bit-fields. Each non-zero value defined in this enum is
302/// a bit-mask. To extract the bit-field, for example, use an
303/// expression like:
304///
305/// (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK)
306#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
307#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
308#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
309#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
310#[repr(i32)]
311pub enum LogRecordFlags {
312 /// The zero value for the enum. Should not be used for comparisons.
313 /// Instead use bitwise "and" with the appropriate mask as shown above.
314 DoNotUse = 0,
315 /// Bits 0-7 are used for trace flags.
316 TraceFlagsMask = 255,
317}
318impl LogRecordFlags {
319 /// String value of the enum field names used in the ProtoBuf definition.
320 ///
321 /// The values are not transformed in any way and thus are considered stable
322 /// (if the ProtoBuf definition does not change) and safe for programmatic use.
323 pub fn as_str_name(&self) -> &'static str {
324 match self {
325 Self::DoNotUse => "LOG_RECORD_FLAGS_DO_NOT_USE",
326 Self::TraceFlagsMask => "LOG_RECORD_FLAGS_TRACE_FLAGS_MASK",
327 }
328 }
329 /// Creates an enum from field names used in the ProtoBuf definition.
330 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
331 match value {
332 "LOG_RECORD_FLAGS_DO_NOT_USE" => Some(Self::DoNotUse),
333 "LOG_RECORD_FLAGS_TRACE_FLAGS_MASK" => Some(Self::TraceFlagsMask),
334 _ => None,
335 }
336 }
337}