Skip to content

Commit

Permalink
0.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
jerbly committed Nov 11, 2024
1 parent 2e40f31 commit 3f505b4
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.5.2

- The `allow_custom_values` setting for enums has been removed from the semantic conventions spec. Removed all related code. This field will now just be ignored.

# 0.5.1

- Fixed: Groups were not loading if the `prefix` was missing.
Expand Down
2 changes: 1 addition & 1 deletion 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
@@ -1,6 +1,6 @@
[package]
name = "honey-health"
version = "0.5.1"
version = "0.5.2"
edition = "2021"
authors = ["Jeremy Blythe <[email protected]>"]
repository = "https://github.com/jerbly/honey-health"
Expand Down
26 changes: 7 additions & 19 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl ColumnUsageMap {

fn print_enum_report(
&self,
enum_report_rows: &Vec<(String, bool, Vec<String>)>,
enum_report_rows: &Vec<(String, Vec<String>)>,
) -> anyhow::Result<()> {
// If there's only one dataset, print the enum comparisons
if self.datasets.len() != 1 {
Expand All @@ -358,16 +358,9 @@ impl ColumnUsageMap {
width = longest
);

for (c, allow_custom_values, found_variants) in enum_report_rows {
for (c, found_variants) in enum_report_rows {
if found_variants.is_empty() {
println!("{:>width$}", c.green(), width = longest);
} else if *allow_custom_values {
println!(
"{:>width$} {}",
c.yellow(),
found_variants.join(", "),
width = longest
);
} else {
println!(
"{:>width$} {}",
Expand All @@ -383,7 +376,7 @@ impl ColumnUsageMap {

fn markdown_enum_report(
&self,
enum_report_rows: Vec<(String, bool, Vec<String>)>,
enum_report_rows: Vec<(String, Vec<String>)>,
) -> anyhow::Result<(String, Vec<String>)> {
let dataset_slug = &self.datasets[0];
let markdown_header = format!("## Dataset: {}\n\n", dataset_slug);
Expand All @@ -392,18 +385,13 @@ impl ColumnUsageMap {
let mut row_strings = vec![];
let mut c_len = "Column".len();
let mut v_len = "Undefined-variants".len();
for (c, allow_custom_values, found_variants) in enum_report_rows {
for (c, found_variants) in enum_report_rows {
if !found_variants.is_empty() {
let c_name = format!("`{}`", c);
c_len = c_len.max(c_name.len());
let variants = format!("`{}`", found_variants.join("`, `"));
v_len = v_len.max(variants.len());
let kind = if allow_custom_values {
"Warning".to_owned()
} else {
"Error".to_owned()
};
row_strings.push((c_name, kind, variants));
row_strings.push((c_name, "Error".to_owned(), variants));
}
}

Expand Down Expand Up @@ -439,7 +427,7 @@ impl ColumnUsageMap {
Ok((markdown_header, markdown))
}

async fn enum_report(&self) -> anyhow::Result<Vec<(String, bool, Vec<String>)>> {
async fn enum_report(&self) -> anyhow::Result<Vec<(String, Vec<String>)>> {
let mut v_results = Vec::new();

// If there's only one dataset, print the enum comparisons
Expand Down Expand Up @@ -483,7 +471,7 @@ impl ColumnUsageMap {
let defined_variants = atype.get_simple_variants();
// remove all defined enums from found_enums
found_variants.retain(|e| !defined_variants.contains(e));
v_results.push((c, atype.allow_custom_values, found_variants));
v_results.push((c, found_variants));
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/octo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub async fn create_dataset_report_issue(
Suggestions are given to help improve these attributes.\n\n \
[\"Effective trace instrumentation with semantic conventions\"](https://www.honeycomb.io/blog/effective-trace-instrumentation-semantic-conventions) \
may help you improve your instrumentation.\n\n \
_Note: If the report is too large, it will been split into multiple comments._\n\n",
_Note: If the report is too large, it will be split into multiple comments._\n\n",
);

create_table_issue(
Expand All @@ -40,10 +40,8 @@ pub async fn create_enum_report_issue(
markdown_header.push_str(
"This report was generated by [honey-health](https://github.com/jerbly/honey-health). \
The table shows enum columns found in the dataset with variants undefined in semantic conventions. \
This _could_ be an indication of data quality issues.\n\n\
Enums defined with `allow_custom_values` are reported as warnings. These warnings should be checked - mistakes with \
casing or typos can lead to incorrect variants.\n\n\
_Note: If the report is too large, it will been split into multiple comments._\n\n");
This _could_ be an indication of data quality issues. Mistakes with casing or typos can lead to incorrect variants.\n\n\
_Note: If the report is too large, it will be split into multiple comments._\n\n");

create_table_issue(
repo_owner,
Expand Down
5 changes: 4 additions & 1 deletion src/semconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ pub struct Member {
#[derive(Debug, Deserialize, Clone)]
pub struct ComplexType {
#[serde(default)]
pub allow_custom_values: bool,
pub members: Vec<Member>,
}

Expand Down Expand Up @@ -202,7 +201,11 @@ impl SemanticConventions {
"meta.annotation_type",
"parent_name",
"status_code",
"status_message",
"error",
"meta.time_since_span_start_ms",
"trace.link.trace_id",
"trace.link.span_id",
];
for builtin in builtins {
self.attribute_map.insert(builtin.to_owned(), None);
Expand Down

0 comments on commit 3f505b4

Please sign in to comment.