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
3 changes: 2 additions & 1 deletion crates/weaver_resolved_schema/src/v2/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ impl From<Catalog> for Vec<Attribute> {

impl Catalog {
/// Creates a catalog from a list of attributes.
pub(crate) fn from_attributes(attributes: Vec<Attribute>) -> Self {
pub(crate) fn from_attributes(mut attributes: Vec<Attribute>) -> Self {
attributes.sort_by(|a, b| a.key.cmp(&b.key));
let mut lookup: BTreeMap<String, Vec<usize>> = BTreeMap::new();
for (idx, attr) in attributes.iter().enumerate() {
lookup.entry(attr.key.clone()).or_default().push(idx);
Expand Down
31 changes: 15 additions & 16 deletions crates/weaver_resolved_schema/src/v2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,22 +165,19 @@ pub fn convert_v1_to_v2(
let attributes: HashSet<Attribute> = c
.attributes()
.cloned()
.map(|a| {
Attribute {
key: a.name,
r#type: a.r#type,
examples: a.examples,
common: CommonFields {
brief: a.brief,
note: a.note,
// TODO - Check this assumption.
stability: a
.stability
.unwrap_or(weaver_semconv::stability::Stability::Alpha),
deprecated: a.deprecated,
annotations: a.annotations.unwrap_or_default(),
},
}
.map(|a| Attribute {
key: a.name,
r#type: a.r#type,
examples: a.examples,
common: CommonFields {
brief: a.brief,
note: a.note,
stability: a
.stability
.unwrap_or(weaver_semconv::stability::Stability::Alpha),
deprecated: a.deprecated,
annotations: a.annotations.unwrap_or_default(),
},
})
.collect();

Expand Down Expand Up @@ -505,6 +502,8 @@ pub fn convert_v1_to_v2(
}
}
}
attributes.sort_by(|a, b| a.0.cmp(&b.0));
attributes.dedup();

let v2_registry = Registry {
attributes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@
"note": "Destination name SHOULD uniquely identify a specific queue, topic or other entity within the broker. If\nthe broker doesn't have such notion, the destination name SHOULD uniquely identify the broker.\n",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@
"requirement_level": "recommended",
"stability": "development"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@
"requirement_level": "recommended",
"stability": "development"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@
"privacy_sensitivity": "PII"
}
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"note": "template[any] attribute.\n",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -420,4 +420,4 @@
"requirement_level": "recommended",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -1415,4 +1415,4 @@
"requirement_level": "recommended",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -316,4 +316,4 @@
"note": "Another test attribute\n",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@
"requirement_level": "recommended",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@
"requirement_level": "recommended",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@
{
"id": "cache",
"value": "cache",
"brief": "InterSystems Cach\u00e9",
"brief": "InterSystems Caché",
"stability": "stable"
},
{
Expand Down Expand Up @@ -1438,7 +1438,7 @@
{
"id": "cache",
"value": "cache",
"brief": "InterSystems Cach\u00e9",
"brief": "InterSystems Caché",
"stability": "stable"
},
{
Expand Down Expand Up @@ -2549,4 +2549,4 @@
"requirement_level": "recommended",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@
"note": "When observed from the client side, and when communicating through an intermediary, `server.port` SHOULD represent the server port behind any intermediaries, for example proxies, if it's available.\n",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
"requirement_level": "recommended",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@
"requirement_level": "opt_in",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
"requirement_level": "recommended",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -101,4 +101,4 @@
"requirement_level": "opt_in",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
"stability": "stable",
"role": "descriptive"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@
"stability": "stable",
"annotations": {}
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
"stability": "stable",
"annotations": {}
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,4 @@
}
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
"note": "See [Setting `server.address` and `server.port` attributes](/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes).\n> **Warning**\n> Since this attribute is based on HTTP headers, opting in to it may allow an attacker\n> to trigger cardinality limits, degrading the usefulness of the metric.\n",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
"note": "See [Setting `server.address` and `server.port` attributes](/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes).\n> **Warning**\n> Since this attribute is based on HTTP headers, opting in to it may allow an attacker\n> to trigger cardinality limits, degrading the usefulness of the metric.\n",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@
"note": "See [Setting `server.address` and `server.port` attributes](/docs/http/http-spans.md#setting-serveraddress-and-serverport-attributes).\n> **Warning**\n> Since this attribute is based on HTTP headers, opting in to it may allow an attacker\n> to trigger cardinality limits, degrading the usefulness of the metric.\n",
"stability": "stable"
}
]
]
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@
"stability": "stable",
"role": "descriptive"
}
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
file_format: resolved/2.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

schema_url: https://opentelemetry.io/schemas/1.0.0
attribute_catalog:
- key: local.attr
type: string
brief: local attribute
stability: stable
- key: local.group.attr
type: string
brief: local group attribute
stability: stable
- key: my.attr.1
type: int
brief: test attr 1
stability: stable
registry:
attributes:
- 0
- 1
- 2
attribute_groups:
- id: local.group
attributes:
- 1
brief: local group
stability: stable
spans:
- type: imported.span.a
kind: client
name:
note: imported.span.a
attributes:
- base: 2
requirement_level: required
brief: a fun span
note: a span note
stability: stable
- type: local-span
kind: client
name:
note: local-span
attributes:
- base: 0
requirement_level: recommended
brief: a local span
note: a local span note
stability: stable
metrics: []
events: []
entities: []
refinements:
spans:
- id: imported.span.a
type: imported.span.a
kind: client
name:
note: imported.span.a
attributes:
- base: 2
requirement_level: required
brief: a fun span
note: a span note
stability: stable
- id: local-span
type: local-span
kind: client
name:
note: local-span
attributes:
- base: 0
requirement_level: recommended
brief: a local span
note: a local span note
stability: stable
metrics: []
events: []
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
file_format: manifest/2.0.0
stability: stable
schema_url: https://example.com/schemas/1.2.3
resolved_schema_uri: resolved_schema.yaml
description: Test repository that has been resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
file_format: resolved/2.0.0
schema_url: https://opentelemetry.io/schemas/1.0.0
attribute_catalog:
- key: a
type: string
brief: test a
stability: stable
- key: my.attr.1
type: int
brief: test attr 1
stability: stable
registry:
attributes:
- 0
- 1
attribute_groups:
- id: imported.group.a
attributes:
- 1
brief: a fun group
note: a group note
stability: stable
spans:
- type: imported.span.a
name:
note: span name
kind: client
attributes:
- base: 1
requirement_level: required
brief: a fun span
note: a span note
stability: stable
metrics:
events:
entities:
refinements:
spans:
metrics:
events:
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
file_format: 'definition/2'
attributes:
- key: local.attr
type: string
brief: local attribute
stability: stable
- key: local.group.attr
type: string
brief: local group attribute
stability: stable
spans:
- type: local-span
name:
note: span
brief: a local span
note: a local span note
kind: client
stability: stable
attributes:
- ref: local.attr
attribute_groups:
- id: local.group
brief: local group
visibility: public
stability: stable
attributes:
- ref: local.group.attr
imports:
spans:
- imported.*
attribute_groups:
- imported.*
Loading
Loading