Skip to content

Commit e3f3ed2

Browse files
committed
chore(instrumentation): Further improvements of tracing events
1 parent 74f9a4b commit e3f3ed2

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

rust/stackable-cockpit/src/oci.rs

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::HashMap;
22

33
use serde::Deserialize;
44
use snafu::{OptionExt, ResultExt, Snafu};
5-
use tracing::debug;
5+
use tracing::{debug, instrument};
66
use url::Url;
77
use urlencoding::encode;
88

@@ -117,6 +117,8 @@ impl OciUrlExt for Url {
117117
}
118118
}
119119

120+
// TODO (@NickLarsenNZ): Look into why a HashMap is used here when the key is inside each entry in the value
121+
#[instrument]
120122
pub async fn get_oci_index<'a>() -> Result<HashMap<&'a str, ChartSourceMetadata>, Error> {
121123
let mut source_index_files: HashMap<&str, ChartSourceMetadata> = HashMap::new();
122124

@@ -153,7 +155,10 @@ pub async fn get_oci_index<'a>() -> Result<HashMap<&'a str, ChartSourceMetadata>
153155
.await
154156
.context(ParseRepositoriesSnafu)?;
155157

156-
debug!("OCI repos {:?}", repositories);
158+
debug!(
159+
count = repositories.len(),
160+
"Received response for OCI repositories"
161+
);
157162

158163
for repository in &repositories {
159164
// fetch all artifacts pro operator
@@ -162,7 +167,7 @@ pub async fn get_oci_index<'a>() -> Result<HashMap<&'a str, ChartSourceMetadata>
162167
.split_once('/')
163168
.context(UnexpectedOciRepositoryNameSnafu)?;
164169

165-
debug!("OCI repo parts {} and {}", project_name, repository_name);
170+
tracing::trace!(project_name, repository_name, "OCI repository parts");
166171

167172
let mut artifacts = Vec::new();
168173
let mut page = 1;
@@ -196,17 +201,7 @@ pub async fn get_oci_index<'a>() -> Result<HashMap<&'a str, ChartSourceMetadata>
196201
.replace("-arm64", "")
197202
.replace("-amd64", "");
198203

199-
debug!(
200-
"OCI resolved artifact {}, {}, {}",
201-
release_version.to_string(),
202-
repository_name.to_string(),
203-
release_artifact.name.to_string()
204-
);
205-
206-
debug!(
207-
"Repo/Artifact/Tag: {:?} / {:?} / {:?}",
208-
repository, artifact, release_artifact
209-
);
204+
tracing::trace!(repository_name, release_version, "OCI resolved artifact");
210205

211206
let entry = ChartSourceEntry {
212207
name: repository_name.to_string(),

rust/stackablectl/src/cmds/operator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,13 +539,13 @@ where
539539
}
540540

541541
/// Builds a list of operator versions based on the provided Helm repo.
542-
#[instrument]
542+
#[instrument(skip_all, fields(%operator_name))]
543543
fn list_operator_versions_from_repo<T>(
544544
operator_name: T,
545545
helm_repo: &ChartSourceMetadata,
546546
) -> Result<Vec<String>, CmdError>
547547
where
548-
T: AsRef<str> + std::fmt::Debug,
548+
T: AsRef<str> + std::fmt::Display + std::fmt::Debug,
549549
{
550550
debug!("Listing operator versions from repo");
551551

0 commit comments

Comments
 (0)