diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/client.rs b/crates/weaver_forge/codegen_examples/expected_codegen/client.rs new file mode 100644 index 00000000..d0aa5790 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/client.rs @@ -0,0 +1,26 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! These attributes may be used to describe the client in a connection-based network interaction where there is one side that initiates the connection (the client is the side that initiates the connection). This covers all TCP network interactions since TCP is connection-based and one side initiates the connection (an exception is made for peer-to-peer communication over TCP where the "user-facing" surface of the protocol / API doesn't expose a clear notion of client and server). This also covers UDP network interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. +/// +/// Notes: +/// When observed from the server side, and when communicating through an intermediary, `client.address` SHOULD represent the client address behind any intermediaries, for example proxies, if it's available. +pub const CLIENT_ADDRESS: AttributeKey = AttributeKey::new("client.address"); + + + +/// Client port number. +/// +/// Notes: +/// When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent the client port behind any intermediaries, for example proxies, if it's available. +pub const CLIENT_PORT: AttributeKey = AttributeKey::new("client.port"); + diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/disk.rs b/crates/weaver_forge/codegen_examples/expected_codegen/disk.rs new file mode 100644 index 00000000..6ad2c037 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/disk.rs @@ -0,0 +1,29 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! These attributes may be used for any disk related operation. +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// The disk IO operation direction. +#[cfg(feature = "semconv_experimental")] +pub const DISK_IO_DIRECTION: AttributeKey = AttributeKey::new("disk.io.direction"); + + +/// The disk IO operation direction. +#[non_exhaustive] +pub enum DiskIoDirection { + + #[cfg(feature = "semconv_experimental")] + Read, + + #[cfg(feature = "semconv_experimental")] + Write, + +} + diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/error.rs b/crates/weaver_forge/codegen_examples/expected_codegen/error.rs new file mode 100644 index 00000000..0434861f --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/error.rs @@ -0,0 +1,45 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! This document defines the shared attributes used to report an error. +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// Describes a class of error the operation ended with. +/// +/// Notes: +/// The `error.type` SHOULD be predictable, and SHOULD have low cardinality. +/// +/// When `error.type` is set to a type (e.g., an exception type), its +/// canonical class name identifying the type within the artifact SHOULD be used. +/// +/// Instrumentations SHOULD document the list of errors they report. +/// +/// The cardinality of `error.type` within one instrumentation library SHOULD be low. +/// Telemetry consumers that aggregate data from multiple instrumentation libraries and applications +/// should be prepared for `error.type` to have high cardinality at query time when no +/// additional filters are applied. +/// +/// If the operation has completed successfully, instrumentations SHOULD NOT set `error.type`. +/// +/// If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), +/// it's RECOMMENDED to: +/// +/// * Use a domain-specific attribute +/// * Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not. +pub const ERROR_TYPE: AttributeKey = AttributeKey::new("error.type"); + + +/// Describes a class of error the operation ended with. +#[non_exhaustive] +pub enum ErrorType { + /// A fallback error value to be used when the instrumentation doesn't define a custom value. + Other, + +} + diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/exception.rs b/crates/weaver_forge/codegen_examples/expected_codegen/exception.rs new file mode 100644 index 00000000..d283e009 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/exception.rs @@ -0,0 +1,48 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! This document defines the shared attributes used to report a single exception associated with a span or log. +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. +pub const EXCEPTION_TYPE: AttributeKey = AttributeKey::new("exception.type"); + + + +/// The exception message. +pub const EXCEPTION_MESSAGE: AttributeKey = AttributeKey::new("exception.message"); + + + +/// A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. +pub const EXCEPTION_STACKTRACE: AttributeKey = AttributeKey::new("exception.stacktrace"); + + + +/// SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. +/// +/// Notes: +/// An exception is considered to have escaped (or left) the scope of a span, +/// if that span is ended while the exception is still logically "in flight". +/// This may be actually "in flight" in some languages (e.g. if the exception +/// is passed to a Context manager's `__exit__` method in Python) but will +/// usually be caught at the point of recording the exception in most languages. +/// +/// It is usually not possible to determine at the point where an exception is thrown +/// whether it will escape the scope of a span. +/// However, it is trivial to know that an exception +/// will escape, if one checks for an active exception just before ending the span, +/// as done in the [example for recording span exceptions](#recording-an-exception). +/// +/// It follows that an exception may still escape the scope of the span +/// even if the `exception.escaped` attribute was not set or set to false, +/// since the event might have been recorded at a time where it was not +/// clear whether the exception will escape. +pub const EXCEPTION_ESCAPED: AttributeKey = AttributeKey::new("exception.escaped"); + diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/http.rs b/crates/weaver_forge/codegen_examples/expected_codegen/http.rs new file mode 100644 index 00000000..c7c3f48a --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/http.rs @@ -0,0 +1,139 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! This document defines semantic convention attributes in the HTTP namespace. +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. +#[cfg(feature = "semconv_experimental")] +pub const HTTP_REQUEST_BODY_SIZE: AttributeKey = AttributeKey::new("http.request.body.size"); + + +/// HTTP request headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. +/// +/// Notes: +/// Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information. +/// The `User-Agent` header is already captured in the `user_agent.original` attribute. Users MAY explicitly configure instrumentations to capture them even though it is not recommended. +/// The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers. +pub const HTTP_REQUEST_HEADER: AttributeKey> = AttributeKey::new("http.request.header"); + + +/// HTTP request method. +/// +/// Notes: +/// HTTP request method value SHOULD be "known" to the instrumentation. +/// By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) +/// and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). +/// +/// If the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`. +/// +/// If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override +/// the list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named +/// OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods +/// (this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults). +/// +/// HTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly. +/// Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent. +/// Tracing instrumentations that do so, MUST also set `http.request.method_original` to the original value. +pub const HTTP_REQUEST_METHOD: AttributeKey = AttributeKey::new("http.request.method"); + + +/// HTTP request method. +#[non_exhaustive] +pub enum HttpRequestMethod { + /// CONNECT method. + Connect, + /// DELETE method. + Delete, + /// GET method. + Get, + /// HEAD method. + Head, + /// OPTIONS method. + Options, + /// PATCH method. + Patch, + /// POST method. + Post, + /// PUT method. + Put, + /// TRACE method. + Trace, + /// Any HTTP method that the instrumentation has no prior knowledge of. + Other, + +} + + +/// Original HTTP method sent by the client in the request line. +pub const HTTP_REQUEST_METHOD_ORIGINAL: AttributeKey = AttributeKey::new("http.request.method_original"); + + + +/// The ordinal number of request resending attempt (for any reason, including redirects). +/// +/// Notes: +/// The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other). +pub const HTTP_REQUEST_RESEND_COUNT: AttributeKey = AttributeKey::new("http.request.resend_count"); + + +/// The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and request body if any. +#[cfg(feature = "semconv_experimental")] +pub const HTTP_REQUEST_SIZE: AttributeKey = AttributeKey::new("http.request.size"); + + +/// The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. +#[cfg(feature = "semconv_experimental")] +pub const HTTP_RESPONSE_BODY_SIZE: AttributeKey = AttributeKey::new("http.response.body.size"); + + +/// HTTP response headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. +/// +/// Notes: +/// Instrumentations SHOULD require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information. +/// Users MAY explicitly configure instrumentations to capture them even though it is not recommended. +/// The attribute value MUST consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers. +pub const HTTP_RESPONSE_HEADER: AttributeKey> = AttributeKey::new("http.response.header"); + + +/// The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1), framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any. +#[cfg(feature = "semconv_experimental")] +pub const HTTP_RESPONSE_SIZE: AttributeKey = AttributeKey::new("http.response.size"); + + +/// [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). +pub const HTTP_RESPONSE_STATUS_CODE: AttributeKey = AttributeKey::new("http.response.status_code"); + + +/// The matched route, that is, the path template in the format used by the respective server framework. +/// +/// Notes: +/// MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. +/// SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one. +pub const HTTP_ROUTE: AttributeKey = AttributeKey::new("http.route"); + + + +/// State of the HTTP connection in the HTTP connection pool. +#[cfg(feature = "semconv_experimental")] +pub const HTTP_CONNECTION_STATE: AttributeKey = AttributeKey::new("http.connection.state"); + + +/// State of the HTTP connection in the HTTP connection pool. +#[non_exhaustive] +pub enum HttpConnectionState { + /// active state. + #[cfg(feature = "semconv_experimental")] + Active, + /// idle state. + #[cfg(feature = "semconv_experimental")] + Idle, + +} + diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/lib.rs b/crates/weaver_forge/codegen_examples/expected_codegen/lib.rs new file mode 100644 index 00000000..59c28764 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/lib.rs @@ -0,0 +1,78 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! OpenTelemetry Semantic Convention Attributes +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::{Key, KeyValue, StringValue}; + + +/// These attributes may be used to describe the client in a connection-based network interaction where there is one side that initiates the connection (the client is the side that initiates the connection). This covers all TCP network interactions since TCP is connection-based and one side initiates the connection (an exception is made for peer-to-peer communication over TCP where the "user-facing" surface of the protocol / API doesn't expose a clear notion of client and server). This also covers UDP network interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. +pub mod client; +/// These attributes may be used for any disk related operation. +pub mod disk; +/// This document defines the shared attributes used to report an error. +pub mod error; +/// This document defines the shared attributes used to report a single exception associated with a span or log. +pub mod exception; +/// This document defines semantic convention attributes in the HTTP namespace. +pub mod http; +/// These attributes may be used for any network related operation. +pub mod network; +/// The operating system (OS) on which the process represented by this resource is running. +pub mod os; +/// Attributes reserved for OpenTelemetry +pub mod otel; +/// Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +pub mod otel_scope; + +/// A typed attribute key. +pub struct AttributeKey { + key: Key, + phantom: std::marker::PhantomData +} + +impl AttributeKey { + /// Returns a new [`AttributeKey`] with the given key. + pub(crate) const fn new(key: &'static str) -> AttributeKey { + Self { + key: Key::from_static_str(key), + phantom: std::marker::PhantomData + } + } + + /// Returns the key of the attribute. + pub fn key(&self) -> &Key { + &self.key + } +} + +impl AttributeKey { + /// Returns a [`KeyValue`] pair for the given value. + pub fn value(&self, v: StringValue) -> KeyValue { + KeyValue::new(self.key.clone(), v) + } +} + +impl AttributeKey { + /// Returns a [`KeyValue`] pair for the given value. + pub fn value(&self, v: i64) -> KeyValue { + KeyValue::new(self.key.clone(), v) + } +} + +impl AttributeKey { + /// Returns a [`KeyValue`] pair for the given value. + pub fn value(&self, v: f64) -> KeyValue { + KeyValue::new(self.key.clone(), v) + } +} + +impl AttributeKey { + /// Returns a [`KeyValue`] pair for the given value. + pub fn value(&self, v: bool) -> KeyValue { + KeyValue::new(self.key.clone(), v) + } +} \ No newline at end of file diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/network.rs b/crates/weaver_forge/codegen_examples/expected_codegen/network.rs new file mode 100644 index 00000000..ab321ed2 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/network.rs @@ -0,0 +1,233 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! These attributes may be used for any network related operation. +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. +#[cfg(feature = "semconv_experimental")] +pub const NETWORK_CARRIER_ICC: AttributeKey = AttributeKey::new("network.carrier.icc"); + + + +/// The mobile carrier country code. +#[cfg(feature = "semconv_experimental")] +pub const NETWORK_CARRIER_MCC: AttributeKey = AttributeKey::new("network.carrier.mcc"); + + + +/// The mobile carrier network code. +#[cfg(feature = "semconv_experimental")] +pub const NETWORK_CARRIER_MNC: AttributeKey = AttributeKey::new("network.carrier.mnc"); + + + +/// The name of the mobile carrier. +#[cfg(feature = "semconv_experimental")] +pub const NETWORK_CARRIER_NAME: AttributeKey = AttributeKey::new("network.carrier.name"); + + + +/// This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. +#[cfg(feature = "semconv_experimental")] +pub const NETWORK_CONNECTION_SUBTYPE: AttributeKey = AttributeKey::new("network.connection.subtype"); + + +/// This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. +#[non_exhaustive] +pub enum NetworkConnectionSubtype { + /// GPRS + #[cfg(feature = "semconv_experimental")] + Gprs, + /// EDGE + #[cfg(feature = "semconv_experimental")] + Edge, + /// UMTS + #[cfg(feature = "semconv_experimental")] + Umts, + /// CDMA + #[cfg(feature = "semconv_experimental")] + Cdma, + /// EVDO Rel. 0 + #[cfg(feature = "semconv_experimental")] + Evdo0, + /// EVDO Rev. A + #[cfg(feature = "semconv_experimental")] + EvdoA, + /// CDMA2000 1XRTT + #[cfg(feature = "semconv_experimental")] + Cdma20001Xrtt, + /// HSDPA + #[cfg(feature = "semconv_experimental")] + Hsdpa, + /// HSUPA + #[cfg(feature = "semconv_experimental")] + Hsupa, + /// HSPA + #[cfg(feature = "semconv_experimental")] + Hspa, + /// IDEN + #[cfg(feature = "semconv_experimental")] + Iden, + /// EVDO Rev. B + #[cfg(feature = "semconv_experimental")] + EvdoB, + /// LTE + #[cfg(feature = "semconv_experimental")] + Lte, + /// EHRPD + #[cfg(feature = "semconv_experimental")] + Ehrpd, + /// HSPAP + #[cfg(feature = "semconv_experimental")] + Hspap, + /// GSM + #[cfg(feature = "semconv_experimental")] + Gsm, + /// TD-SCDMA + #[cfg(feature = "semconv_experimental")] + TdScdma, + /// IWLAN + #[cfg(feature = "semconv_experimental")] + Iwlan, + /// 5G NR (New Radio) + #[cfg(feature = "semconv_experimental")] + Nr, + /// 5G NRNSA (New Radio Non-Standalone) + #[cfg(feature = "semconv_experimental")] + Nrnsa, + /// LTE CA + #[cfg(feature = "semconv_experimental")] + LteCa, + +} + + +/// The internet connection type. +#[cfg(feature = "semconv_experimental")] +pub const NETWORK_CONNECTION_TYPE: AttributeKey = AttributeKey::new("network.connection.type"); + + +/// The internet connection type. +#[non_exhaustive] +pub enum NetworkConnectionType { + + #[cfg(feature = "semconv_experimental")] + Wifi, + + #[cfg(feature = "semconv_experimental")] + Wired, + + #[cfg(feature = "semconv_experimental")] + Cell, + + #[cfg(feature = "semconv_experimental")] + Unavailable, + + #[cfg(feature = "semconv_experimental")] + Unknown, + +} + + +/// Local address of the network connection - IP address or Unix domain socket name. +pub const NETWORK_LOCAL_ADDRESS: AttributeKey = AttributeKey::new("network.local.address"); + + + +/// Local port number of the network connection. +pub const NETWORK_LOCAL_PORT: AttributeKey = AttributeKey::new("network.local.port"); + + +/// Peer address of the network connection - IP address or Unix domain socket name. +pub const NETWORK_PEER_ADDRESS: AttributeKey = AttributeKey::new("network.peer.address"); + + + +/// Peer port number of the network connection. +pub const NETWORK_PEER_PORT: AttributeKey = AttributeKey::new("network.peer.port"); + + +/// [OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent. +/// +/// Notes: +/// The value SHOULD be normalized to lowercase. +pub const NETWORK_PROTOCOL_NAME: AttributeKey = AttributeKey::new("network.protocol.name"); + + + +/// The actual version of the protocol used for network communication. +/// +/// Notes: +/// If protocol version is subject to negotiation (for example using [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute SHOULD be set to the negotiated version. If the actual protocol version is not known, this attribute SHOULD NOT be set. +pub const NETWORK_PROTOCOL_VERSION: AttributeKey = AttributeKey::new("network.protocol.version"); + + + +/// [OSI transport layer](https://osi-model.com/transport-layer/) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication). +/// +/// Notes: +/// The value SHOULD be normalized to lowercase. +/// +/// Consider always setting the transport when setting a port number, since +/// a port number is ambiguous without knowing the transport. For example +/// different processes could be listening on TCP port 12345 and UDP port 12345. +pub const NETWORK_TRANSPORT: AttributeKey = AttributeKey::new("network.transport"); + + +/// [OSI transport layer](https://osi-model.com/transport-layer/) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication). +#[non_exhaustive] +pub enum NetworkTransport { + /// TCP + Tcp, + /// UDP + Udp, + /// Named or anonymous pipe. + Pipe, + /// Unix domain socket + Unix, + +} + + +/// [OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent. +/// +/// Notes: +/// The value SHOULD be normalized to lowercase. +pub const NETWORK_TYPE: AttributeKey = AttributeKey::new("network.type"); + + +/// [OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent. +#[non_exhaustive] +pub enum NetworkType { + /// IPv4 + Ipv4, + /// IPv6 + Ipv6, + +} + + +/// The network IO operation direction. +#[cfg(feature = "semconv_experimental")] +pub const NETWORK_IO_DIRECTION: AttributeKey = AttributeKey::new("network.io.direction"); + + +/// The network IO operation direction. +#[non_exhaustive] +pub enum NetworkIoDirection { + + #[cfg(feature = "semconv_experimental")] + Transmit, + + #[cfg(feature = "semconv_experimental")] + Receive, + +} + diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/os.rs b/crates/weaver_forge/codegen_examples/expected_codegen/os.rs new file mode 100644 index 00000000..ae39f23f --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/os.rs @@ -0,0 +1,80 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! The operating system (OS) on which the process represented by this resource is running. +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// The operating system type. +#[cfg(feature = "semconv_experimental")] +pub const OS_TYPE: AttributeKey = AttributeKey::new("os.type"); + + +/// The operating system type. +#[non_exhaustive] +pub enum OsType { + /// Microsoft Windows + #[cfg(feature = "semconv_experimental")] + Windows, + /// Linux + #[cfg(feature = "semconv_experimental")] + Linux, + /// Apple Darwin + #[cfg(feature = "semconv_experimental")] + Darwin, + /// FreeBSD + #[cfg(feature = "semconv_experimental")] + Freebsd, + /// NetBSD + #[cfg(feature = "semconv_experimental")] + Netbsd, + /// OpenBSD + #[cfg(feature = "semconv_experimental")] + Openbsd, + /// DragonFly BSD + #[cfg(feature = "semconv_experimental")] + Dragonflybsd, + /// HP-UX (Hewlett Packard Unix) + #[cfg(feature = "semconv_experimental")] + Hpux, + /// AIX (Advanced Interactive eXecutive) + #[cfg(feature = "semconv_experimental")] + Aix, + /// SunOS, Oracle Solaris + #[cfg(feature = "semconv_experimental")] + Solaris, + /// IBM z/OS + #[cfg(feature = "semconv_experimental")] + ZOs, + +} + + +/// Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands. +#[cfg(feature = "semconv_experimental")] +pub const OS_DESCRIPTION: AttributeKey = AttributeKey::new("os.description"); + + + +/// Human readable operating system name. +#[cfg(feature = "semconv_experimental")] +pub const OS_NAME: AttributeKey = AttributeKey::new("os.name"); + + + +/// The version string of the operating system as defined in [Version Attributes](/docs/resource/README.md#version-attributes). +#[cfg(feature = "semconv_experimental")] +pub const OS_VERSION: AttributeKey = AttributeKey::new("os.version"); + + + +/// Unique identifier for a particular build or compilation of the operating system. +#[cfg(feature = "semconv_experimental")] +pub const OS_BUILD_ID: AttributeKey = AttributeKey::new("os.build_id"); + + diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/otel.rs b/crates/weaver_forge/codegen_examples/expected_codegen/otel.rs new file mode 100644 index 00000000..c6837841 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/otel.rs @@ -0,0 +1,31 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Attributes reserved for OpenTelemetry +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. +pub const OTEL_STATUS_CODE: AttributeKey = AttributeKey::new("otel.status_code"); + + +/// Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. +#[non_exhaustive] +pub enum OtelStatusCode { + /// The operation has been validated by an Application developer or Operator to have completed successfully. + Ok, + /// The operation contains an error. + Error, + +} + + +/// Description of the Status if it has a value, otherwise not set. +pub const OTEL_STATUS_DESCRIPTION: AttributeKey = AttributeKey::new("otel.status_description"); + + diff --git a/crates/weaver_forge/codegen_examples/expected_codegen/otel_scope.rs b/crates/weaver_forge/codegen_examples/expected_codegen/otel_scope.rs new file mode 100644 index 00000000..3e374c5c --- /dev/null +++ b/crates/weaver_forge/codegen_examples/expected_codegen/otel_scope.rs @@ -0,0 +1,21 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + +//! Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. +//! DO NOT EDIT, this is an Auto-generated file from templates/registry/rust/lib.rs.j2 + +use opentelemetry::StringValue; +use crate::AttributeKey; + + +/// The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). +pub const OTEL_SCOPE_NAME: AttributeKey = AttributeKey::new("otel.scope.name"); + + + +/// The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP). +pub const OTEL_SCOPE_VERSION: AttributeKey = AttributeKey::new("otel.scope.version"); + + diff --git a/crates/weaver_forge/codegen_examples/mini_registry/client.yaml b/crates/weaver_forge/codegen_examples/mini_registry/client.yaml new file mode 100644 index 00000000..3b17ed8b --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/client.yaml @@ -0,0 +1,28 @@ +groups: + - id: registry.client + prefix: client + type: attribute_group + brief: > + These attributes may be used to describe the client in a connection-based network interaction + where there is one side that initiates the connection (the client is the side that initiates the connection). + This covers all TCP network interactions since TCP is connection-based and one side initiates the + connection (an exception is made for peer-to-peer communication over TCP where the "user-facing" surface of the + protocol / API doesn't expose a clear notion of client and server). + This also covers UDP network interactions where one side initiates the interaction, e.g. QUIC (HTTP/3) and DNS. + attributes: + - id: address + stability: stable + type: string + brief: "Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name." + note: > + When observed from the server side, and when communicating through an intermediary, `client.address` SHOULD represent + the client address behind any intermediaries, for example proxies, if it's available. + examples: ['client.example.com', '10.1.2.80', '/tmp/my.sock'] + - id: port + stability: stable + type: int + brief: Client port number. + examples: [65123] + note: > + When observed from the server side, and when communicating through an intermediary, `client.port` SHOULD represent + the client port behind any intermediaries, for example proxies, if it's available. diff --git a/crates/weaver_forge/codegen_examples/mini_registry/deprecated/network.yaml b/crates/weaver_forge/codegen_examples/mini_registry/deprecated/network.yaml new file mode 100644 index 00000000..66144671 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/deprecated/network.yaml @@ -0,0 +1,121 @@ +groups: + - id: registry.network.deprecated + prefix: net + type: attribute_group + brief: > + These attributes may be used for any network related operation. + attributes: + - id: sock.peer.name + type: string + deprecated: "Removed." + stability: experimental + brief: Deprecated, no replacement at this time. + examples: ['/var/my.sock'] + - id: sock.peer.addr + type: string + deprecated: "Replaced by `network.peer.address`." + stability: experimental + brief: Deprecated, use `network.peer.address`. + examples: ['192.168.0.1'] + - id: sock.peer.port + type: int + deprecated: "Replaced by `network.peer.port`." + stability: experimental + examples: [65531] + brief: Deprecated, use `network.peer.port`. + - id: peer.name + type: string + deprecated: "Replaced by `server.address` on client spans and `client.address` on server spans." + stability: experimental + brief: Deprecated, use `server.address` on client spans and `client.address` on server spans. + examples: ['example.com'] + - id: peer.port + type: int + deprecated: "Replaced by `server.port` on client spans and `client.port` on server spans." + stability: experimental + brief: Deprecated, use `server.port` on client spans and `client.port` on server spans. + examples: [8080] + - id: host.name + type: string + deprecated: "Replaced by `server.address`." + stability: experimental + brief: Deprecated, use `server.address`. + examples: ['example.com'] + - id: host.port + type: int + deprecated: "Replaced by `server.port`." + stability: experimental + brief: Deprecated, use `server.port`. + examples: [8080] + - id: sock.host.addr + type: string + deprecated: "Replaced by `network.local.address`." + stability: experimental + brief: Deprecated, use `network.local.address`. + examples: ['/var/my.sock'] + - id: sock.host.port + type: int + deprecated: "Replaced by `network.local.port`." + stability: experimental + brief: Deprecated, use `network.local.port`. + examples: [8080] + - id: transport + type: + allow_custom_values: true + members: + - id: ip_tcp + value: "ip_tcp" + stability: experimental + - id: ip_udp + value: "ip_udp" + stability: experimental + - id: pipe + value: "pipe" + brief: 'Named or anonymous pipe.' + stability: experimental + - id: inproc + value: "inproc" + brief: 'In-process communication.' + stability: experimental + note: > + Signals that there is only in-process communication not using a "real" network protocol + in cases where network attributes would normally be expected. Usually all other network + attributes can be left out in that case. + - id: other + value: "other" + stability: experimental + brief: 'Something else (non IP-based).' + deprecated: "Replaced by `network.transport`." + stability: experimental + brief: Deprecated, use `network.transport`. + - id: protocol.name + type: string + deprecated: "Replaced by `network.protocol.name`." + stability: experimental + brief: Deprecated, use `network.protocol.name`. + examples: ['amqp', 'http', 'mqtt'] + - id: protocol.version + type: string + deprecated: "Replaced by `network.protocol.version`." + stability: experimental + brief: Deprecated, use `network.protocol.version`. + examples: '3.1.1' + - id: sock.family + type: + allow_custom_values: true + members: + - id: inet + value: 'inet' + brief: "IPv4 address" + stability: experimental + - id: inet6 + value: 'inet6' + brief: "IPv6 address" + stability: experimental + - id: unix + value: 'unix' + brief: "Unix domain socket path" + stability: experimental + deprecated: "Split to `network.transport` and `network.type`." + stability: experimental + brief: Deprecated, use `network.transport` and `network.type`. diff --git a/crates/weaver_forge/codegen_examples/mini_registry/deprecated/otel.yaml b/crates/weaver_forge/codegen_examples/mini_registry/deprecated/otel.yaml new file mode 100644 index 00000000..c52a51fe --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/deprecated/otel.yaml @@ -0,0 +1,18 @@ +groups: + - id: registry.otel.library.deprecated + prefix: otel.library + type: attribute_group + brief: "Describes deprecated otel.library attributes." + attributes: + - id: name + type: string + deprecated: use the `otel.scope.name` attribute. + stability: experimental + brief: + examples: ['io.opentelemetry.contrib.mongodb'] + - id: version + type: string + deprecated: use the `otel.scope.version` attribute. + stability: experimental + brief: + examples: ['1.0.0'] diff --git a/crates/weaver_forge/codegen_examples/mini_registry/disk.yaml b/crates/weaver_forge/codegen_examples/mini_registry/disk.yaml new file mode 100644 index 00000000..aa8c0911 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/disk.yaml @@ -0,0 +1,20 @@ +groups: + - id: registry.disk + prefix: disk + type: attribute_group + brief: > + These attributes may be used for any disk related operation. + attributes: + - id: io.direction + type: + allow_custom_values: false + members: + - id: read + value: 'read' + stability: experimental + - id: write + value: 'write' + stability: experimental + stability: experimental + brief: "The disk IO operation direction." + examples: ["read"] diff --git a/crates/weaver_forge/codegen_examples/mini_registry/error.yaml b/crates/weaver_forge/codegen_examples/mini_registry/error.yaml new file mode 100644 index 00000000..68bde170 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/error.yaml @@ -0,0 +1,40 @@ +groups: + - id: registry.error + type: attribute_group + prefix: error + brief: > + This document defines the shared attributes used to report an error. + attributes: + - id: type + stability: stable + brief: > + Describes a class of error the operation ended with. + type: + allow_custom_values: true + members: + - id: other + value: "_OTHER" + stability: stable + brief: > + A fallback error value to be used when the instrumentation doesn't define a custom value. + examples: ['timeout', 'java.net.UnknownHostException', 'server_certificate_invalid', '500'] + note: | + The `error.type` SHOULD be predictable, and SHOULD have low cardinality. + + When `error.type` is set to a type (e.g., an exception type), its + canonical class name identifying the type within the artifact SHOULD be used. + + Instrumentations SHOULD document the list of errors they report. + + The cardinality of `error.type` within one instrumentation library SHOULD be low. + Telemetry consumers that aggregate data from multiple instrumentation libraries and applications + should be prepared for `error.type` to have high cardinality at query time when no + additional filters are applied. + + If the operation has completed successfully, instrumentations SHOULD NOT set `error.type`. + + If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), + it's RECOMMENDED to: + + * Use a domain-specific attribute + * Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not. diff --git a/crates/weaver_forge/codegen_examples/mini_registry/exception.yaml b/crates/weaver_forge/codegen_examples/mini_registry/exception.yaml new file mode 100644 index 00000000..7e1b0118 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/exception.yaml @@ -0,0 +1,54 @@ +groups: + - id: registry.exception + type: attribute_group + prefix: exception + brief: > + This document defines the shared attributes used to + report a single exception associated with a span or log. + attributes: + - id: type + type: string + stability: stable + brief: > + The type of the exception (its fully-qualified class name, if applicable). + The dynamic type of the exception should be preferred over the static type + in languages that support it. + examples: ["java.net.ConnectException", "OSError"] + - id: message + type: string + stability: stable + brief: The exception message. + examples: ["Division by zero", "Can't convert 'int' object to str implicitly"] + - id: stacktrace + type: string + stability: stable + brief: > + A stacktrace as a string in the natural representation for the language runtime. + The representation is to be determined and documented by each language SIG. + examples: 'Exception in thread "main" java.lang.RuntimeException: Test exception\n + at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\n + at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\n + at com.example.GenerateTrace.main(GenerateTrace.java:5)' + - id: escaped + type: boolean + stability: stable + brief: > + SHOULD be set to true if the exception event is recorded at a point where + it is known that the exception is escaping the scope of the span. + note: |- + An exception is considered to have escaped (or left) the scope of a span, + if that span is ended while the exception is still logically "in flight". + This may be actually "in flight" in some languages (e.g. if the exception + is passed to a Context manager's `__exit__` method in Python) but will + usually be caught at the point of recording the exception in most languages. + + It is usually not possible to determine at the point where an exception is thrown + whether it will escape the scope of a span. + However, it is trivial to know that an exception + will escape, if one checks for an active exception just before ending the span, + as done in the [example for recording span exceptions](#recording-an-exception). + + It follows that an exception may still escape the scope of the span + even if the `exception.escaped` attribute was not set or set to false, + since the event might have been recorded at a time where it was not + clear whether the exception will escape. diff --git a/crates/weaver_forge/codegen_examples/mini_registry/http.yaml b/crates/weaver_forge/codegen_examples/mini_registry/http.yaml new file mode 100644 index 00000000..e013704a --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/http.yaml @@ -0,0 +1,174 @@ +groups: + - id: registry.http + prefix: http + type: attribute_group + brief: 'This document defines semantic convention attributes in the HTTP namespace.' + attributes: + - id: request.body.size + type: int + brief: > + The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and + is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + header. For requests using transport encoding, this should be the compressed size. + examples: 3495 + stability: experimental # this should not be marked stable with other HTTP attributes + - id: request.header + stability: stable + type: template[string[]] + brief: > + HTTP request headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. + note: > + Instrumentations SHOULD require an explicit configuration of which headers are to be captured. + Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information. + + The `User-Agent` header is already captured in the `user_agent.original` attribute. + Users MAY explicitly configure instrumentations to capture them even though it is not recommended. + + The attribute value MUST consist of either multiple header values as an array of strings + or a single-item array containing a possibly comma-concatenated string, depending on the way + the HTTP library provides access to headers. + examples: ['http.request.header.content-type=["application/json"]', 'http.request.header.x-forwarded-for=["1.2.3.4", "1.2.3.5"]'] + - id: request.method + stability: stable + type: + allow_custom_values: true + members: + - id: connect + value: "CONNECT" + brief: 'CONNECT method.' + stability: stable + - id: delete + value: "DELETE" + brief: 'DELETE method.' + stability: stable + - id: get + value: "GET" + brief: 'GET method.' + stability: stable + - id: head + value: "HEAD" + brief: 'HEAD method.' + stability: stable + - id: options + value: "OPTIONS" + brief: 'OPTIONS method.' + stability: stable + - id: patch + value: "PATCH" + brief: 'PATCH method.' + stability: stable + - id: post + value: "POST" + brief: 'POST method.' + stability: stable + - id: put + value: "PUT" + brief: 'PUT method.' + stability: stable + - id: trace + value: "TRACE" + brief: 'TRACE method.' + stability: stable + - id: other + value: "_OTHER" + brief: 'Any HTTP method that the instrumentation has no prior knowledge of.' + stability: stable + brief: 'HTTP request method.' + examples: ["GET", "POST", "HEAD"] + note: | + HTTP request method value SHOULD be "known" to the instrumentation. + By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + + If the HTTP request method is not known to instrumentation, it MUST set the `http.request.method` attribute to `_OTHER`. + + If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it MUST provide a way to override + the list of known HTTP methods. If this override is done via environment variable, then the environment variable MUST be named + OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods + (this list MUST be a full override of the default known method, it is not a list of known methods in addition to the defaults). + + HTTP method names are case-sensitive and `http.request.method` attribute value MUST match a known HTTP method name exactly. + Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, SHOULD populate a canonical equivalent. + Tracing instrumentations that do so, MUST also set `http.request.method_original` to the original value. + - id: request.method_original + stability: stable + type: string + brief: Original HTTP method sent by the client in the request line. + examples: ["GeT", "ACL", "foo"] + - id: request.resend_count + stability: stable + type: int + brief: > + The ordinal number of request resending attempt (for any reason, including redirects). + note: > + The resend count SHOULD be updated each time an HTTP request gets resent by the client, regardless of what + was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, + or any other). + examples: 3 + - id: request.size + type: int + brief: > + The total size of the request in bytes. This should be the total number of bytes sent over the wire, including the request line (HTTP/1.1), + framing (HTTP/2 and HTTP/3), headers, and request body if any. + examples: 1437 + stability: experimental + - id: response.body.size + type: int + brief: > + The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and + is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) + header. For requests using transport encoding, this should be the compressed size. + examples: 3495 + stability: experimental # this should not be marked stable with other HTTP attributes + - id: response.header + stability: stable + type: template[string[]] + brief: > + HTTP response headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. + note: > + Instrumentations SHOULD require an explicit configuration of which headers are to be captured. + Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information. + + Users MAY explicitly configure instrumentations to capture them even though it is not recommended. + + The attribute value MUST consist of either multiple header values as an array of strings + or a single-item array containing a possibly comma-concatenated string, depending on the way + the HTTP library provides access to headers. + examples: ['http.response.header.content-type=["application/json"]', 'http.response.header.my-custom-header=["abc", "def"]'] + - id: response.size + type: int + brief: > + The total size of the response in bytes. This should be the total number of bytes sent over the wire, including the status line (HTTP/1.1), + framing (HTTP/2 and HTTP/3), headers, and response body and trailers if any. + examples: 1437 + stability: experimental + - id: response.status_code + stability: stable + type: int + brief: '[HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6).' + examples: [200] + - id: route + stability: stable + type: string + brief: > + The matched route, that is, the path template in the format used by the respective server framework. + examples: ['/users/:userID?', '{controller}/{action}/{id?}'] + note: > + MUST NOT be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. + + SHOULD include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one. + - id: connection.state + type: + allow_custom_values: true + members: + - id: active + value: "active" + brief: 'active state.' + stability: experimental + - id: idle + value: "idle" + brief: 'idle state.' + stability: experimental + brief: State of the HTTP connection in the HTTP connection pool. + stability: experimental + examples: ["active", "idle"] diff --git a/crates/weaver_forge/codegen_examples/mini_registry/network.yaml b/crates/weaver_forge/codegen_examples/mini_registry/network.yaml new file mode 100644 index 00000000..2f3f1957 --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/network.yaml @@ -0,0 +1,235 @@ +groups: + - id: registry.network + prefix: network + type: attribute_group + brief: > + These attributes may be used for any network related operation. + attributes: + - id: carrier.icc + type: string + stability: experimental + brief: "The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network." + examples: "DE" + - id: carrier.mcc + type: string + stability: experimental + brief: "The mobile carrier country code." + examples: "310" + - id: carrier.mnc + type: string + stability: experimental + brief: "The mobile carrier network code." + examples: "001" + - id: carrier.name + type: string + stability: experimental + brief: "The name of the mobile carrier." + examples: "sprint" + - id: connection.subtype + type: + allow_custom_values: true + members: + - id: gprs + brief: GPRS + value: "gprs" + stability: experimental + - id: edge + brief: EDGE + value: "edge" + stability: experimental + - id: umts + brief: UMTS + value: "umts" + stability: experimental + - id: cdma + brief: CDMA + value: "cdma" + stability: experimental + - id: evdo_0 + brief: EVDO Rel. 0 + value: "evdo_0" + stability: experimental + - id: evdo_a + brief: "EVDO Rev. A" + value: "evdo_a" + stability: experimental + - id: cdma2000_1xrtt + brief: CDMA2000 1XRTT + value: "cdma2000_1xrtt" + stability: experimental + - id: hsdpa + brief: HSDPA + value: "hsdpa" + stability: experimental + - id: hsupa + brief: HSUPA + value: "hsupa" + stability: experimental + - id: hspa + brief: HSPA + value: "hspa" + stability: experimental + - id: iden + brief: IDEN + value: "iden" + stability: experimental + - id: evdo_b + brief: "EVDO Rev. B" + value: "evdo_b" + stability: experimental + - id: lte + brief: LTE + value: "lte" + stability: experimental + - id: ehrpd + brief: EHRPD + value: "ehrpd" + stability: experimental + - id: hspap + brief: HSPAP + value: "hspap" + stability: experimental + - id: gsm + brief: GSM + value: "gsm" + stability: experimental + - id: td_scdma + brief: TD-SCDMA + value: "td_scdma" + stability: experimental + - id: iwlan + brief: IWLAN + value: "iwlan" + stability: experimental + - id: nr + brief: "5G NR (New Radio)" + value: "nr" + stability: experimental + - id: nrnsa + brief: "5G NRNSA (New Radio Non-Standalone)" + value: "nrnsa" + stability: experimental + - id: lte_ca + brief: LTE CA + value: "lte_ca" + stability: experimental + stability: experimental + brief: 'This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection.' + examples: 'LTE' + - id: connection.type + type: + allow_custom_values: true + members: + - id: wifi + value: "wifi" + stability: experimental + - id: wired + value: "wired" + stability: experimental + - id: cell + value: "cell" + stability: experimental + - id: unavailable + value: "unavailable" + stability: experimental + - id: unknown + value: "unknown" + stability: experimental + stability: experimental + brief: 'The internet connection type.' + examples: 'wifi' + - id: local.address + stability: stable + type: string + brief: Local address of the network connection - IP address or Unix domain socket name. + examples: ['10.1.2.80', '/tmp/my.sock'] + - id: local.port + stability: stable + type: int + brief: Local port number of the network connection. + examples: [65123] + - id: peer.address + stability: stable + type: string + brief: Peer address of the network connection - IP address or Unix domain socket name. + examples: ['10.1.2.80', '/tmp/my.sock'] + - id: peer.port + stability: stable + type: int + brief: Peer port number of the network connection. + examples: [65123] + - id: protocol.name + stability: stable + type: string + brief: '[OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent.' + note: The value SHOULD be normalized to lowercase. + examples: ['amqp', 'http', 'mqtt'] + - id: protocol.version + stability: stable + type: string + brief: The actual version of the protocol used for network communication. + examples: ['1.1', '2'] + note: > + If protocol version is subject to negotiation (for example using [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), + this attribute SHOULD be set to the negotiated version. If the actual protocol version is not known, + this attribute SHOULD NOT be set. + - id: transport + stability: stable + type: + allow_custom_values: true + members: + - id: tcp + value: 'tcp' + brief: "TCP" + stability: stable + - id: udp + value: 'udp' + brief: "UDP" + stability: stable + - id: pipe + value: "pipe" + brief: 'Named or anonymous pipe.' + stability: stable + - id: unix + value: 'unix' + brief: "Unix domain socket" + stability: stable + brief: > + [OSI transport layer](https://osi-model.com/transport-layer/) or + [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication). + note: | + The value SHOULD be normalized to lowercase. + + Consider always setting the transport when setting a port number, since + a port number is ambiguous without knowing the transport. For example + different processes could be listening on TCP port 12345 and UDP port 12345. + examples: ['tcp', 'udp'] + - id: type + stability: stable + type: + allow_custom_values: true + members: + - id: ipv4 + value: 'ipv4' + brief: "IPv4" + stability: stable + - id: ipv6 + value: 'ipv6' + brief: "IPv6" + stability: stable + brief: '[OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent.' + note: The value SHOULD be normalized to lowercase. + examples: ['ipv4', 'ipv6'] + - id: io.direction + type: + allow_custom_values: false + members: + - id: transmit + value: 'transmit' + stability: experimental + - id: receive + value: 'receive' + stability: experimental + stability: experimental + brief: "The network IO operation direction." + examples: ["transmit"] diff --git a/crates/weaver_forge/codegen_examples/mini_registry/os.yaml b/crates/weaver_forge/codegen_examples/mini_registry/os.yaml new file mode 100644 index 00000000..3317958f --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/os.yaml @@ -0,0 +1,85 @@ +groups: + - id: registry.os + prefix: os + type: attribute_group + brief: > + The operating system (OS) on which the process represented by this resource is running. + note: > + In case of virtualized environments, this is the operating system as it is observed by + the process, i.e., the virtualized guest rather than the underlying host. + attributes: + - id: type + type: + allow_custom_values: true + members: + - id: windows + value: 'windows' + brief: "Microsoft Windows" + stability: experimental + - id: linux + value: 'linux' + brief: "Linux" + stability: experimental + - id: darwin + value: 'darwin' + brief: "Apple Darwin" + stability: experimental + - id: freebsd + value: 'freebsd' + brief: "FreeBSD" + stability: experimental + - id: netbsd + value: 'netbsd' + brief: "NetBSD" + stability: experimental + - id: openbsd + value: 'openbsd' + brief: "OpenBSD" + stability: experimental + - id: dragonflybsd + value: 'dragonflybsd' + brief: "DragonFly BSD" + stability: experimental + - id: hpux + value: 'hpux' + brief: "HP-UX (Hewlett Packard Unix)" + stability: experimental + - id: aix + value: 'aix' + brief: "AIX (Advanced Interactive eXecutive)" + stability: experimental + - id: solaris + value: 'solaris' + brief: "SunOS, Oracle Solaris" + stability: experimental + - id: z_os + value: 'z_os' + brief: "IBM z/OS" + stability: experimental + brief: > + The operating system type. + stability: experimental + - id: description + type: string + stability: experimental + brief: > + Human readable (not intended to be parsed) OS version information, + like e.g. reported by `ver` or `lsb_release -a` commands. + examples: ['Microsoft Windows [Version 10.0.18363.778]', 'Ubuntu 18.04.1 LTS'] + - id: name + type: string + stability: experimental + brief: 'Human readable operating system name.' + examples: ['iOS', 'Android', 'Ubuntu'] + - id: version + type: string + stability: experimental + brief: > + The version string of the operating system as defined in + [Version Attributes](/docs/resource/README.md#version-attributes). + examples: ['14.2.1', '18.04.1'] + - id: build_id + type: string + stability: experimental + brief: 'Unique identifier for a particular build or compilation of the operating system.' + examples: ['TQ3C.230805.001.B2', '20E247', '22621'] diff --git a/crates/weaver_forge/codegen_examples/mini_registry/otel.yaml b/crates/weaver_forge/codegen_examples/mini_registry/otel.yaml new file mode 100644 index 00000000..76286cdc --- /dev/null +++ b/crates/weaver_forge/codegen_examples/mini_registry/otel.yaml @@ -0,0 +1,40 @@ +groups: + - id: registry.otel + prefix: otel + type: attribute_group + brief: Attributes reserved for OpenTelemetry + attributes: + - id: status_code + type: + allow_custom_values: true + members: + - id: ok + value: OK + brief: 'The operation has been validated by an Application developer or Operator to have completed successfully.' + stability: stable + - id: error + value: ERROR + brief: 'The operation contains an error.' + stability: stable + brief: Name of the code, either "OK" or "ERROR". MUST NOT be set if the status code is UNSET. + stability: stable + - id: status_description + type: string + brief: "Description of the Status if it has a value, otherwise not set." + examples: ['resource not found'] + stability: stable + - id: registry.otel.scope + prefix: otel.scope + type: attribute_group + brief: Attributes used by non-OTLP exporters to represent OpenTelemetry Scope's concepts. + attributes: + - id: name + type: string + brief: The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). + examples: ['io.opentelemetry.contrib.mongodb'] + stability: stable + - id: version + type: string + brief: The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + examples: ['1.0.0'] + stability: stable