Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/cargo/once_cell-1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lquerel committed Oct 1, 2024
2 parents b22dd0e + e9f81c0 commit 108ec64
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ serde_json = { version = "1.0.128"}
thiserror = "1.0.64"
url = "2.5.2"
ureq = "2.10.0"
regex = "1.10.6"
regex = "1.11.0"
rayon = "1.10.0"
ordered-float = { version = "4.3.0", features = ["serde", "schemars"] }
walkdir = "2.5.0"
Expand Down
2 changes: 1 addition & 1 deletion crates/weaver_forge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jaq-interpret = "1.5.0"
jaq-parse = "1.0.3"
jaq-syn = "1.1.0"
indexmap = "2.5.0"
regex = "1.10.6"
regex = "1.11.0"
markdown = "=1.0.0-alpha.20"

itertools.workspace = true
Expand Down
1 change: 1 addition & 0 deletions crates/weaver_resolved_schema/src/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ impl Catalog {
RequirementLevel::Basic(BasicRequirementLevelSpec::Optional) => "optional",
RequirementLevel::Recommended { .. } => "recommended",
RequirementLevel::ConditionallyRequired { .. } => "conditionally_required",
RequirementLevel::OptIn { .. } => "opt_in",
};
(requirement_level.to_owned(), 1)
})
Expand Down
4 changes: 2 additions & 2 deletions crates/weaver_semconv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ documentation.

For a formal definition of the allowed syntax, see the [build-tools JSON schema](https://github.com/open-telemetry/build-tools/blob/main/semantic-conventions/semconv.schema.json).

# Design Principles
## Design Principles

- Collect as many warnings and errors as possible. Do not stop at the first error; this approach helps the user fix
multiple issues at once.
- Rely on the Serde ecosystem for serialization and deserialization. This reliance simplifies support for multiple
formats such as YAML, JSON, etc.
- This crate is foundational for the OpenTelemetry Weaver project. Therefore, it is crucial to keep the API stable and
user-friendly. Maintaining a test coverage greater than 80% is important. Test as many as possible error cases/paths.
user-friendly. Maintaining a test coverage greater than 80% is important. Test as many as possible error cases/paths.
16 changes: 16 additions & 0 deletions crates/weaver_semconv/src/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,12 @@ pub enum RequirementLevel {
#[serde(rename = "recommended")]
text: String,
},
/// An opt in requirement level.
OptIn {
/// The description of the recommendation.
#[serde(rename = "opt_in")]
text: String,
},
}

/// Implements a human readable display for RequirementLevel.
Expand All @@ -590,6 +596,7 @@ impl Display for RequirementLevel {
write!(f, "conditionally required (condition: {})", text)
}
RequirementLevel::Recommended { text } => write!(f, "recommended ({})", text),
RequirementLevel::OptIn { text } => write!(f, "opt in ({})", text),
}
}
}
Expand Down Expand Up @@ -694,6 +701,15 @@ mod tests {
),
"recommended (recommendation)"
);
assert_eq!(
format!(
"{}",
RequirementLevel::OptIn {
text: "recommendation".to_owned()
}
),
"opt in (recommendation)"
);
}

#[test]
Expand Down
20 changes: 18 additions & 2 deletions schemas/semconv.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,23 @@
]
},
{
"const": "opt_in"
"oneOf": [
{
"const": "opt_in"
},
{
"type": "object",
"additionalProperties": false,
"required": [
"opt_in"
],
"properties": {
"opt_in": {
"type": "string"
}
}
}
]
}
]
},
Expand Down Expand Up @@ -428,7 +444,7 @@
},
"type": {
"$ref": "#/$defs/AttributeType"
}
}
}
},
"AttributeReference": {
Expand Down

0 comments on commit 108ec64

Please sign in to comment.