Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ jobs:
run: cargo test --workspace --no-default-features
- name: History check
run: cargo xtask history
- name: Schema compat check
run: cargo xtask schema-compat
msrv:
name: Check MSRV
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/weaver_resolved_schema/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ pub use error::Error;
pub const OTEL_REGISTRY_ID: &str = "OTEL";

/// Version string denoting V1 resolved schema.
pub(crate) const V1_RESOLVED_FILE_FORMAT: &str = "resolved/1.0.0";
pub(crate) const V1_RESOLVED_FILE_FORMAT: &str = "resolved/1.0";
/// Version string denoting V2 resolved schema.
pub(crate) const V2_RESOLVED_FILE_FORMAT: &str = "resolved/2.0.0";
pub(crate) const V2_RESOLVED_FILE_FORMAT: &str = "resolved/2.0";

/// A Resolved Telemetry Schema.
/// A Resolved Telemetry Schema is self-contained and doesn't contain any
Expand Down
2 changes: 2 additions & 0 deletions crates/weaver_resolved_schema/src/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ pub mod stats;
#[serde(deny_unknown_fields)]
pub struct ResolvedTelemetrySchema {
/// Version of the file structure.
/// Always `"resolved/2.0"` in this version.
#[schemars(extend("const" = "resolved/2.0"))]
pub file_format: String,
/// Schema URL that this file is published at.
pub schema_url: SchemaUrl,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: manifest/2.0.0
file_format: manifest/2.0
stability: stable
schema_url: https://opentelemetry.io/schemas/1.0.0
resolved_schema_uri: resolved_schema.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: resolved/2.0.0
file_format: resolved/2.0
schema_url: https://opentelemetry.io/schemas/1.0.0
attribute_catalog:
- key: a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: manifest/2.0.0
file_format: manifest/2.0
stability: stable
schema_url: https://opentelemetry.io/schemas/1.0.0
resolved_schema_uri: resolved_schema.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: resolved/2.0.0
file_format: resolved/2.0
schema_url: https://opentelemetry.io/schemas/1.0.0
attribute_catalog:
- key: a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: resolved/2.0.0
file_format: resolved/2.0
schema_url: https://opentelemetry.io/schemas/1.0.0
attribute_catalog:
- key: local.attr
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: manifest/2.0.0
file_format: manifest/2.0
stability: stable
schema_url: https://example.com/schemas/1.2.3
resolved_schema_uri: resolved_schema.yaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: resolved/2.0.0
file_format: resolved/2.0
schema_url: https://opentelemetry.io/schemas/1.0.0
attribute_catalog:
- key: a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: manifest/2.0.0
file_format: manifest/2.0
schema_url: https://consumer.example.com/schemas/1.0.0
description: Consumer registry that depends on the server V2 package.
dependencies:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: resolved/2.0.0
file_format: resolved/2.0
schema_url: https://consumer.example.com/schemas/1.0.0
attribute_catalog:
- key: server.port
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: manifest/2.0.0
file_format: manifest/2.0
schema_url: https://server.example.com/schemas/1.0.0
description: Server semantic conventions.
stability: development
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: resolved/2.0.0
file_format: resolved/2.0
schema_url: https://server.example.com/schemas/1.0.0
attribute_catalog:
- key: server.port
Expand Down
2 changes: 1 addition & 1 deletion crates/weaver_resolver/src/dependency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ mod tests {

fn example_v2_schema() -> weaver_resolved_schema::v2::ResolvedTelemetrySchema {
weaver_resolved_schema::v2::ResolvedTelemetrySchema {
file_format: "resolved/2.0.0".to_owned(),
file_format: "resolved/2.0".to_owned(),
schema_url: "http://test/schemas/2.0.0".try_into().unwrap(),
registry: weaver_resolved_schema::v2::registry::Registry {
attribute_groups: vec![
Expand Down
14 changes: 7 additions & 7 deletions crates/weaver_semconv/src/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use serde::{Deserialize, Deserializer, Serialize};
use weaver_common::vdir::VirtualDirectoryPath;

/// The file format version of the publication manifest.
pub const PUBLICATION_MANIFEST_FILE_FORMAT: &str = "manifest/2.0.0";
pub const PUBLICATION_MANIFEST_FILE_FORMAT: &str = "manifest/2.0";

/// Represents the definition manifest for a semantic convention registry.
///
Expand Down Expand Up @@ -234,7 +234,7 @@ impl RawManifestFields {
/// A registry manifest that can be either a definition or a publication manifest.
///
/// The `file_format` field is the discriminator:
/// - `"manifest/2.0.0"` → [`PublicationRegistryManifest`]
/// - `"manifest/2.0"` → [`PublicationRegistryManifest`]
/// - absent → [`DefinitionRegistryManifest`]
#[derive(Debug, Clone, JsonSchema)]
#[serde(untagged)]
Expand Down Expand Up @@ -336,8 +336,8 @@ impl RegistryManifest {
#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
pub struct PublicationRegistryManifest {
/// The file format version of this publication manifest.
/// Always `"manifest/2.0.0"`in this version.
#[schemars(extend("const" = "manifest/2.0.0"))]
/// Always `"manifest/2.0"`in this version.
#[schemars(extend("const" = "manifest/2.0"))]
pub file_format: String,

/// The schema URL for this registry.
Expand Down Expand Up @@ -641,7 +641,7 @@ stability: stable
fn test_publication_manifest_parsed_as_publication_variant() {
let manifest = manifest_from_yaml(
r#"
file_format: "manifest/2.0.0"
file_format: "manifest/2.0"
schema_url: "https://example.com/schemas/1.0.0"
resolved_schema_uri: "https://example.com/resolved/1.0.0/resolved.yaml"
"#,
Expand Down Expand Up @@ -701,12 +701,12 @@ stability: stable

#[test]
fn test_publication_manifest_parsed_as_publication_variant() {
// A manifest with file_format "manifest/2.0.0" and resolved_schema_uri
// A manifest with file_format "manifest/2.0" and resolved_schema_uri
// is parsed as the Publication variant.
let manifest = manifest_from_yaml(
r#"
schema_url: "https://example.com/schemas/1.0.0"
file_format: "manifest/2.0.0"
file_format: "manifest/2.0"
resolved_schema_uri: "https://example.com/resolved/1.0.0/resolved.yaml"
"#,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: manifest/2.0.0
file_format: manifest/2.0
description: Test repository that has been resolved.
schema_url: http://resolved/3.0.0
repository_url: https://github.com/open-telemetry/weaver.git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: manifest/2.0.0
file_format: manifest/2.0
description: Test repository that has been resolved.
schema_url: http://resolved/1.0.0
repository_url: https://github.com/open-telemetry/weaver.git
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
file_format: manifest/2.0.0
file_format: manifest/2.0
description: Test repository that has been resolved.
schema_url: http://resolved/2.0.0
repository_url: https://github.com/open-telemetry/weaver.git
Expand Down
2 changes: 1 addition & 1 deletion crates/weaver_semconv_gen/src/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ mod tests {

fn test_registry() -> ResolvedTelemetrySchema {
ResolvedTelemetrySchema {
file_format: "resolved/2.0.0".to_owned(),
file_format: "resolved/2.0".to_owned(),
schema_url: "https://todo/1.0.0".try_into().unwrap(),
attribute_catalog: vec![Attribute {
key: "attr1".to_owned(),
Expand Down
1 change: 1 addition & 0 deletions crates/xtask/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rust-version.workspace = true
[dependencies]
anyhow.workspace = true
assert_cmd = "2.0.17"
serde_json.workspace = true
gix = { version = "0.79.0", default-features = false, features = [
"comfort",
"blocking-http-transport-reqwest",
Expand Down
3 changes: 3 additions & 0 deletions crates/xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#![allow(clippy::print_stderr)]

mod history;
mod schema_compat;
mod validate;

#[cfg(not(tarpaulin_include))]
Expand All @@ -22,6 +23,7 @@ fn main() -> anyhow::Result<()> {
Some(task) => match task.as_str() {
"validate" => validate::run(),
"history" => history::run(std::env::args().nth(2)),
"schema-compat" => schema_compat::run(),
"help" => print_help(),
_ => {
eprintln!("Unknown task: {task}");
Expand All @@ -42,6 +44,7 @@ Tasks:
- validate: Validate the entire structure of the weaver project.
- history: Run registry check on semconv models within back compatibility range.
Optionally provide a start semver e.g. `history 1.29.0`.
- schema-compat: Check JSON schema backwards and forwards compatibility against the latest release.
"
);
Ok(())
Expand Down
Loading
Loading