diff --git a/.changeset/little-zoos-tan.md b/.changeset/little-zoos-tan.md new file mode 100644 index 000000000..769d60a04 --- /dev/null +++ b/.changeset/little-zoos-tan.md @@ -0,0 +1,5 @@ +--- +"products-feed": patch +--- + +Now the total amount of loaded attributes and the size of generated XML is present within the logs. diff --git a/apps/products-feed/src/pages/api/feed/[url]/[channel]/google.xml.ts b/apps/products-feed/src/pages/api/feed/[url]/[channel]/google.xml.ts index d3375995c..937901b89 100644 --- a/apps/products-feed/src/pages/api/feed/[url]/[channel]/google.xml.ts +++ b/apps/products-feed/src/pages/api/feed/[url]/[channel]/google.xml.ts @@ -199,8 +199,13 @@ export const handler = async (req: NextApiRequest, res: NextApiResponse) => { try { productVariants = await fetchProductData({ client, channel, imageSize }); + const totalAttributes = productVariants + .map((e) => e.product.attributes.length) + .reduce((a, b) => a + b, 0); + logger.info("Product data fetched successfully", { productVariantsLength: productVariants.length, + totalAttributes, }); } catch (error) { logger.error("Error during the product data fetch", { error }); @@ -219,6 +224,10 @@ export const handler = async (req: NextApiRequest, res: NextApiResponse) => { titleTemplate, }); + logger.info("Generated XML size", { + size: xmlContent.length, + }); + if (!bucketConfiguration) { logger.info("Bucket configuration not found, returning feed directly");