What is "Fuel" in Shopify Functions for my Product Discount? Is My Consumption High?

Topic summary

A developer is seeking clarification about “fuel” consumption in Shopify Functions, specifically for a product discount function showing a fuelConsumed value of 1,254,557.

Key Questions:

  • What is “Fuel”? – The developer wants to understand the unit of measurement (bytes, kilobytes, etc.) and how it’s calculated
  • Is 1.25M high? – Uncertainty whether this consumption level is normal for straightforward discount logic
  • Are there limits? – Concerns about potential fuel usage caps and consequences of exceeding them

Context Provided:
The function processes cart line items, checks product collection membership, and applies percentage discounts based on customer tags (“Pro” gets 99% discount, “VIP” gets 90% discount). The log shows successful execution with detailed processing steps for each product variant.

Current Status: The function appears to be working correctly (status: “success”), but the developer is uncertain whether the fuel consumption indicates a performance issue or optimization need. No responses or resolution provided yet.

Summarized with AI on November 5. AI used: claude-sonnet-4-5-20250929.

I’m currently working with a Shopify product discount function, and in the logs, I’ve noticed something called fuelConsumed. The value for my function is 1,254,557. I’m trying to understand what this number means:

What exactly is “Fuel”? – Is it measured in terms of bytes, kilobytes, or something else entirely? How is it calculated?

Is this number considered high? – Given that my function logic is fairly straightforward, I’m wondering if I should be concerned about this level of fuel consumption, or if this is normal for a function of this type.

Are there limits on fuel usage? – I can imagine more complex logic being implemented, so I’m curious if there are specific fuel limits that developers should be aware of, and if so, what happens if you exceed those limits?

Here is a sample log from one of my function runs:

{
  "shopId": 1234567890,
  "apiClientId": 987654321,
  "payload": {
    "export": "run",
    "input": {
      "cart": {
        "lines": [
          {
            "merchandise": {
              "typename": "ProductVariant",
              "id": "gid://shopify/ProductVariant/12345678901234",
              "product": {
                "handle": "example-product-one",
                "inCollections": [
                  {
                    "collectionId": "gid://shopify/Collection/1234567890",
                    "isMember": false
                  }
                ]
              }
            }
          },
          {
            "merchandise": {
              "typename": "ProductVariant",
              "id": "gid://shopify/ProductVariant/12345678956789",
              "product": {
                "handle": "example-product-two",
                "inCollections": [
                  {
                    "collectionId": "gid://shopify/Collection/1234567890",
                    "isMember": true
                  }
                ]
              }
            }
          }
        ],
        "buyerIdentity": {
          "customer": {
            "hasTags": [
              {
                "tag": "Pro",
                "hasTag": true
              },
              {
                "tag": "VIP",
                "hasTag": false
              }
            ]
          }
        }
      },
      "shop": {
        "metafield": {
          "value": "{\"Pro\":{\"collections\":[{\"id\":\"1234567890\",\"discountValue\":\"99\",\"discountType\":\"%\"}]},\"VIP\":{\"collections\":[{\"id\":\"1234567890\",\"discountValue\":\"90\",\"discountType\":\"%\"}]}}"
        }
      }
    },
    "inputBytes": 1368,
    "output": {
      "discountApplicationStrategy": "ALL",
      "discounts": [
        {
          "message": "PRO DISCOUNT",
          "targets": [
            {
              "productVariant": {
                "id": "gid://shopify/ProductVariant/12345678956789"
              }
            }
          ],
          "value": {
            "percentage": {
              "value": 99
            }
          }
        }
      ]
    },
    "outputBytes": 345,
    "logs": [
      "Starting discount function...",
      "Current metafield value: [object Object]",
      "Parsed shop configuration: [object Object]",
      "Customer tags: Pro",
      "Configuration for customer tag (Pro): [object Object]",
      "$selectedCollectionIds: gid://shopify/Collection/1234567890",
      "Processing product variant: gid://shopify/ProductVariant/12345678901234, product: example-product-one",
      "Product is not a member of collection: gid://shopify/Collection/1234567890, skipping...",
      "Processing product variant: gid://shopify/ProductVariant/12345678956789, product: example-product-two",
      "Checking collection: 1234567890",
      "Applying discount for collection: 1234567890"
    ],
    "functionId": "function-id-example",
    "fuelConsumed": 1254557
  },
  "logType": "function_run",
  "status": "success",
  "source": "product-discount",
  "sourceNamespace": "extensions",
  "logTimestamp": "2024-09-20T20:03:09.647783Z",
  "localTime": "2024-09-20 13:03:09"
}