Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
59aefac
First cut at converting from v1 resolved schema to v2. Only handles …
jsuereth Sep 19, 2025
54fc192
Add group lineage tracking so we can determine group refinement when …
jsuereth Oct 8, 2025
f770723
Fix up tests for V2 span/span_refinement conversion.
jsuereth Oct 9, 2025
b14dcd3
Start fixing up documentation and add metric v2 extraction.
jsuereth Oct 9, 2025
c917f02
More documentation and test cleanup for spans/metrics.
jsuereth Oct 9, 2025
1baa3cd
Finish implementation (not full testing) of v2 conversion for basics.
jsuereth Oct 9, 2025
a3bb434
Hackily hook up the v2 resolution and template for output in weaver.
jsuereth Oct 10, 2025
4a9f6bf
Add spans to resolved registry.
jsuereth Oct 10, 2025
edbe850
Add the remaining missing pieces to V2 resolved schema.
jsuereth Oct 10, 2025
209883f
Fix all tests.
jsuereth Oct 20, 2025
e02235c
Start of refactoring of 'regisry' vs. 'catalog' vs. 'refinements'
jsuereth Oct 28, 2025
a99d72e
Fix forge unwinding of registry.
jsuereth Oct 28, 2025
5a01aae
Optimise lookup up attributes in catalog when building V2.
jsuereth Oct 28, 2025
42d4976
Finish attribute mapping equality for v1->v2
jsuereth Oct 28, 2025
1a36d26
Fix error reporting on v2 schema creation.
jsuereth Oct 28, 2025
8889f71
Clippy fixes.
jsuereth Oct 28, 2025
27b7a0f
Start supporting attribute groups. Add lineage tracking so we can co…
jsuereth Oct 28, 2025
75072fe
Initial attribute group support in resolved registry.
jsuereth Oct 28, 2025
0c32132
Cargo fix.
jsuereth Oct 28, 2025
b7b3a48
Add include groups to v2 resolved schema.
jsuereth Oct 28, 2025
60227ac
Remove attribute group tracking from in-group feedback.
jsuereth Oct 29, 2025
e1a2de8
Add attribute group to forge schema.
jsuereth Oct 31, 2025
e7617ee
Add v2 to weaver generate and write a test.
jsuereth Oct 31, 2025
8b4a7bc
cargo fmt
jsuereth Oct 31, 2025
ad75072
Fix some types and copy-paste errors.
jsuereth Nov 3, 2025
b72b754
Fix typos.
jsuereth Nov 3, 2025
fb4a367
More spell fixes.
jsuereth Nov 3, 2025
dff7769
Fix typos.
jsuereth Nov 3, 2025
bdb91b1
Merge remote-tracking branch 'origin/main' into wip-v2-resolved-schema
jsuereth Nov 3, 2025
c56256f
Fix tests.
jsuereth Nov 3, 2025
374c493
Fix format.
jsuereth Nov 3, 2025
d1a61fa
Clippy fixes.
jsuereth Nov 3, 2025
4d22341
Fix last clippy issue.
jsuereth Nov 3, 2025
bd681a6
Fix spelling issues.
jsuereth Nov 3, 2025
ce701d2
Cargo fmt
jsuereth Nov 3, 2025
fe55753
Merge remote-tracking branch 'origin/main' into wip-v2-resolved-schema
jsuereth Nov 4, 2025
c69a92a
Fix logic error in comparing annotations.
jsuereth Nov 4, 2025
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
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.

Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
"source_group": "registry.url"
}
},
"includes_group": [
"http.client.server_and_port"
],
"provenance": {
"path": "data/http.yaml",
"registry_id": "default"
Expand Down Expand Up @@ -438,6 +441,7 @@
"source_group": "attributes.jvm.memory"
}
},
"extends_group": "attributes.jvm.memory",
"provenance": {
"path": "data/jvm-metrics.yaml",
"registry_id": "default"
Expand Down Expand Up @@ -557,6 +561,7 @@
"source_group": "attributes.jvm.memory"
}
},
"extends_group": "attributes.jvm.memory",
"provenance": {
"path": "data/jvm-metrics.yaml",
"registry_id": "default"
Expand Down Expand Up @@ -680,6 +685,7 @@
"source_group": "attributes.jvm.memory"
}
},
"extends_group": "attributes.jvm.memory",
"provenance": {
"path": "data/jvm-metrics.yaml",
"registry_id": "default"
Expand Down Expand Up @@ -775,6 +781,7 @@
"source_group": "attributes.jvm.memory"
}
},
"extends_group": "attributes.jvm.memory",
"provenance": {
"path": "data/jvm-metrics.yaml",
"registry_id": "default"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@
"source_group": "registry.url"
}
},
"includes_group": [
"http.client.server_and_port"
],
"provenance": {
"path": "data/http.yaml",
"registry_id": "default"
Expand Down Expand Up @@ -428,6 +431,7 @@
"source_group": "attributes.jvm.memory"
}
},
"extends_group": "attributes.jvm.memory",
"provenance": {
"path": "data/jvm-metrics.yaml",
"registry_id": "default"
Expand Down Expand Up @@ -513,6 +517,7 @@
"source_group": "attributes.jvm.memory"
}
},
"extends_group": "attributes.jvm.memory",
"provenance": {
"path": "data/jvm-metrics.yaml",
"registry_id": "default"
Expand Down Expand Up @@ -615,6 +620,7 @@
"source_group": "attributes.jvm.memory"
}
},
"extends_group": "attributes.jvm.memory",
"provenance": {
"path": "data/jvm-metrics.yaml",
"registry_id": "default"
Expand Down Expand Up @@ -700,6 +706,7 @@
"source_group": "attributes.jvm.memory"
}
},
"extends_group": "attributes.jvm.memory",
"provenance": {
"path": "data/jvm-metrics.yaml",
"registry_id": "default"
Expand Down
1 change: 1 addition & 0 deletions crates/weaver_forge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ mod filter;
mod formats;
pub mod jq;
pub mod registry;
pub mod v2;

/// Name of the Weaver configuration file.
pub const WEAVER_YAML: &str = "weaver.yaml";
Expand Down
3 changes: 3 additions & 0 deletions crates/weaver_forge/src/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ mod tests {
body: None,
entity_associations: vec![],
annotations: None,
visibility: None,
},
Group {
id: "apple.group".to_owned(),
Expand All @@ -319,6 +320,7 @@ mod tests {
body: None,
entity_associations: vec![],
annotations: None,
visibility: None,
},
Group {
id: "middle.group".to_owned(),
Expand All @@ -341,6 +343,7 @@ mod tests {
body: None,
entity_associations: vec![],
annotations: None,
visibility: None,
},
],
};
Expand Down
31 changes: 31 additions & 0 deletions crates/weaver_forge/src/v2/attribute.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//! Attribute definitions for template schema.

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use weaver_semconv::{
attribute::{AttributeType, Examples},
v2::CommonFields,
};

/// The definition of an Attribute.
#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema, PartialEq, Hash, Eq)]
#[serde(deny_unknown_fields)]
#[serde(rename_all = "snake_case")]
pub struct Attribute {
/// String that uniquely identifies the attribute.
pub key: String,
/// Either a string literal denoting the type as a primitive or an
/// array type, a template type or an enum definition.
pub r#type: AttributeType,
/// Sequence of example values for the attribute or single example
/// value. They are required only for string and string array
/// attributes. Example values must be of the same type of the
/// attribute. If only a single example is provided, it can directly
/// be reported without encapsulating it into a sequence/dictionary.
#[serde(default)]
#[serde(skip_serializing_if = "Option::is_none")]
pub examples: Option<Examples>,
/// Common fields (like brief, note, attributes).
#[serde(flatten)]
pub common: CommonFields,
}
20 changes: 20 additions & 0 deletions crates/weaver_forge/src/v2/attribute_group.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//! Version two of attribute groups.

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use weaver_semconv::v2::{signal_id::SignalId, CommonFields};

use crate::v2::attribute::Attribute;

/// Public attribute group.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct AttributeGroup {
/// The name of the attribute group, must be unique.
pub id: SignalId,
/// List of attributes.
pub attributes: Vec<Attribute>,
/// Common fields (like brief, note, annotations).
#[serde(flatten)]
pub common: CommonFields,
}
47 changes: 47 additions & 0 deletions crates/weaver_forge/src/v2/entity.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//! Event related definitions structs.

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use weaver_semconv::{
attribute::RequirementLevel,
v2::{signal_id::SignalId, CommonFields},
};

