Skip to content

Commit 8458fe8

Browse files
committed
chore(instrumentation): Add comments for future improvements
1 parent fd23298 commit 8458fe8

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

rust/helm-sys/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ pub fn uninstall_helm_release(
5656
}
5757
}
5858

59+
// TODO (@NickLarsenNZ): Add tracing to helm-sys, maybe?
60+
// #[instrument]
5961
pub fn check_helm_release_exists(release_name: &str, namespace: &str) -> bool {
6062
let release_name = CString::new(release_name).unwrap();
6163
let namespace = CString::new(namespace).unwrap();

rust/stackable-cockpit/src/utils/chartsource.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ use serde::Deserialize;
44

55
#[derive(Clone, Debug, Deserialize)]
66
pub struct ChartSourceMetadata {
7+
// TODO (@NickLarsenNZ): Add a field for the repo name.
8+
// This would remove the need for the nested HashMaps
9+
// See: around rust/stackablectl/src/cmds/operator.rs:519
710
pub entries: HashMap<String, Vec<ChartSourceEntry>>,
811
}
912

rust/stackablectl/src/cmds/operator.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,19 @@ async fn build_source_index_file_list<'a>(
468468
source_index_files = oci::get_oci_index().await.context(OciSnafu)?;
469469

470470
debug!(count = source_index_files.len(), "OCI Repository entries");
471+
472+
// TODO (@NickLarsenNZ): Look into why this is so deeply nested with duplicate data.
473+
// source_index_files
474+
// .iter()
475+
// .for_each(|(&repo_name, chart_source_metadata)| {
476+
// let x = chart_source_metadata.entries.len();
477+
// tracing::trace!(repo_name, x, "thing");
478+
// let _ = &chart_source_metadata
479+
// .entries
480+
// .iter()
481+
// // y (below) is a Vec
482+
// .for_each(|(x, y)| tracing::error!(x, "blah {:?}", y));
483+
// });
471484
}
472485
ChartSourceType::Repo => {
473486
for helm_repo_name in [
@@ -504,7 +517,11 @@ fn build_versions_list(
504517
let mut versions_list = IndexMap::new();
505518

506519
for operator in operator::VALID_OPERATORS {
520+
tracing::info!("iteration");
521+
// TODO (@NickLarsenNZ): IMO, helm_repo_name should be inside ChartSourceMetadata
507522
for (helm_repo_name, helm_repo_index_file) in helm_index_files {
523+
tracing::warn!("inner iteration");
524+
// TODO (@NickLarsenNZ): Make this helm_repo_index_file.versions(operator);
508525
let versions = list_operator_versions_from_repo(operator, helm_repo_index_file)?;
509526
let entry = versions_list.entry(operator.to_string());
510527
let entry = entry.or_insert(OperatorVersionList(HashMap::new()));
@@ -531,6 +548,7 @@ where
531548
let operator_name = operator_name.as_ref();
532549

533550
for (helm_repo_name, helm_repo_index_file) in helm_index_files {
551+
// tracing::error!("and called again");
534552
let versions = list_operator_versions_from_repo(operator_name, helm_repo_index_file)?;
535553
versions_list.0.insert(helm_repo_name.to_string(), versions);
536554
}
@@ -547,7 +565,11 @@ fn list_operator_versions_from_repo<T>(
547565
where
548566
T: AsRef<str> + std::fmt::Display + std::fmt::Debug,
549567
{
550-
debug!("Listing operator versions from repo");
568+
// TODO (@NickLarsenNZ): Consider tracing::trace! here
569+
debug!(
570+
"Listing operator versions from repo {:?}",
571+
helm_repo.entries
572+
);
551573

552574
let operator_name = utils::operator_chart_name(operator_name.as_ref());
553575

@@ -556,6 +578,7 @@ where
556578
let mut versions = entries
557579
.iter()
558580
.map(|entry| {
581+
debug!(entry.version, "what is going on?");
559582
Version::parse(&entry.version).with_context(|_| InvalidHelmChartVersionSnafu {
560583
version: entry.version.clone(),
561584
})

0 commit comments

Comments
 (0)