Adds structured asset instrumentation logging #2086
+231
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request adds structured asset instrumentation logging to the Percy core network layer, enabling better tracking and analysis of asset loading issues by the API rule engine. Instrumentation logs are now emitted for various asset-related failure scenarios, with detailed metadata and a consistent format, and comprehensive tests are included to verify correct logging behavior.
Asset instrumentation logging enhancements:
logAssetInstrumentationutility function inutils.js, which logs asset events in a structured, pipe-separated format to the CI debug namespace for API parsing.network.js) for key failure scenarios, including server errors (5xx), disallowed status codes, request aborts, disallowed hostnames, resources too large, empty responses, missing responses, and disallowed resource types. Each scenario logs a specific category and reason with relevant metadata. [1] [2] [3] [4]Testing improvements:
discovery.test.jsto verify that instrumentation logs are correctly emitted for 5xx errors, resources that are too large, disallowed status codes, and empty responses, ensuring the logs contain the expected format and metadata.logAssetInstrumentationinutils.test.js, checking correct formatting, category assignment, inclusion of metadata fields, and message structure for API parsing.