use crate::v2::attribute::Attribute;

/// The definition of an entity signal.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct Entity {
/// The type of the entity.
pub r#type: SignalId,

/// List of attributes that identify this entity.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub identity: Vec<EntityAttribute>,

/// List of attributes that describe to this entity.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub description: Vec<EntityAttribute>,

/// Common fields (like brief, note, annotations).
#[serde(flatten)]
pub common: CommonFields,
}

/// A special type of reference to attributes that remembers entity-specicific information.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct EntityAttribute {
/// Base attribute definitions.
#[serde(flatten)]
pub base: Attribute,
/// Specifies if the attribute is mandatory. Can be "required",
/// "conditionally_required", "recommended" or "opt_in". When omitted,
/// the attribute is "recommended". When set to
/// "conditionally_required", the string provided as <condition> MUST
/// specify the conditions under which the attribute is required.
pub requirement_level: RequirementLevel,
}
69 changes: 69 additions & 0 deletions crates/weaver_forge/src/v2/event.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//! Event related definitions structs.

use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use weaver_semconv::{
attribute::RequirementLevel,
v2::{signal_id::SignalId, CommonFields},
};

use crate::v2::attribute::Attribute;

/// The definition of an event signal.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct Event {
/// The name of the event.
pub name: SignalId,

