Skip to content
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.

Commit

Permalink
chore: Add trace log in ClusterParseCatalog (#882)
Browse files Browse the repository at this point in the history
  • Loading branch information
igarashitm authored Oct 17, 2023
1 parent b7c868d commit 013cac1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,21 @@ private List<T> getCRAndParse(final Class<? extends CustomResource> cr) {
var time = System.currentTimeMillis();
//if the backend is deployed cluster-wide
if ("false".equals(namespace) || "".equals(namespace)) {
LOG.tracef("Namespace filtering disabled (%s): Retrieving resources from all namespaces.", namespace);
resources = kubernetesClient.resources(cr).inAnyNamespace().list().getItems();
} else {
LOG.tracef("Namespace filtering enabled (%s): Retrieving resources from %s.", namespace);
resources = kubernetesClient.resources(cr).inNamespace(namespace).list().getItems();
}
LOG.info("Retrieved resources in " + (System.currentTimeMillis() - time) + "ms.");
LOG.infof("Retrieved %s resources in %s ms.", resources.size(), System.currentTimeMillis() - time);

//For each custom resource, let's process it
resources.stream().parallel().forEach(resource ->
//Add the data to the future asynchronously
futureMd.add(CompletableFuture.runAsync(() ->
{
try {
LOG.tracef("Adding an entry: %s", resource.getMetadata().getName());
metadataList.addAll(this.yamlProcessFile.parseInputStream(
new StringReader(objectMapper.writeValueAsString(resource))));
} catch (Throwable t) {
Expand Down

0 comments on commit 013cac1

Please sign in to comment.