Skip to content

Commit 6d92223

Browse files
committed
Fixed Bedrock tokens
1 parent fff1043 commit 6d92223

1 file changed

Lines changed: 8 additions & 26 deletions

File tree

infrastructure/lambda/src/lambda_function.py

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ def analyze_thread_dump(thread_dump: str) -> str:
7575

7676
payload = json.dumps({
7777
"anthropic_version": "bedrock-2023-05-31",
78-
"max_tokens": 1024,
78+
"max_tokens": 8192,
7979
"messages": [{"role": "user", "content": prompt}],
8080
"temperature": 0.7
8181
})
@@ -145,31 +145,13 @@ def process_alert(cluster_type, cluster_name, task_pod_id, container_name, names
145145
thread_dump = response.text
146146

147147
elif cluster_type == 'eks':
148-
if container_ip:
149-
# Use the container_ip provided in the alert
150-
logger.info(f"Using pod IP from alert: {container_ip}")
151-
try:
152-
response = requests.get(f"http://{container_ip}:8080/actuator/threaddump", timeout=10)
153-
response.raise_for_status()
154-
thread_dump = response.text
155-
except Exception as e:
156-
logger.warning(f"Failed to get thread dump using pod IP: {str(e)}")
157-
# Fallback to kubectl exec
158-
eks_client = EKSClient(cluster_name)
159-
thread_dump = eks_client.get_thread_dump(
160-
namespace=namespace,
161-
pod_name=task_pod_id,
162-
container_name=container_name
163-
)
164-
else:
165-
# Fallback to kubectl exec
166-
eks_client = EKSClient(cluster_name)
167-
thread_dump = eks_client.get_thread_dump(
168-
namespace=namespace,
169-
pod_name=task_pod_id,
170-
container_name=container_name
171-
)
172-
148+
eks_client = EKSClient(cluster_name)
149+
thread_dump = eks_client.get_thread_dump(
150+
namespace=namespace,
151+
pod_name=task_pod_id,
152+
container_name=container_name
153+
)
154+
173155
else:
174156
raise ValueError(f"Unsupported cluster type: {cluster_type}")
175157

0 commit comments

Comments
 (0)