jpskill.com
💼 ビジネス コミュニティ

correlation-tracing

マイクロサービスが連携するシステムで、処理の流れを追跡し、問題箇所を特定するために、相関IDやトレース情報を活用して、システム全体の動きを可視化するSkill。

📜 元の英語説明(参考)

Implement distributed tracing with correlation IDs, trace propagation, and span tracking across microservices. Use when debugging distributed systems, monitoring request flows, or implementing observability.

🇯🇵 日本人クリエイター向け解説

一言でいうと

マイクロサービスが連携するシステムで、処理の流れを追跡し、問題箇所を特定するために、相関IDやトレース情報を活用して、システム全体の動きを可視化するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o correlation-tracing.zip https://jpskill.com/download/21381.zip && unzip -o correlation-tracing.zip && rm correlation-tracing.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/21381.zip -OutFile "$d\correlation-tracing.zip"; Expand-Archive "$d\correlation-tracing.zip" -DestinationPath $d -Force; ri "$d\correlation-tracing.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して correlation-tracing.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → correlation-tracing フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
6

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

相関関係と分散トレーシング

目次

概要

相関IDと分散トレーシングを実装して、複数のサービスにわたるリクエストを追跡し、システム動作を理解します。

使用場面

  • マイクロサービスアーキテクチャ
  • 分散システムのデバッグ
  • パフォーマンス監視
  • リクエストフローの可視化
  • サービス間のエラー追跡
  • 依存関係分析
  • レイテンシー最適化

クイックスタート

最小限の動作例:

import express from "express";
import { v4 as uuidv4 } from "uuid";

// Async local storage for context
import { AsyncLocalStorage } from "async_hooks";

const traceContext = new AsyncLocalStorage<Map<string, any>>();

interface TraceContext {
  traceId: string;
  spanId: string;
  parentSpanId?: string;
  serviceName: string;
}

function correlationMiddleware(serviceName: string) {
  return (
    req: express.Request,
    res: express.Response,
    next: express.NextFunction,
  ) => {
    // Extract or generate trace ID
    const traceId = (req.headers["x-trace-id"] as string) || uuidv4();
    const parentSpanId = req.headers["x-span-id"] as string;
    const spanId = uuidv4();
// ... (see reference guides for full implementation)

リファレンスガイド

references/ ディレクトリ内の詳細な実装:

ガイド 内容
Correlation ID Middleware (Express) Correlation ID Middleware (Express)
OpenTelemetry Integration OpenTelemetry Integration
Python Distributed Tracing Python Distributed Tracing
Manual Trace Propagation Manual Trace Propagation

ベストプラクティス

✅ DO

  • エントリポイントでトレースIDを生成する
  • サービス間でトレースコンテキストを伝播する
  • ログに相関IDを含める
  • 構造化ロギングを使用する
  • 適切なスパン属性を設定する
  • トラフィックの多いシステムでトレースをサンプリングする
  • トレース収集のオーバーヘッドを監視する
  • コンテキスト伝播を実装する

❌ DON'T

  • トレース伝播をスキップする
  • 相関コンテキストなしでログを記録する
  • スパンを過剰に作成する
  • 機密データをスパンに保存する
  • トレースレポートでブロックする
  • エラー追跡を忘れる
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Correlation & Distributed Tracing

Table of Contents

Overview

Implement correlation IDs and distributed tracing to track requests across multiple services and understand system behavior.

When to Use

  • Microservices architectures
  • Debugging distributed systems
  • Performance monitoring
  • Request flow visualization
  • Error tracking across services
  • Dependency analysis
  • Latency optimization

Quick Start

Minimal working example:

import express from "express";
import { v4 as uuidv4 } from "uuid";

// Async local storage for context
import { AsyncLocalStorage } from "async_hooks";

const traceContext = new AsyncLocalStorage<Map<string, any>>();

interface TraceContext {
  traceId: string;
  spanId: string;
  parentSpanId?: string;
  serviceName: string;
}

function correlationMiddleware(serviceName: string) {
  return (
    req: express.Request,
    res: express.Response,
    next: express.NextFunction,
  ) => {
    // Extract or generate trace ID
    const traceId = (req.headers["x-trace-id"] as string) || uuidv4();
    const parentSpanId = req.headers["x-span-id"] as string;
    const spanId = uuidv4();
// ... (see reference guides for full implementation)

Reference Guides

Detailed implementations in the references/ directory:

Guide Contents
Correlation ID Middleware (Express) Correlation ID Middleware (Express)
OpenTelemetry Integration OpenTelemetry Integration
Python Distributed Tracing Python Distributed Tracing
Manual Trace Propagation Manual Trace Propagation

Best Practices

✅ DO

  • Generate trace IDs at entry points
  • Propagate trace context across services
  • Include correlation IDs in logs
  • Use structured logging
  • Set appropriate span attributes
  • Sample traces in high-traffic systems
  • Monitor trace collection overhead
  • Implement context propagation

❌ DON'T

  • Skip trace propagation
  • Log without correlation context
  • Create too many spans
  • Store sensitive data in spans
  • Block on trace reporting
  • Forget error tracking

同梱ファイル

※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。