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    ///    - Use time_unix_nano if it is present, otherwise use observed_time_unix_nano.
103    ///
104    /// Value is UNIX Epoch time in nanoseconds since 00:00:00 UTC on 1 January 1970.
105    /// Value of 0 indicates unknown or missing timestamp.
106    #[prost(fixed64, tag = "11")]
107    #[cfg_attr(
108        feature = "with-serde",
109        serde(
110            serialize_with = "crate::proto::serializers::serialize_u64_to_string",
111            deserialize_with = "crate::proto::serializers::deserialize_string_to_u64"
112        )
113    )]
114    pub observed_time_unix_nano: u64,
115    /// Numerical value of the severity, normalized to values described in Log Data Model.
116    /// \[Optional\].
117    #[prost(enumeration = "SeverityNumber", tag = "2")]
118    pub severity_number: i32,
119    /// The severity text (also known as log level). The original string representation as
120    /// it is known at the source. \[Optional\].
121    #[prost(string, tag = "3")]
122    pub severity_text: ::prost::alloc::string::String,
123    /// A value containing the body of the log record. Can be for example a human-readable
124    /// string message (including multi-line) describing the event in a free form or it can
125    /// be a structured data composed of arrays and maps of other values. \[Optional\].
126    #[prost(message, optional, tag = "5")]
127    pub body: ::core::option::Option<super::super::common::v1::AnyValue>,
128    /// Additional attributes that describe the specific event occurrence. \[Optional\].
129    /// Attribute keys MUST be unique (it is not allowed to have more than one
130    /// attribute with the same key).
131    #[prost(message, repeated, tag = "6")]
132    pub attributes: ::prost::alloc::vec::Vec<super::super::common::v1::KeyValue>,
133    #[prost(uint32, tag = "7")]
134    pub dropped_attributes_count: u32,
135    /// Flags, a bit field. 8 least significant bits are the trace flags as
136    /// defined in W3C Trace Context specification. 24 most significant bits are reserved
137    /// and must be set to 0. Readers must not assume that 24 most significant bits
138    /// will be zero and must correctly mask the bits when reading 8-bit trace flag (use
139    /// flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK). \[Optional\].
140    #[prost(fixed32, tag = "8")]
141    pub flags: u32,
142    /// A unique identifier for a trace. All logs from the same trace share
143    /// the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes OR
144    /// of length other than 16 bytes is considered invalid (empty string in OTLP/JSON
145    /// is zero-length and thus is also invalid).
146    ///
147    /// This field is optional.
148    ///
149    /// The receivers SHOULD assume that the log record is not associated with a
150    /// trace if any of the following is true:
151    ///    - the field is not present,
152    ///    - the field contains an invalid value.
153    #[prost(bytes = "vec", tag = "9")]
154    #[cfg_attr(
155        feature = "with-serde",
156        serde(
157            serialize_with = "crate::proto::serializers::serialize_to_hex_string",
158            deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
159        )
160    )]
161    pub trace_id: ::prost::alloc::vec::Vec<u8>,
162    /// A unique identifier for a span within a trace, assigned when the span
163    /// is created. The ID is an 8-byte array. An ID with all zeroes OR of length
164    /// other than 8 bytes is considered invalid (empty string in OTLP/JSON
165    /// is zero-length and thus is also invalid).
166    ///
167    /// This field is optional. If the sender specifies a valid span_id then it SHOULD also
168    /// specify a valid trace_id.
169    ///
170    /// The receivers SHOULD assume that the log record is not associated with a
171    /// span if any of the following is true:
172    ///    - the field is not present,
173    ///    - the field contains an invalid value.
174    #[prost(bytes = "vec", tag = "10")]
175    #[cfg_attr(
176        feature = "with-serde",
177        serde(
178            serialize_with = "crate::proto::serializers::serialize_to_hex_string",
179            deserialize_with = "crate::proto::serializers::deserialize_from_hex_string"
180        )
181    )]
182    pub span_id: ::prost::alloc::vec::Vec<u8>,
183    /// A unique identifier of event category/type.
184    /// All events with the same event_name are expected to conform to the same
185    /// schema for both their attributes and their body.
186    ///
187    /// Recommended to be fully qualified and short (no longer than 256 characters).
188    ///
189    /// Presence of event_name on the log record identifies this record
190    /// as an event.
191    ///
192    /// \[Optional\].
193    ///
194    /// Status: \[Development\]
195    #[prost(string, tag = "12")]
196    pub event_name: ::prost::alloc::string::String,
197}
198/// Possible values for LogRecord.SeverityNumber.
199#[cfg_attr(feature = "with-schemars", derive(schemars::JsonSchema))]
200#[cfg_attr(feature = "with-serde", derive(serde::Serialize, serde::Deserialize))]
201#[cfg_attr(feature = "with-serde", serde(rename_all = "camelCase"))]
202#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
203#[repr(i32)]
204pub enum SeverityNumber {
205    /// UNSPECIFIED is the default SeverityNumber, it MUST NOT be used.
206    Unspecified = 0,
207    Trace = 1,
208    Trace2 = 2,
209    Trace3 = 3,
210    Trace4 = 4,
211    Debug = 5,
212    Debug2 = 6,
213    Debug3 = 7,
214    Debug4 = 8,
215    Info = 9,
216    Info2 = 10,
217    Info3 = 11,
218    Info4 = 12,
219    Warn = 13,
220    Warn2 = 14,
221    Warn3 = 15,
222    Warn4 = 16,
223    Error = 17,
224    Error2 = 18,
225    Error3 = 19,
226    Error4 = 20,
227    Fatal = 21,
228    Fatal2 = 22,
229    Fatal3 = 23,
230    Fatal4 = 24,
231}
232impl SeverityNumber {
233    /// String value of the enum field names used in the ProtoBuf definition.
234    ///
235    /// The values are not transformed in any way and thus are considered stable
236    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
237    pub fn as_str_name(&self) -> &'static str {
238        match self {
239            Self::Unspecified => "SEVERITY_NUMBER_UNSPECIFIED",
240            Self::Trace => "SEVERITY_NUMBER_TRACE",
241            Self::Trace2 => "SEVERITY_NUMBER_TRACE2",
242            Self::Trace3 => "SEVERITY_NUMBER_TRACE3",
243            Self::Trace4 => "SEVERITY_NUMBER_TRACE4",
244            Self::Debug => "SEVERITY_NUMBER_DEBUG",
245            Self::Debug2 => "SEVERITY_NUMBER_DEBUG2",
246            Self::Debug3 => "SEVERITY_NUMBER_DEBUG3",
247            Self::Debug4 => "SEVERITY_NUMBER_DEBUG4",
248            Self::Info => "SEVERITY_NUMBER_INFO",
249            Self::Info2 => "SEVERITY_NUMBER_INFO2",
250            Self::Info3 => "SEVERITY_NUMBER_INFO3",
251            Self::Info4 => "SEVERITY_NUMBER_INFO4",
252            Self::Warn => "SEVERITY_NUMBER_WARN",
253            Self::Warn2 => "SEVERITY_NUMBER_WARN2",
254            Self::Warn3 => "SEVERITY_NUMBER_WARN3",
255            Self::Warn4 => "SEVERITY_NUMBER_WARN4",
256            Self::Error => "SEVERITY_NUMBER_ERROR",
257            Self::Error2 => "SEVERITY_NUMBER_ERROR2",
258            Self::Error3 => "SEVERITY_NUMBER_ERROR3",
259            Self::Error4 => "SEVERITY_NUMBER_ERROR4",
260            Self::Fatal => "SEVERITY_NUMBER_FATAL",
261            Self::Fatal2 => "SEVERITY_NUMBER_FATAL2",
262            Self::Fatal3 => "SEVERITY_NUMBER_FATAL3",
263            Self::Fatal4 => "SEVERITY_NUMBER_FATAL4",
264        }
265    }
266    /// Creates an enum from field names used in the ProtoBuf definition.
267    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
268        match value {
269            "SEVERITY_NUMBER_UNSPECIFIED" => Some(Self::Unspecified),
270            "SEVERITY_NUMBER_TRACE" => Some(Self::Trace),
271            "SEVERITY_NUMBER_TRACE2" => Some(Self::Trace2),
272            "SEVERITY_NUMBER_TRACE3" => Some(Self::Trace3),
273            "SEVERITY_NUMBER_TRACE4" => Some(Self::Trace4),
274            "SEVERITY_NUMBER_DEBUG" => Some(Self::Debug),
275            "SEVERITY_NUMBER_DEBUG2" => Some(Self::Debug2),
276            "SEVERITY_NUMBER_DEBUG3" => Some(Self::Debug3),
277            "SEVERITY_NUMBER_DEBUG4" => Some(Self::Debug4),
278            "SEVERITY_NUMBER_INFO" => Some(Self::Info),
279            "SEVERITY_NUMBER_INFO2" => Some(Self::Info2),
280            "SEVERITY_NUMBER_INFO3" => Some(Self::Info3),
281            "SEVERITY_NUMBER_INFO4" => Some(Self::Info4),
282            "SEVERITY_NUMBER_WARN" => Some(Self::Warn),
283            "SEVERITY_NUMBER_WARN2" => Some(Self::Warn2),
284            "SEVERITY_NUMBER_WARN3" => Some(Self::Warn3),
285            "SEVERITY_NUMBER_WARN4" => Some(Self::Warn4),
286            "SEVERITY_NUMBER_ERROR" => Some(Self::Error),
287            "SEVERITY_NUMBER_ERROR2" => Some(Self::Error2),
288            "SEVERITY_NUMBER_ERROR3" => Some(Self::Error3),
289            "SEVERITY_NUMBER_ERROR4" => Some(Self::Error4),
290            "SEVERITY_NUMBER_FATAL" => Some(Self::Fatal),
291            "SEVERITY_NUMBER_FATAL2" => Some(Self::Fatal2),
292            "SEVERITY_NUMBER_FATAL3" => Some(Self::Fatal3),
293            "SEVERITY_NUMBER_FATAL4" => Some(Self::Fatal4),
294            _ => None,
295        }
296    }
297}
298/// LogRecordFlags represents constants used to interpret the
299/// LogRecord.flags field, which is protobuf 'fixed32' type and is to
300/// be used as bit-fields. Each non-zero value defined in this enum is
301/// a bit-mask.  To extract the bit-field, for example, use an
302/// expression like:
303///
304///    (logRecord.flags & LOG_RECORD_FLAGS_TRACE_FLAGS_MASK)
305///
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}