Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make select log messages more explicit #652

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion journey/pepr-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function peprDeploy() {
await until(() => state.done)

// completes only if conditions are met, so... getting here means success!
}, 5000);
}, 10000);
btlghrants marked this conversation as resolved.
Show resolved Hide resolved
});

describe("should display the UUIDs of the deployed modules", testUUID);
Expand Down
17 changes: 16 additions & 1 deletion src/lib/filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,22 @@ export function shouldSkipRequest(binding: Binding, req: AdmissionRequest, capab
(combinedNamespaces.length && !combinedNamespaces.includes(req.namespace || "")) ||
(!namespaces.includes(req.namespace || "") && capabilityNamespaces.length !== 0 && namespaces.length !== 0)
) {
logger.debug("Namespace does not match");
let type = "";
let label = "";

if (binding.isMutate) {
type = "Mutate";
label = binding.mutateCallback!.name;
} else if (binding.isValidate) {
type = "Validate";
label = binding.validateCallback!.name;
} else if (binding.isWatch) {
type = "Watch";
label = binding.watchCallback!.name;
}

logger.debug(`${type} binding (${label}) does not match request namespace "${req.namespace}"`);

return true;
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib/mutate-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function mutateProcessor(
}

const label = action.mutateCallback.name;
Log.info(actionMetadata, `Processing matched action ${label}`);
Log.info(actionMetadata, `Processing mutation action (${label})`);

matchedAction = true;

Expand All @@ -79,7 +79,7 @@ export async function mutateProcessor(
// Run the action
await action.mutateCallback(wrapped);

Log.info(actionMetadata, `Action succeeded`);
Log.info(actionMetadata, `Mutation action succeeded (${label})`);

// Add annotations to the request to indicate that the capability succeeded
updateStatus("succeeded");
Expand Down
4 changes: 2 additions & 2 deletions src/lib/validate-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export async function validateProcessor(
}

const label = action.validateCallback.name;
Log.info(actionMetadata, `Processing matched action ${label}`);
Log.info(actionMetadata, `Processing validation action (${label})`);

try {
// Run the validation callback, if it fails set allowed to false
Expand All @@ -61,7 +61,7 @@ export async function validateProcessor(
};
}

Log.info(actionMetadata, `Validation Action completed: ${resp.allowed ? "allowed" : "denied"}`);
Log.info(actionMetadata, `Validation action complete (${label}): ${resp.allowed ? "allowed" : "denied"}`);
} catch (e) {
// If any validation throws an error, note the failure in the Response
Log.error(actionMetadata, `Action failed: ${JSON.stringify(e)}`);
Expand Down
Loading