Skip to content

Commit a6294f1

Browse files
committed
update schemas, clean up versions and file_format
1 parent 5702209 commit a6294f1

33 files changed

Lines changed: 137 additions & 177 deletions

File tree

crates/weaver_emit/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ mod tests {
590590
};
591591

592592
let registry = ForgeResolvedRegistry {
593-
file_format: "2.0.0".to_owned(),
593+
file_format: "2/materialized".to_owned(),
594594
schema_url: "TEST_SCHEMA_URL".to_owned(),
595595
registry: Registry {
596596
attributes: vec![],

crates/weaver_forge/data/http.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2"
1+
file_format: "2"
22
attribute_groups:
33
- id: http.client.server_and_port
44
visibility: internal

crates/weaver_forge/data/registry-http.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2"
1+
file_format: "2"
22
attributes:
33
- key: http.request.body.size
44
type: int

crates/weaver_forge/src/v2/registry.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ use crate::{
1616
},
1717
};
1818

19+
fn forge_file_format() -> String {
20+
"2/materialized".to_owned()
21+
}
1922
/// A resolved semantic convention registry used in the context of the template and policy
2023
/// engines.
2124
///
@@ -24,6 +27,7 @@ use crate::{
2427
#[serde(deny_unknown_fields)]
2528
pub struct ForgeResolvedRegistry {
2629
/// Version of the file structure.
30+
#[serde(default = "forge_file_format")]
2731
pub file_format: String,
2832
/// Schema URL for corresponding resolved schema version
2933
#[serde(skip_serializing_if = "String::is_empty")]
@@ -414,7 +418,7 @@ impl ForgeResolvedRegistry {
414418
}
415419

416420
Ok(Self {
417-
file_format: schema.file_format,
421+
file_format: "2/materialized".to_owned(),
418422
schema_url: schema.schema_url.clone(),
419423
registry: Registry {
420424
attributes,
@@ -449,17 +453,15 @@ mod tests {
449453
#[test]
450454
fn test_try_from_resolved_schema() {
451455
let resolved_schema = ResolvedTelemetrySchema {
452-
file_format: "2.0.0".to_owned(),
456+
file_format: "2/materialized".to_owned(),
453457
schema_url: "https://example.com/schema".to_owned(),
454-
registry_url: "my-registry".to_owned(),
455-
attribute_catalog: vec![attribute::Attribute {
458+
attribute_catalog: vec![attribute::Attribute {
456459
key: "test.attr".to_owned(),
457460
r#type: AttributeType::PrimitiveOrArray(PrimitiveOrArrayTypeSpec::String),
458461
examples: None,
459462
common: CommonFields::default(),
460463
}],
461464
registry: v2::registry::Registry {
462-
registry_url: "https://example.com/registry".to_owned(),
463465
attributes: vec![attribute::AttributeRef(0)],
464466
spans: vec![span::Span {
465467
r#type: SignalId::from("my-span".to_owned()),
@@ -613,12 +615,10 @@ mod tests {
613615
#[test]
614616
fn test_try_from_resolved_schema_with_missing_attribute() {
615617
let resolved_schema = ResolvedTelemetrySchema {
616-
file_format: "2.0.0".to_owned(),
618+
file_format: "2/materialized".to_owned(),
617619
schema_url: "https://example.com/schema".to_owned(),
618-
registry_url: "http://example.com/registry".to_owned(),
619620
attribute_catalog: vec![],
620621
registry: v2::registry::Registry {
621-
registry_url: "https://example.com/registry".to_owned(),
622622
attributes: vec![], // No attributes - This is the logic bug.
623623
spans: vec![span::Span {
624624
r#type: SignalId::from("my-span".to_owned()),

crates/weaver_live_check/src/live_checker.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ mod tests {
507507
fn make_registry(use_v2: bool) -> VersionedRegistry {
508508
if use_v2 {
509509
VersionedRegistry::V2(ForgeResolvedRegistry {
510-
file_format: "2.0.0".to_owned(),
510+
file_format: "2/materialized".to_owned(),
511511
schema_url: "TEST".to_owned(),
512512
registry: Registry {
513513
attributes: vec![
@@ -794,7 +794,7 @@ mod tests {
794794
};
795795

796796
VersionedRegistry::V2(ForgeResolvedRegistry {
797-
file_format: "2.0.0".to_owned(),
797+
file_format: "2/materialized".to_owned(),
798798
schema_url: "TEST_METRICS".to_owned(),
799799
registry: Registry {
800800
attributes: vec![memory_state_attr.clone()],
@@ -1003,7 +1003,7 @@ mod tests {
10031003
};
10041004

10051005
VersionedRegistry::V2(ForgeResolvedRegistry {
1006-
file_format: "2.0.0".to_owned(),
1006+
file_format: "2/materialized".to_owned(),
10071007
schema_url: "TEST".to_owned(),
10081008

10091009
registry: Registry {
@@ -1519,7 +1519,7 @@ mod tests {
15191519
};
15201520

15211521
VersionedRegistry::V2(ForgeResolvedRegistry {
1522-
file_format: "2.0.0".to_owned(),
1522+
file_format: "2/materialized".to_owned(),
15231523
schema_url: "TEST_EVENTS".to_owned(),
15241524
registry: Registry {
15251525
attributes: vec![session_id_attr.clone(), session_previous_id_attr.clone()],

crates/weaver_resolved_schema/src/v2/mod.rs

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ use crate::v2::{
2626
stats::Stats,
2727
};
2828

29-
/// Returns the default file format version for v2 schemas.
30-
fn default_file_format() -> String {
31-
"2.0.0".to_owned()
29+
/// Returns the file format version for v2 resolved schema.
30+
fn resolved_file_format() -> String {
31+
"2/resolved".to_owned()
3232
}
3333

3434
pub mod attribute;
@@ -49,13 +49,11 @@ pub mod stats;
4949
#[serde(deny_unknown_fields)]
5050
pub struct ResolvedTelemetrySchema {
5151
/// Version of the file structure.
52-
#[serde(default = "default_file_format")]
52+
#[serde(default = "resolved_file_format")]
5353
pub file_format: String,
54-
/// Schema URL that this file is published at.
55-
pub schema_url: String,
5654
/// The URL of the registry that this schema belongs to.
5755
#[serde(skip_serializing_if = "String::is_empty")]
58-
pub registry_url: String,
56+
pub schema_url: String,
5957
/// Catalog of attributes. Note: this will include duplicates for the same key.
6058
pub attribute_catalog: Vec<Attribute>,
6159
/// The registry that this schema belongs to.
@@ -130,9 +128,8 @@ impl TryFrom<crate::ResolvedTelemetrySchema> for ResolvedTelemetrySchema {
130128
let (attribute_catalog, registry, refinements) =
131129
convert_v1_to_v2(value.catalog, value.registry)?;
132130
Ok(ResolvedTelemetrySchema {
133-
file_format: default_file_format(),
131+
file_format: resolved_file_format(),
134132
schema_url: value.schema_url,
135-
registry_url: value.registry_id,
136133
attribute_catalog,
137134
registry,
138135
refinements,
@@ -505,7 +502,6 @@ pub fn convert_v1_to_v2(
505502
}
506503

507504
let v2_registry = Registry {
508-
registry_url: r.registry_url,
509505
attributes,
510506
spans,
511507
metrics,
@@ -1005,9 +1001,8 @@ mod tests {
10051001
let v2_schema: Result<ResolvedTelemetrySchema, _> = v1_schema.try_into();
10061002
assert!(v2_schema.is_ok());
10071003
let v2_schema = v2_schema.unwrap();
1008-
assert_eq!(v2_schema.file_format, default_file_format());
1004+
assert_eq!(v2_schema.file_format, resolved_file_format());
10091005
assert_eq!(v2_schema.schema_url, "my.schema.url");
1010-
assert_eq!(v2_schema.registry_url, "my-registry");
10111006
}
10121007

10131008
#[test]
@@ -1214,14 +1209,12 @@ mod tests {
12141209
// create an empty schema for testing.
12151210
fn empty_v2_schema() -> ResolvedTelemetrySchema {
12161211
ResolvedTelemetrySchema {
1217-
file_format: default_file_format(),
1212+
file_format: resolved_file_format(),
12181213
schema_url: "my.schema.url".to_owned(),
1219-
registry_url: "main".to_owned(),
12201214
attribute_catalog: vec![],
12211215
registry: Registry {
12221216
attributes: vec![],
12231217
attribute_groups: vec![],
1224-
registry_url: "todo".to_owned(),
12251218
spans: vec![],
12261219
metrics: vec![],
12271220
events: vec![],

crates/weaver_resolved_schema/src/v2/registry.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ pub struct Registry {
3535
/// Catalog of (public) attribute groups.
3636
pub attribute_groups: Vec<AttributeGroup>,
3737

38-
/// The semantic convention registry url.
39-
///
40-
/// This is the base URL, under which this registry can be found.
41-
pub registry_url: String,
42-
4338
/// A list of span signal definitions.
4439
pub spans: Vec<Span>,
4540

@@ -267,7 +262,6 @@ mod test {
267262
}];
268263
let registry = Registry {
269264
attribute_groups: vec![],
270-
registry_url: "https://opentelemetry.io/schemas/1.23.0".to_owned(),
271265
spans: vec![Span {
272266
r#type: "test.span".to_owned().into(),
273267
kind: SpanKindSpec::Client,

crates/weaver_resolver/data/registry-test-16-attr-conflict/registry/test-16.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2"
1+
file_format: "2"
22
attributes:
33
- key: test.attr.one
44
stability: stable

crates/weaver_resolver/data/registry-test-v2-1-everything/registry/http.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2"
1+
file_format: "2"
22
attributes:
33
- key: server.port
44
stability: stable

crates/weaver_resolver/data/registry-test-v2-2-multifile/registry/http.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "2"
1+
file_format: "2"
22
metrics:
33
- name: http.server.request.duration
44
brief: "Duration of HTTP server requests."

0 commit comments

Comments
 (0)