정보
이 스킬은 로그-트레이스 예시 구현과 RED/USE 방법론을 활용한 대시보드 구축을 통해 메트릭, 로그, 트레이스를 통합하여 디버깅을 일원화합니다. 복잡한 다중 시스템 장애 조사 시 관찰 가능성 신호 전반에 걸친 근본 원인 분석을 신속히 수행할 수 있게 하여 MTTR을 획기적으로 단축합니다. 분산 추적을 구현하거나 단절된 도구에서 통합 관찰 가능성 플랫폼으로 전환할 때 사용하세요.
빠른 설치
Claude Code
추천npx skills add pjt222/agent-almanac -a claude-code/plugin add https://github.com/pjt222/agent-almanacgit clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/correlate-observability-signalsClaude Code에서 이 명령을 복사하여 붙여넣어 스킬을 설치하세요
문서
オブザーバビリティシグナルの相関
オブザーバビリティの三本柱にわたって、メトリクス、ログ、トレースを統合デバッグ用に接続する。
使用タイミング
- 複数システムにまたがる複雑なインシデントの調査時
- MTTR(平均修復時間)の短縮時
- 統合オブザーバビリティダッシュボードの構築時
- 分散トレーシングの実装時
- サイロ化されたツールから統合オブザーバビリティへの移行時
入力
- 必須: Prometheus(メトリクス)
- 必須: ログ集約システム(Loki、Elasticsearch、CloudWatch)
- 必須: 分散トレーシングバックエンド(Tempo、Jaeger、Zipkin)
- 任意: 統合可視化用のGrafana
- 任意: OpenTelemetryインストルメンテーション
手順
完全な設定ファイルとテンプレートについては拡張例を参照。
ステップ1: トレースコンテキスト伝播の実装
OpenTelemetryを使用してすべてのログとメトリクスにトレースIDを追加する:
// Go example: Propagate trace context to logs
package main
import (
"context"
"log"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/trace"
)
func handleRequest(ctx context.Context, userID string) {
// Extract trace context
span := trace.SpanFromContext(ctx)
traceID := span.SpanContext().TraceID().String()
// Include trace ID in structured logs
log.Printf("trace_id=%s user_id=%s action=process_request", traceID, userID)
// Business logic here
processData(ctx, userID)
}
func processData(ctx context.Context, userID string) {
tracer := otel.Tracer("my-service")
ctx, span := tracer.Start(ctx, "processData")
defer span.End()
traceID := span.SpanContext().TraceID().String()
log.Printf("trace_id=%s user_id=%s action=process_data", traceID, userID)
// More work
}
Pythonの例:
# Python: Flask with OpenTelemetry
from flask import Flask, request
from opentelemetry import trace
from opentelemetry.instrumentation.flask import FlaskInstrumentor
import logging
app = Flask(__name__)
FlaskInstrumentor().instrument_app(app)
logging.basicConfig(
format='%(asctime)s trace_id=%(otelTraceID)s span_id=%(otelSpanID)s %(message)s',
level=logging.INFO
)
@app.route('/api/users/<user_id>')
def get_user(user_id):
span = trace.get_current_span()
trace_id = format(span.get_span_context().trace_id, '032x')
logging.info(f"Fetching user {user_id}", extra={
'otelTraceID': trace_id,
'otelSpanID': format(span.get_span_context().span_id, '016x')
})
# Business logic
return {"user_id": user_id}
期待結果: すべてのログにtrace_idフィールドが含まれ、ログからトレースへの相関が可能になる。
失敗時: トレースIDが欠落している場合、OpenTelemetry SDKの初期化とコンテキスト伝播を確認する。
ステップ2: Prometheusでのエグザンプラー設定
エグザンプラーはメトリクスをトレースにリンクする:
# prometheus.yml
global:
scrape_interval: 15s
# Enable exemplar storage
exemplars:
max_exemplars: 100000 # Per TSDB block
scrape_configs:
- job_name: 'api-service'
static_configs:
- targets: ['api-service:8080']
# Scrape exemplars
metric_relabel_configs:
- source_labels: [__name__]
regex: 'http_request_duration_seconds.*'
action: keep
エグザンプラーを発行するようにアプリケーションをインストルメント:
// Go: Emit exemplars with Prometheus histogram
package main
import (
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promauto"
"go.opentelemetry.io/otel/trace"
)
var httpDuration = promauto.NewHistogramVec(
prometheus.HistogramOpts{
Name: "http_request_duration_seconds",
Help: "HTTP request duration",
Buckets: prometheus.DefBuckets,
},
[]string{"method", "endpoint", "status"},
)
func recordRequest(ctx context.Context, method, endpoint, status string, duration float64) {
// Get trace ID for exemplar
span := trace.SpanFromContext(ctx)
traceID := span.SpanContext().TraceID().String()
// Record metric with exemplar
observer := httpDuration.WithLabelValues(method, endpoint, status)
observer.(prometheus.ExemplarObserver).ObserveWithExemplar(
duration,
prometheus.Labels{"trace_id": traceID},
)
}
Prometheusでエグザンプラーをクエリする:
# Histogram with exemplars
histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))
Grafanaでは、エグザンプラーがヒストグラムグラフ上にドットとして表示され、トレースにリンクする。
期待結果: Grafanaのメトリクスグラフにエグザンプラーが表示され、クリックすると対応するトレースが開く。
失敗時: Prometheusバージョンが2.26以上(エグザンプラーサポート)であることを確認し、Grafanaデータソース設定でエグザンプラーが有効になっているか確認する。
ステップ3: REDメソッドによる統合ダッシュボードの構築
REDメソッド: Rate(レート)、Errors(エラー)、Duration(期間)(サービス向け)
{
"dashboard": {
"title": "API Service - RED Dashboard",
"panels": [
{
"title": "Request Rate (req/s)",
"type": "graph",
"targets": [
{
"expr": "sum(rate(http_requests_total{job=\"api-service\"}[5m])) by (endpoint)",
"legendFormat": "{{ endpoint }}"
}
],
"exemplars": true
},
{
"title": "Error Rate (%)",
"type": "graph",
"targets": [
{
"expr": "sum(rate(http_requests_total{job=\"api-service\", status=~\"5..\"}[5m])) / sum(rate(http_requests_total{job=\"api-service\"}[5m])) * 100",
"legendFormat": "Error %"
}
],
"exemplars": true
},
{
"title": "Request Duration (p50, p95, p99)",
"type": "graph",
"targets": [
{
"expr": "histogram_quantile(0.50, rate(http_request_duration_seconds_bucket{job=\"api-service\"}[5m]))",
"legendFormat": "p50"
},
{
"expr": "histogram_quantile(0.95, rate(http_request_duration_seconds_bucket{job=\"api-service\"}[5m]))",
"legendFormat": "p95"
},
{
"expr": "histogram_quantile(0.99, rate(http_request_duration_seconds_bucket{job=\"api-service\"}[5m]))",
"legendFormat": "p99"
}
],
"exemplars": true
},
{
"title": "Correlated Logs",
"type": "logs",
"datasource": "Loki",
"targets": [
{
"expr": "{job=\"api-service\"} |= \"error\""
}
],
"options": {
"showTime": true,
"enableLogDetails": true
}
}
]
}
}
期待結果: レート、エラー、期間+相関ログを表示する単一ダッシュボード。
失敗時: パネルが「No Data」を表示する場合、メトリクス名がインストルメンテーションと一致しているか確認する。
ステップ4: リソース用のUSEメソッドの実装
USEメソッド: Utilization(使用率)、Saturation(飽和度)、Errors(エラー)(CPU、メモリ、ディスクなどのリソース向け)
{
"dashboard": {
"title": "Node Resources - USE Dashboard",
"panels": [
{
"title": "CPU Utilization (%)",
"type": "graph",
"targets": [
{
"expr": "100 - (avg(rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)",
"legendFormat": "CPU Usage %"
}
]
},
{
"title": "CPU Saturation (Load Average)",
"type": "graph",
"targets": [
{
"expr": "node_load1",
"legendFormat": "1min load"
},
{
"expr": "node_load5",
"legendFormat": "5min load"
},
{
"expr": "count(node_cpu_seconds_total{mode=\"idle\"})",
"legendFormat": "CPU cores (threshold)"
}
]
},
{
"title": "Memory Utilization (%)",
"type": "graph",
"targets": [
{
"expr": "(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes * 100",
"legendFormat": "Memory Usage %"
}
]
},
{
"title": "Memory Saturation (Page Faults)",
"type": "graph",
"targets": [
{
"expr": "rate(node_vmstat_pgmajfault[5m])",
"legendFormat": "Major page faults/s"
}
]
},
{
"title": "Disk Utilization (%)",
"type": "graph",
"targets": [
{
"expr": "(node_filesystem_size_bytes - node_filesystem_free_bytes) / node_filesystem_size_bytes * 100",
"legendFormat": "{{ device }}"
}
]
},
{
"title": "Disk Saturation (IO Wait %)",
"type": "graph",
"targets": [
{
"expr": "rate(node_cpu_seconds_total{mode=\"iowait\"}[5m]) * 100",
"legendFormat": "IO Wait %"
}
]
}
]
}
}
期待結果: すべてのUSEディメンションにわたるリソースの健全性を表示するダッシュボード。
失敗時: node_exporterが実行中でシステムメトリクスをスクレイピングしていることを確認する。
ステップ5: Lokiでのログからトレースへのリンク
トレースIDを抽出するようにLokiを設定する:
# loki-config.yml
schema_config:
configs:
- from: 2024-01-01
store: boltdb-shipper
object_store: s3
schema: v11
index:
prefix: index_
period: 24h
# Derived fields for trace linking
query_config:
derived_fields:
- name: TraceID
source: trace_id
url: 'https://tempo.company.com/trace/${__value.raw}'
urlDisplayLabel: 'View Trace'
GrafanaでLokiデータソースを設定する:
{
"name": "Loki",
"type": "loki",
"url": "http://loki:3100",
"jsonData": {
"derivedFields": [
{
"datasourceUid": "tempo-uid",
"matcherRegex": "trace_id=(\\w+)",
"name": "TraceID",
"url": "$${__value.raw}"
}
]
}
}
期待結果: LokiログのトレースIDをクリックするとTempoの対応するトレースが開く。
失敗時: 正規表現がログフォーマットに一致しているか確認し、TempoデータソースUIDを確認する。
ステップ6: 統合インシデントビューの作成
すべてのシグナルをまとめるダッシュボードを構築する:
{
"dashboard": {
"title": "Incident Investigation",
"templating": {
"list": [
{
# ... (完全な設定はEXAMPLES.mdを参照)
インシデント中のワークフロー:
- 高エラー率のアラートが発報
- オンコールエンジニアがGrafanaダッシュボードを開く
- 特定の時間帯のエラー率のスパイクを特定
- 期間ヒストグラムのエグザンプラードットをクリック→トレースが開く
- トレースが遅いデータベースクエリを表示
- スパンの「View Logs」をクリック→そのトレースのログが開く
- ログがタイムアウトの原因となっている特定のSQLクエリを明らかにする
- 2分以内に根本原因を特定
期待結果: メトリクス/ログ/トレース間を行き来するデバッグ用の単一ペイン。
失敗時: リンクが機能しない場合、データソース設定とトレースID伝播を確認する。
バリデーション
- すべてのアプリケーションログにトレースIDが含まれている
- Prometheusがエグザンプラーをスクレイピングしている
- Grafanaダッシュボードのヒストグラムにエグザンプラードットが表示される
- エグザンプラーをクリックするとTempo/Jaegerの対応するトレースが開く
- Lokiログに機能する「View Trace」リンクがある
- 主要サービスのREDダッシュボードが作成されている
- インフラストラクチャのUSEダッシュボードが作成されている
- 統合インシデントダッシュボードがGameDayでテスト済み
よくある落とし穴
- 一貫性のないトレースIDフォーマット: OpenTelemetryは32文字hex、Jaegerは16文字を使用。1つを選ぶ
- コンテキスト伝播の欠落: トレースIDがサービス間で流れない場合、分散トレーシングが壊れる。OpenTelemetryの自動インストルメンテーションを使用する
- エグザンプラーの過負荷: エグザンプラーが多すぎると(>100k)Prometheusが遅くなる可能性がある。高ボリュームメトリクスをサンプリングする
- 時計のズレ: トレースは複数サービスにまたがる。NTPが設定されていることを確認する。クロックドリフトがトレースの順序の問題を引き起こす
- データ保持期間の不一致: トレースがメトリクスより先に期限切れになると相関が壊れる。保持ポリシーを揃える
関連スキル
setup-prometheus-monitoring-- 相関のためのメトリクス基盤configure-log-aggregation-- 相関のためのログ基盤instrument-distributed-tracing-- 相関のためのトレース基盤build-grafana-dashboards-- 統合可視化レイヤー
GitHub 저장소
Frequently asked questions
What is the correlate-observability-signals skill?
correlate-observability-signals is a Claude Skill by pjt222. Skills package instructions and resources that Claude loads on demand, so Claude can perform correlate-observability-signals-related tasks without extra prompting.
How do I install correlate-observability-signals?
Use the install commands on this page: add correlate-observability-signals to Claude Code as a plugin, or clone its repository into your skills directory, then restart Claude so it picks up the skill.
What category does correlate-observability-signals belong to?
correlate-observability-signals is in the Other category, tagged general.
Is correlate-observability-signals free to use?
Yes. correlate-observability-signals is listed on AIMCP and free to install. It runs inside Claude, so no separate service account is required to use the skill itself.
연관 스킬
LlamaGuard는 폭력 및 혐오 발언 등 6가지 안전 범주에서 LLM 입력과 출력을 조정하기 위한 Meta의 70-80억 파라미터 모델입니다. 94-95% 정확도를 제공하며 vLLM, Hugging Face 또는 Amazon SageMaker를 사용해 배포할 수 있습니다. 이 기술을 사용하여 AI 애플리케이션에 콘텐츠 필터링 및 안전 가드레일을 손쉽게 통합하세요.
이 Claude Skill은 리소스 적정화, 태깅 전략, 지출 분석을 통해 개발자들이 클라우드 비용을 최적화할 수 있도록 지원합니다. AWS, Azure, GCP에서 클라우드 비용을 절감하고 비용 거버넌스를 구현하기 위한 프레임워크를 제공합니다. 인프라 비용을 분석하거나, 리소스를 적정화하거나, 예산 제약을 충족해야 할 때 사용하세요.
이 Claude Skill은 스프레드, 오버/언더, 프로프 베트를 포함한 스포츠 베팅 시장을 분석합니다. 역사적 추이와 상황별 통계를 검토하여 가치 베트를 발견하고, 교육적 목적으로 실행 가능한 권장 사항이 담긴 구조화된 마크다운 결과를 제공합니다. 개발자는 이 기능을 스포츠 베팅 분석 도구에 활용할 수 있으며, 단순히 엔터테인먼트/교육 목적으로만 설계되었음을 유의해야 합니다.
이 스킬은 bitsandbytes를 사용하여 LLM을 8비트 또는 4비트 정밀도로 양자화하며, 최소한의 정확도 손실로 50-75%의 메모리 감소를 달성합니다. 제한된 GPU 메모리에서 더 큰 모델을 실행하거나 추론을 가속화하는 데 이상적이며, INT8, NF4, FP4와 같은 형식을 지원합니다. 이 스킬은 HuggingFace Transformers와 통합되어 QLoRA 학습 및 8비트 옵티마이저를 가능하게 합니다.
