environment-setup-guide
Guide developers through setting up development environments with proper tools, dependencies, and configurations
openevidence-observability
Set up comprehensive observability for OpenEvidence integrations with metrics, traces, and alerts. Use when implementing monitoring for clinical AI operations, setting up dashboards, or configuring alerting for healthcare application health. Trigger with phrases like "openevidence monitoring", "o...
Full skill instructions
Set up comprehensive observability for OpenEvidence clinical AI integrations in healthcare environments.
| Metric | Type | Description | Alert Threshold |
|---|---|---|---|
openevidence_requests_total | Counter | Total API requests | N/A |
openevidence_request_duration_seconds | Histogram | Request latency | P95 > 15s |
openevidence_errors_total | Counter | Error count by type | > 5% rate |
openevidence_cache_hits_total | Counter | Cache hit count | < 50% rate |
openevidence_rate_limit_remaining | Gauge | Rate limit headroom | < 10% |
openevidence_deepconsult_active | Gauge | Active DeepConsults | > 50 |
// src/monitoring/metrics.ts
import { Registry, Counter, Histogram, Gauge, Summary } from 'prom-client';
const registry = new Registry();
// Request metrics
export const requestCounter = new Counter({
name: 'openevidence_requests_total',
help: 'Total OpenEvidence API requests',
labelNames: ['method', 'specialty', 'status'],
registers: [registry],
});
export const requestDuration = new Histogram({
name: 'openevidence_request_duration_seconds',
help: 'OpenEvidence request duration',
labelNames: ['method', 'specialty'],
buckets: [0.5, 1, 2, 5, 10, 15, 30, 60],
registers: [registry],
});
// Error metrics
export const errorCounter = new Counter({
name: 'openevidence_errors_total',
help: 'OpenEvidence errors by type',
labelNames: ['error_type', 'specialty'],
registers: [registry],
});
// Cache metrics
export const cacheHits = new Counter({
name: 'openevidence_cache_hits_total',
help: 'Cache hit count',
registers: [registry],
});
export const cacheMisses = new Counter({
name: 'openevidence_cache_misses_total',
help: 'Cache miss count',
registers: [registry],
});
// Rate limit metrics
export const rateLimitRemaining = new Gauge({
name: 'openevidence_rate_limit_remaining',
help: 'Remaining rate limit',
registers: [registry],
});
export const rateLimitPercent = new Gauge({
name: 'openevidence_rate_limit_usage_percent',
help: 'Rate limit usage percentage',
registers: [registry],
});
// DeepConsult metrics
export const deepConsultActive = new Gauge({
name: 'openevidence_deepconsult_active',
help: 'Active DeepConsult requests',
registers: [registry],
});
export const deepConsultDuration = new Histogram({
name: 'openevidence_deepconsult_duration_seconds',
help: 'DeepConsult completion time',
labelNames: ['specialty', 'status'],
buckets: [30, 60, 120, 180, 300, 600],
registers: [registry],
});
// Confidence metrics
export const confidenceScore = new Summary({
name: 'openevidence_confidence_score',
help: 'Response confidence score distribution',
labelNames: ['specialty'],
percentiles: [0.5, 0.9, 0.95, 0.99],
registers: [registry],
});
export { registry };
// src/monitoring/instrumented-client.ts
import { OpenEvidenceClient } from '@openevidence/sdk';
import {
requestCounter,
requestDuration,
errorCounter,
cacheHits,
cacheMisses,
rateLimitRemaining,
rateLimitPercent,
confidenceScore,
} from './metrics';
import { trace, SpanStatusCode, Span } from '@opentelemetry/api';
const tracer = trace.getTracer('openevidence-client');
export class InstrumentedOpenEvidenceClient {
private client: OpenEvidenceClient;
private cache: ClinicalQueryCache;
constructor(config: any, cache: ClinicalQueryCache) {
this.client = new OpenEvidenceClient(config);
this.cache = cache;
}
async query(request: ClinicalQueryRequest): Promise<ClinicalQueryResponse> {
const { specialty } = request.context;
return tracer.startActiveSpan('openevidence.query', async (span: Span) => {
const timer = requestDuration.startTimer({ method: 'query', specialty });
try {
// Add span attributes
span.setAttribute('openevidence.specialty', specialty);
span.setAttribute('openevidence.urgency', request.context.urgency);
// Check cache first
const cached = await this.cache.get(request.question, request.context);
if (cached) {
cacheHits.inc();
span.setAttribute('cache.hit', true);
timer({ cached: 'true' });
requestCounter.inc({ method: 'query', specialty, status: 'cache_hit' });
return cached;
}
cacheMisses.inc();
span.setAttribute('cache.hit', false);
// Make API request
const response = await this.client.query(request);
// Update rate limit metrics from headers
this.updateRateLimitMetrics(response.headers);
// Record confidence score
confidenceScore.observe({ specialty }, response.confidence);
// Cache response
await this.cache.set(request.question, request.context, response);
// Record success
timer({ cached: 'false' });
requestCounter.inc({ method: 'query', specialty, status: 'success' });
span.setStatus({ code: SpanStatusCode.OK });
return response;
} catch (error: any) {
// Record error
timer({ cached: 'false' });
requestCounter.inc({ method: 'query', specialty, status: 'error' });
errorCounter.inc({ error_type: error.code || 'unknown', specialty });
span.setStatus({ code: SpanStatusCode.ERROR, message: error.message });
span.recordException(error);
throw error;
} finally {
span.end();
}
});
}
private updateRateLimitMetrics(headers: any): void {
const remaining = parseInt(headers['x-ratelimit-remaining'] || '0');
const limit = parseInt(headers['x-ratelimit-limit'] || '100');
rateLimitRemaining.set(remaining);
rateLimitPercent.set(((limit - remaining) / limit) * 100);
}
}
// src/monitoring/tracing.ts
import { NodeSDK } from '@opentelemetry/sdk-node';
import { Resource } from '@opentelemetry/resources';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { TraceExporter } from '@google-cloud/opentelemetry-cloud-trace-exporter';
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
export function initTracing(): void {
const sdk = new NodeSDK({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'clinical-evidence-api',
[SemanticResourceAttributes.SERVICE_VERSION]: process.env.npm_package_version,
[SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: process.env.NODE_ENV,
}),
traceExporter: new TraceExporter(),
instrumentations: [
new HttpInstrumentation({
requestHook: (span, request) => {
// Don't trace health checks
if (request.url?.includes('/health')) {
span.setAttribute('http.skip', true);
}
},
}),
new ExpressInstrumentation(),
],
});
sdk.start();
process.on('SIGTERM', () => {
sdk.shutdown().catch(console.error);
});
}
// src/monitoring/logger.ts
import pino from 'pino';
export const logger = pino({
name: 'clinical-evidence-api',
level: process.env.LOG_LEVEL || 'info',
formatters: {
level: (label) => ({ level: label }),
},
// Redact PHI fields
redact: {
paths: ['patient.*', 'patientId', 'mrn', '*.ssn'],
censor: '[REDACTED]',
},
});
// OpenEvidence-specific logger
export const oeLogger = logger.child({ service: 'openevidence' });
export function logClinicalQuery(
queryId: string,
specialty: string,
duration: number,
cached: boolean,
confidence?: number
): void {
oeLogger.info({
event: 'clinical_query',
queryId,
specialty,
durationMs: duration,
cached,
confidence,
});
}
export function logDeepConsult(
consultId: string,
specialty: string,
status: string,
duration?: number
): void {
oeLogger.info({
event: 'deep_consult',
consultId,
specialty,
status,
durationMs: duration,
});
}
export function logError(
error: Error,
context: Record<string, any>
): void {
oeLogger.error({
event: 'error',
errorType: error.name,
errorMessage: error.message,
...context,
});
}
# prometheus/openevidence_alerts.yaml
groups:
- name: openevidence_alerts
rules:
# High error rate
- alert: OpenEvidenceHighErrorRate
expr: |
rate(openevidence_errors_total[5m]) /
rate(openevidence_requests_total[5m]) > 0.05
for: 5m
labels:
severity: warning
service: openevidence
annotations:
summary: "OpenEvidence error rate > 5%"
description: "Error rate is {{ $value | humanizePercentage }}"
# Critical error rate
- alert: OpenEvidenceCriticalErrorRate
expr: |
rate(openevidence_errors_total[5m]) /
rate(openevidence_requests_total[5m]) > 0.20
for: 2m
labels:
severity: critical
service: openevidence
annotations:
summary: "OpenEvidence error rate > 20%"
description: "Critical error rate - possible outage"
# High latency
- alert: OpenEvidenceHighLatency
expr: |
histogram_quantile(0.95,
rate(openevidence_request_duration_seconds_bucket[5m])
) > 15
for: 5m
labels:
severity: warning
service: openevidence
annotations:
summary: "OpenEvidence P95 latency > 15s"
description: "95th percentile latency is {{ $value | humanizeDuration }}"
# Low cache hit rate
- alert: OpenEvidenceLowCacheHitRate
expr: |
rate(openevidence_cache_hits_total[1h]) /
(rate(openevidence_cache_hits_total[1h]) + rate(openevidence_cache_misses_total[1h])) < 0.5
for: 30m
labels:
severity: warning
service: openevidence
annotations:
summary: "OpenEvidence cache hit rate < 50%"
description: "Consider reviewing cache configuration"
# Rate limit warning
- alert: OpenEvidenceRateLimitWarning
expr: openevidence_rate_limit_remaining < 10
for: 1m
labels:
severity: warning
service: openevidence
annotations:
summary: "OpenEvidence rate limit < 10 remaining"
description: "Consider throttling requests"
# Service down
- alert: OpenEvidenceDown
expr: up{job="openevidence"} == 0
for: 1m
labels:
severity: critical
service: openevidence
annotations:
summary: "OpenEvidence integration is down"
description: "No successful health checks for 1 minute"
{
"dashboard": {
"title": "OpenEvidence Clinical AI",
"panels": [
{
"title": "Request Rate",
"type": "stat",
"targets": [{
"expr": "sum(rate(openevidence_requests_total[5m]))",
"legendFormat": "req/s"
}]
},
{
"title": "Error Rate",
"type": "gauge",
"targets": [{
"expr": "sum(rate(openevidence_errors_total[5m])) / sum(rate(openevidence_requests_total[5m])) * 100"
}],
"fieldConfig": {
"defaults": {
"max": 100,
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": 0},
{"color": "yellow", "value": 5},
{"color": "red", "value": 20}
]
}
}
}
},
{
"title": "Latency Distribution",
"type": "heatmap",
"targets": [{
"expr": "sum(rate(openevidence_request_duration_seconds_bucket[5m])) by (le)"
}]
},
{
"title": "Cache Hit Rate",
"type": "timeseries",
"targets": [{
"expr": "sum(rate(openevidence_cache_hits_total[5m])) / (sum(rate(openevidence_cache_hits_total[5m])) + sum(rate(openevidence_cache_misses_total[5m])))",
"legendFormat": "Hit Rate"
}]
},
{
"title": "Rate Limit Usage",
"type": "gauge",
"targets": [{
"expr": "openevidence_rate_limit_usage_percent"
}],
"fieldConfig": {
"defaults": {
"max": 100,
"thresholds": {
"mode": "absolute",
"steps": [
{"color": "green", "value": 0},
{"color": "yellow", "value": 70},
{"color": "red", "value": 90}
]
}
}
}
},
{
"title": "Confidence Score Distribution",
"type": "histogram",
"targets": [{
"expr": "openevidence_confidence_score"
}]
}
]
}
}
// src/routes/metrics.ts
import { Router } from 'express';
import { registry } from '../monitoring/metrics';
const router = Router();
router.get('/metrics', async (req, res) => {
res.set('Content-Type', registry.contentType);
res.send(await registry.metrics());
});
export default router;
For incident response, see openevidence-incident-runbook.
Guide developers through setting up development environments with proper tools, dependencies, and configurations
Implement Exa lint rules, policy enforcement, and automated guardrails. Use when setting up code quality rules for Exa integrations, implementing pre-commit hooks, or configuring CI policy checks for Exa best practices. Trigger with phrases like "exa policy", "exa lint", "exa guardrails", "exa be...
Configure CI/CD pipelines for Documenso integrations. Use when setting up automated testing, deployment pipelines, or continuous integration for Documenso projects. Trigger with phrases like "documenso CI", "documenso GitHub Actions", "documenso pipeline", "documenso automated testing".
Build check model availability and implement fallback chains. Use when building resilient systems or handling model outages. Trigger with phrases like 'openrouter availability', 'openrouter fallback', 'openrouter model down', 'openrouter health check'.
Configure Langfuse enterprise organization management and access control. Use when implementing team access controls, configuring organization settings, or setting up role-based permissions for Langfuse projects. Trigger with phrases like "langfuse RBAC", "langfuse teams", "langfuse organization"...
Execute compliance and security auditing for Cursor usage. Triggers on "cursor compliance", "cursor audit", "cursor security review", "cursor soc2", "cursor gdpr". Use when analyzing or auditing cursor compliance audit. Trigger with phrases like "cursor compliance audit", "cursor audit", "cursor".
Configure Apollo.io CI/CD integration. Use when setting up automated testing, continuous integration, or deployment pipelines for Apollo integrations. Trigger with phrases like "apollo ci", "apollo github actions", "apollo pipeline", "apollo ci/cd", "apollo automated tests".
Create robust Python automation with full logging and safety checks. Use when tasks need complex data processing, authenticated API work, conditional file operations, or error handling beyond simple shell commands.
Configure PostHog across development, staging, and production environments. Use when setting up multi-environment deployments, configuring per-environment secrets, or implementing environment-specific PostHog configurations. Trigger with phrases like "posthog environments", "posthog staging", "po...
Expert in designing and building autonomous AI agents. Masters tool use, memory systems, planning strategies, and multi-agent orchestration. Use when: build agent, AI agent, autonomous agent, tool use, function calling.
Validate insecure deserialization checker operations. Auto-activating skill for Security Fundamentals. Triggers on: insecure deserialization checker, insecure deserialization checker Part of the Security Fundamentals skill category. Use when working with insecure deserialization checker functiona...
Manage path traversal finder operations. Auto-activating skill for Security Fundamentals. Triggers on: path traversal finder, path traversal finder Part of the Security Fundamentals skill category. Use when working with path traversal finder functionality. Trigger with phrases like "path traversa...
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience