Skip to content

Commit c388a6f

Browse files
author
Bob Strahan
committed
feat: Complete Pattern 1 Lambda metering implementation
- Add Lambda metering to Pattern 1 Summarization function - Track invocation counts and GB-seconds duration - Complete Lambda execution cost tracking across ALL patterns All core processing Lambda functions now have Lambda metering: - Pattern 1: 1 function (Summarization) - Pattern 2: 5 functions (OCR, Classification, Extraction, Assessment, Summarization) - Pattern 3: 5 functions (OCR, Classification, Extraction, Assessment, Summarization) Total: 11 Lambda functions with comprehensive cost tracking
1 parent 3d6eb0b commit c388a6f

File tree

1 file changed

+8
-0
lines changed
  • patterns/pattern-1/src/summarization_function

1 file changed

+8
-0
lines changed

patterns/pattern-1/src/summarization_function/index.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from idp_common import get_config, summarization
1414
from idp_common.models import Document, Status
1515
from idp_common.docs_service import create_document_service
16+
from idp_common.utils import calculate_lambda_metering, merge_metering_data
1617

1718
# Configuration will be loaded in handler function
1819

@@ -76,6 +77,13 @@ def handler(event, context):
7677
else:
7778
logger.warning("Document summarization completed but no summary report URI was set")
7879

80+
# Add Lambda metering for successful summarization execution
81+
try:
82+
lambda_metering = calculate_lambda_metering("Summarization", context, start_time)
83+
processed_document.metering = merge_metering_data(processed_document.metering, lambda_metering)
84+
except Exception as e:
85+
logger.warning(f"Failed to add Lambda metering for summarization: {str(e)}")
86+
7987
# Return the processed document using new serialization method
8088
return {
8189
'document': processed_document.serialize_document(working_bucket, "summarization", logger),

0 commit comments

Comments
 (0)