/// List of attributes that belong to this event.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub attributes: Vec<EventAttribute>,

/// Which resources this event should be associated with.
///
/// This list is an "any of" list, where a event may be associated with one or more entities, but should
/// be associated with at least one in this list.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub entity_associations: Vec<String>,

/// Common fields (like brief, note, annotations).
#[serde(flatten)]
pub common: CommonFields,
}

/// A special type of reference to attributes that remembers event-specicific information.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct EventAttribute {
/// Base attribute definitions.
#[serde(flatten)]
pub base: Attribute,
/// Specifies if the attribute is mandatory. Can be "required",
/// "conditionally_required", "recommended" or "opt_in". When omitted,
/// the attribute is "recommended". When set to
/// "conditionally_required", the string provided as <condition> MUST
/// specify the conditions under which the attribute is required.
pub requirement_level: RequirementLevel,
}

/// A refinement of an event signal, for use in code generation or specific library application.
///
/// A refinement represents a "view" of an Event that is highly optimised for a particular implementation.
/// e.g. for HTTP events, there may be a refinement that provides only the necessary information for dealing with Java's HTTP
/// client library, and drops optional or extraneous information from the underlying http event.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
pub struct EventRefinement {
/// The identity of the refinement.
pub id: SignalId,

// TODO - This is a lazy way of doing this. We use `type` to refer
// to the underlying event definition, but override all fields here.
// We probably should copy-paste all the "event" attributes here
// including the `name`.
/// The definition of the event refinement.
#[serde(flatten)]
pub event: Event,
}
81 changes: 81 additions & 0 deletions crates/weaver_forge/src/v2/metric.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//! Metric related definitions structs.

use crate::v2::attribute::Attribute;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use weaver_semconv::{
attribute::RequirementLevel,
group::InstrumentSpec,
v2::{signal_id::SignalId, CommonFields},
};

/// The definition of a metric signal.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct Metric {
/// The name of the metric.
pub name: SignalId,
/// The instrument type that should be used to record the metric. Note that
/// the semantic conventions must be written using the names of the
/// synchronous instrument types (counter, gauge, updowncounter and
/// histogram).
/// For more details: [Metrics semantic conventions - Instrument types](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/metrics/semantic_conventions#instrument-types).
pub instrument: InstrumentSpec,
/// The unit in which the metric is measured, which should adhere to the
/// [guidelines](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/metrics/semantic_conventions#instrument-units).
pub unit: String,
/// List of attributes that should be included on this metric.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub attributes: Vec<MetricAttribute>,
// TODO - Should Entity Associations be "strong" links?
/// Which resources this metric should be associated with.
///
/// This list is an "any of" list, where a metric may be associated with one or more entities, but should
/// be associated with at least one in this list.
#[serde(default)]
#[serde(skip_serializing_if = "Vec::is_empty")]
pub entity_associations: Vec<String>,

/// Common fields (like brief, note, annotations).
#[serde(flatten)]
pub common: CommonFields,
}

/// A special type of reference to attributes that remembers metric-specific information.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
#[serde(deny_unknown_fields)]
pub struct MetricAttribute {
/// Base attribute definitions.
#[serde(flatten)]
pub base: Attribute,
/// Specifies if the attribute is mandatory. Can be "required",
/// "conditionally_required", "recommended" or "opt_in". When omitted,
/// the attribute is "recommended". When set to
/// "conditionally_required", the string provided as <condition> MUST
/// specify the conditions under which the attribute is required.
///
/// Note: For attributes that are "recommended" or "opt-in" - not all metric source will
/// create timeseries with these attributes, but for any given timeseries instance, the attributes that *were* present
/// should *remain* present. That is - a metric timeseries cannot drop attributes during its lifetime.
pub requirement_level: RequirementLevel,
}

/// A refinement of a metric signal, for use in code-gen or specific library application.
///
/// A refinement represents a "view" of a Metric that is highly optimised for a particular implementation.
/// e.g. for HTTP metrics, there may be a refinement that provides only the necessary information for dealing with Java's HTTP
/// client library, and drops optional or extraneous information from the underlying http metric.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, JsonSchema)]
pub struct MetricRefinement {
/// The identity of the refinement.
pub id: SignalId,

// TODO - This is a lazy way of doing this. We use `type` to refer
// to the underlying metric definition, but override all fields here.
// We probably should copy-paste all the "metric" attributes here
// including the `ty`
/// The definition of the metric refinement.
#[serde(flatten)]
pub metric: Metric,
}
9 changes: 9 additions & 0 deletions crates/weaver_forge/src/v2/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//! Version two of weaver model.

pub mod attribute;
pub mod attribute_group;
pub mod entity;
pub mod event;
pub mod metric;
pub mod registry;
pub mod span;
Loading
Loading