Skip to content

Commit 64a1a6b

Browse files
committed
Merge branch 'feature/error-analyzer-8' into 'develop'
Error Analyzer Configuration Update See merge request genaiic-reusable-assets/engagement-artifacts/genaiic-idp-accelerator!385
2 parents 87c9901 + e41bae1 commit 64a1a6b

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

lib/idp_common_pkg/idp_common/config/models.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,36 @@ def parse_max_workers(cls, v: Any) -> int:
302302
return int(v)
303303

304304

305+
class ErrorAnalyzerParameters(BaseModel):
306+
"""Error analyzer parameters configuration"""
307+
308+
max_log_events: int = Field(default=5, gt=0, description="Maximum number of log events to retrieve")
309+
time_range_hours_default: int = Field(default=24, gt=0, description="Default time range in hours for log searches")
310+
311+
@field_validator("max_log_events", "time_range_hours_default", mode="before")
312+
@classmethod
313+
def parse_int(cls, v: Any) -> int:
314+
"""Parse int from string or number"""
315+
if isinstance(v, str):
316+
return int(v) if v else 0
317+
return int(v)
318+
319+
305320
class ErrorAnalyzerConfig(BaseModel):
306321
"""Error analyzer agent configuration"""
307322

308323
model_id: str = Field(
309324
default="us.anthropic.claude-sonnet-4-20250514-v1:0",
310325
description="Bedrock model ID for error analyzer",
311326
)
327+
system_prompt: str = Field(
328+
default="",
329+
description="System prompt for error analyzer"
330+
)
331+
parameters: ErrorAnalyzerParameters = Field(
332+
default_factory=ErrorAnalyzerParameters,
333+
description="Error analyzer parameters"
334+
)
312335

313336

314337
class AgentsConfig(BaseModel):

lib/idp_common_pkg/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ agents = [
104104
# This includes all dependencies needed for both backends
105105
docs_service = [
106106
"requests==2.32.4", # Required for appsync module (dynamodb only needs boto3 which is core)
107-
"aws-xray-sdk>=2.12.0", # Required for X-Ray tracing
107+
"aws-xray-sdk>=2.14.0", # Required for X-Ray tracing
108108
]
109109

110110
# Testing dependencies

lib/idp_common_pkg/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# Document service factory dependencies (includes both appsync and dynamodb support)
6262
"docs_service": [
6363
"requests==2.32.4",
64-
"aws-xray-sdk>=2.12.0",
64+
"aws-xray-sdk>=2.14.0",
6565
],
6666
# Testing dependencies
6767
"test": [

src/lambda/queue_processor/index.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,9 @@ def process_message(record: Dict[str, Any]) -> Tuple[bool, str]:
142142
object_key = document.input_key
143143
logger.info(f"Processing message {message_id} for object {object_key}")
144144

145-
# Add X-Ray annotations and capture trace_id early
146-
xray_recorder.put_annotation('document_id', document.id)
145+
# X-Ray annotations
146+
xray_recorder.put_annotation('document_id', {document.id})
147+
xray_recorder.put_annotation('processing_stage', 'queue_processor')
147148
current_segment = xray_recorder.current_segment()
148149
if current_segment:
149150
document.trace_id = current_segment.trace_id

0 commit comments

Comments
 (0)