| name | palantir-observability |
| description | Set up observability for Palantir Foundry integrations with metrics, logging, and alerts.
Use when implementing monitoring for Foundry API calls, setting up dashboards,
or configuring alerting for Foundry integration health.
Trigger with phrases like "palantir monitoring", "foundry metrics",
"palantir observability", "monitor foundry", "foundry alerts".
|
| allowed-tools | Read, Write, Edit |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","palantir","foundry","observability","monitoring"] |
| compatibility | Designed for Claude Code, also compatible with Codex and OpenClaw |
Palantir Observability
Overview
Set up comprehensive observability for Foundry integrations: structured logging with request IDs, Prometheus metrics for API latency/errors, health check endpoints, and alert rules.
Prerequisites
- Working Foundry integration
- Prometheus + Grafana (or equivalent monitoring stack)
- Familiarity with
palantir-prod-checklist
Instructions
Step 1: Structured Logging
import logging, json, time, uuid
class FoundryLogger:
def __init__(self):
self.logger = logging.getLogger("foundry")
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(message)s"))
self.logger.addHandler(handler)
self.logger.setLevel(logging.INFO)
def log_api_call(self, method: str, endpoint: str, status: int, duration_ms: float):
self.logger.info(json.dumps({
"timestamp": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
"request_id": str(uuid.uuid4())[:8],
"service": "foundry",
"method": method,
"endpoint": endpoint,
"status": status,
"duration_ms": round(duration_ms, 2),
"level": "error" if status >= 400 ,
}))