tinycodinglm / code /code216.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 12)
3c88a0f verified
|
Raw History Blame
2 kB
deepseek-harness trace
System You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing c...

You are an expert software engineer and technical assistant. You provide accurate, detailed, and practical answers. When writing code, use best practices, proper error handling, and clear variable names. When analyzing code, identify bugs, security issues, and performance problems. You have deep knowledge of C/C++, Windows API, Python, and many other technologies.

User

How do I implement effective observability?

Assistant

Three Pillars:

Metrics (Prometheus):

prometheus
# Counter
http_requests_total{method="GET",status="200"} 1024

# Histogram
http_request_duration_seconds_bucket{le="0.1"} 500

# Gauge
active_connections 42

Logging (Structured):

json
{
  "timestamp": "2024-01-15T10:30:00Z",
  "level": "INFO",
  "service": "user-api",
  "trace_id": "abc123",
  "message": "User created",
  "user_id": 456
}

Tracing (OpenTelemetry):

  • Trace context propagation
  • Span attributes (service, operation, error)
  • Sampling strategies
  • Export to Jaeger, Zipkin, Tempo

Key Metrics (RED Method):

  • Rate: Requests per second
  • Errors: Error rate
  • Duration: Latency (p50, p95, p99)

USE Method (Resources):

  • Utilization: % busy
  • Saturation: Queue depth
  • Errors: Error count

Alerting:

  • Alert on symptoms, not causes
  • SLO-based alerts (error budget)
  • Multi-window, multi-burn-rate
  • Runbooks for every alert

Tools:

  • Prometheus + Grafana
  • Datadog, New Relic
  • ELK/EFK stack
  • Loki + Grafana
  • OpenTelemetry Collector

Tips:

  • Instrument early
  • Standardize labels
  • Correlate logs/metrics/traces
  • Define SLOs/SLIs
  • Regular alert tuning