// SPDX-License-Identifier: Apache-2.0 //! Generated attribute constants and enum types for live check findings. //! //! DO NOT EDIT — this file is generated by Weaver from `model/live_check.yaml`. //! To regenerate, run from the repository root: //! //! ```sh //! weaver registry generate \ //! --registry crates/weaver_live_check/model/ \ //! --templates crates/weaver_live_check/templates/ \ //! --v2 \ //! rust \ //! crates/weaver_live_check/src/ //! ``` use serde::{Deserialize, Serialize}; // --- Attribute name constants --- /// Additional contextual information about the finding pub const WEAVER_FINDING_CONTEXT: &str = "weaver.finding.context"; /// Unique identifier for the type of finding detected by the policy engine pub const WEAVER_FINDING_ID: &str = "weaver.finding.id"; /// Severity level of the semantic convention finding pub const WEAVER_FINDING_LEVEL: &str = "weaver.finding.level"; /// Resource attributes from the original telemetry source that produced the finding pub const WEAVER_FINDING_RESOURCE_ATTRIBUTE: &str = "weaver.finding.resource.attribute"; /// The type of telemetry sample being validated pub const WEAVER_FINDING_SAMPLE_TYPE: &str = "weaver.finding.sample.type"; /// The name of the specific signal being validated pub const WEAVER_FINDING_SIGNAL_NAME: &str = "weaver.finding.signal.name"; /// The OpenTelemetry signal type that the finding applies to pub const WEAVER_FINDING_SIGNAL_TYPE: &str = "weaver.finding.signal.type"; // --- Enums --- /// Unique identifier for the type of finding detected by the policy engine /// /// The finding ID is a stable, machine-readable identifier that categorizes the issue. /// It can be used to filter, aggregate, or suppress specific finding types. /// /// IDs prefixed with common patterns indicate the source: built-in advisors produce /// findings like `missing_attribute` and `type_mismatch`, requirement-level checks /// produce `*_attribute_not_present` findings, and Rego policies produce findings /// like `missing_namespace` and `invalid_format`. /// /// Custom Rego policies may emit additional finding IDs not listed here. /// /// The `Custom` variant accepts values not listed above. #[derive( Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize, strum::Display, strum::EnumString, )] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum FindingId { /// An attribute is not defined in the semantic convention registry MissingAttribute, /// An attribute matched a template definition in the registry TemplateAttribute, /// A metric is not defined in the semantic convention registry MissingMetric, /// An event is not defined in the semantic convention registry MissingEvent, /// A deprecated attribute or signal is in use Deprecated, /// An attribute value type does not match the type defined in the registry TypeMismatch, /// An attribute or signal has not reached stable status NotStable, /// A metric unit does not match the unit defined in the registry UnitMismatch, /// A metric instrument type does not match or is not supported by the registry UnexpectedInstrument, /// An enum attribute value is not in the set of allowed members UndefinedEnumVariant, /// A required attribute is absent from the sample RequiredAttributeNotPresent, /// A recommended attribute is absent from the sample RecommendedAttributeNotPresent, /// An opt-in attribute is absent from the sample OptInAttributeNotPresent, /// A conditionally required attribute is absent from the sample ConditionallyRequiredAttributeNotPresent, /// A required entity attribute is absent from the resource EntityRequiredAttributeNotPresent, /// A recommended entity attribute is absent from the resource EntityRecommendedAttributeNotPresent, /// An opt-in entity attribute is absent from the resource EntityOptInAttributeNotPresent, /// A conditionally required entity attribute is absent from the resource EntityConditionallyRequiredAttributeNotPresent, /// No entity in a one_of association group was satisfied by the resource EntityAssociationNotSatisfied, /// An attribute name has no dot-separated namespace MissingNamespace, /// An attribute or metric name does not match the required naming format InvalidFormat, /// An attribute name uses a namespace that collides with an existing attribute IllegalNamespace, /// An attribute name shares a namespace prefix with existing registry attributes ExtendsNamespace, /// A value not defined in the known variants #[serde(untagged)] #[strum(default)] Custom(String), } impl From for String { fn from(id: FindingId) -> Self { id.to_string() } } impl From for FindingId { fn from(s: String) -> Self { s.parse().unwrap_or(Self::Custom(s)) } } /// Severity level of the semantic convention finding /// /// The level indicates how serious the finding is and what action should be taken. Violations should be addressed to achieve compliance, improvements are recommended for better quality, and information is provided for context. #[derive( Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, strum::Display, strum::EnumString, )] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum FindingLevel { /// A finding that breaks semantic convention compliance rules Violation, /// A suggested change that would improve semantic convention compliance Improvement, /// Useful context about the telemetry without requiring action Information, } /// The type of telemetry sample being validated /// /// This indicates what kind of OpenTelemetry data structure was analyzed. /// The sample type helps categorize findings and understand which part of /// the telemetry pipeline generated the issue. #[derive( Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, strum::Display, strum::EnumString, )] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum SampleType { /// A standalone attribute being validated Attribute, /// A span Span, /// An event attached to a span SpanEvent, /// A link between spans SpanLink, /// A resource describing the telemetry source Resource, /// An instrumentation scope that produced telemetry signals InstrumentationScope, /// A metric measurement Metric, /// A numeric data point within a metric NumberDataPoint, /// A histogram data point within a metric HistogramDataPoint, /// An exponential histogram data point within a metric ExponentialHistogramDataPoint, /// An exemplar (sample measurement) attached to a metric data point Exemplar, /// A log record or event Log, /// A profiling data sample Profile, } /// The OpenTelemetry signal type that the finding applies to /// /// The signal type categorizes the finding according to the OpenTelemetry data model. /// This helps correlate findings with specific parts of an observability system /// (traces, metrics, or logs). #[derive( Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, strum::Display, strum::EnumString, )] #[serde(rename_all = "snake_case")] #[strum(serialize_all = "snake_case")] pub enum SignalType { /// Distributed tracing span signal Span, /// Resource describing the telemetry source Resource, /// Numeric measurement signal Metric, /// Log record or event signal Log, /// Profiling data signal Profile, }