ジョブトラッキング

ジョブの進捗を監視

ジョブの実行状況を追跡し、進捗を監視し、詳細な実行ログを取得します。

ジョブ実行ログの取得

GET /api/{tenantId}/{projectId}/execution/job/{jobId}/logs

特定のジョブの詳細な実行ログを取得します。進捗更新、エラーメッセージ、パフォーマンス指標を含みます。

パラメーター

パラメーター 種類 場所 説明
tenantId GUID パス テナント識別子
projectId GUID パス プロジェクト識別子
jobId GUID パス ジョブ識別子

クエリパラメーター

パラメーター 種類 説明
level string ログレベルでフィルタ: DEBUG, INFO, WARN, ERROR (デフォルト: INFO)
fromTime datetime ここからのタイムスタンプのログを取得
toTime datetime ここまでのタイムスタンプのログを取得
limit integer 最大ログエントリ数 (デフォルト: 1000, 最大: 10000)
format string レスポンス形式: structured, raw (デフォルト: structured)

レスポンス

{
  "jobId": "cc0e8400-e29b-41d4-a716-446655440000",
  "jobName": "Customer Journey Analysis",
  "jobStatus": "Running",
  "logsSummary": {
    "totalEntries": 247,
    "debugEntries": 89,
    "infoEntries": 145,
    "warnEntries": 11,
    "errorEntries": 2,
    "timeRange": {
      "startTime": "2024-01-20T10:30:00Z",
      "endTime": "2024-01-20T10:45:00Z"
    }
  },
  "logs": [
    {
      "timestamp": "2024-01-20T10:30:15Z",
      "level": "INFO",
      "component": "DataLoader",
      "stage": "Initialization",
      "message": "Starting data load for dataset 880e8400-e29b-41d4-a716-446655440000",
      "details": {
        "datasetSize": "45.7 MB",
        "expectedRecords": 192850,
        "format": "CSV"
      }
    },
    {
      "timestamp": "2024-01-20T10:32:45Z",
      "level": "INFO",
      "component": "ProcessMiner",
      "stage": "Data Processing",
      "message": "Processing batch 1 of 15",
      "details": {
        "batchSize": 12856,
        "progress": 6.7,
        "recordsPerSecond": 1247
      }
    },
    {
      "timestamp": "2024-01-20T10:38:22Z",
      "level": "WARN",
      "component": "DataValidator",
      "stage": "Data Processing",
      "message": "Found 125 records with missing timestamps",
      "details": {
        "affectedRecords": 125,
        "action": "Timestamp inferred from surrounding events",
        "impactOnAnalysis": "Minimal"
      }
    },
    {
      "timestamp": "2024-01-20T10:41:10Z",
      "level": "ERROR",
      "component": "AnalyticsEngine",
      "stage": "Analysis",
      "message": "Memory limit exceeded during bottleneck analysis",
      "details": {
        "memoryUsage": "3.8 GB",
        "memoryLimit": "4.0 GB",
        "action": "Switching to disk-based processing",
        "retry": true
      }
    },
    {
      "timestamp": "2024-01-20T10:45:33Z",
      "level": "INFO",
      "component": "ReportGenerator",
      "stage": "Output Generation",
      "message": "Generating process map visualization",
      "details": {
        "activitiesCount": 47,
        "pathsCount": 156,
        "formatRequested": "SVG"
      }
    }
  ],
  "executionMetrics": {
    "currentStage": "Output Generation",
    "stageProgress": 78,
    "overallProgress": 85,
    "processingRate": "1250 records/second",
    "memoryUsage": "2.3 GB",
    "cpuUsage": 67,
    "estimatedCompletion": "2024-01-20T10:52:00Z"
  }
}

ジョブ進捗の追跡

GET /api/{tenantId}/{projectId}/execution/job/{jobId}/progress

実行中のジョブのリアルタイムの進捗情報を取得します。ステージごとの完了状況やパフォーマンス指標を含みます。

レスポンス

{
  "jobId": "cc0e8400-e29b-41d4-a716-446655440000",
  "jobName": "Customer Journey Analysis",
  "status": "Running",
  "overallProgress": {
    "percentage": 85,
    "startTime": "2024-01-20T10:30:00Z",
    "elapsedTime": "15 minutes 33 seconds",
    "estimatedRemaining": "2 minutes 27 seconds",
    "estimatedCompletion": "2024-01-20T10:52:00Z"
  },
  "stages": [
    {
      "stageName": "Data Loading",
      "stageOrder": 1,
      "status": "Completed",
      "progress": 100,
      "startTime": "2024-01-20T10:30:00Z",
      "endTime": "2024-01-20T10:32:15Z",
      "duration": "2 minutes 15 seconds",
      "recordsProcessed": 192850,
      "metrics": {
        "throughput": "1427 records/second",
        "dataValidated": true,
        "errorsFound": 0
      }
    },
    {
      "stageName": "Process Discovery",
      "stageOrder": 2,
      "status": "Completed",
      "progress": 100,
      "startTime": "2024-01-20T10:32:15Z",
      "endTime": "2024-01-20T10:41:30Z",
      "duration": "9 minutes 15 seconds",
      "recordsProcessed": 192850,
      "metrics": {
        "activitiesDiscovered": 47,
        "variantsFound": 234,
        "pathsIdentified": 156
      }
    },
    {
      "stageName": "Performance Analysis",
      "stageOrder": 3,
      "status": "Running",
      "progress": 78,
      "startTime": "2024-01-20T10:41:30Z",
      "estimatedEndTime": "2024-01-20T10:48:00Z",
      "recordsProcessed": 150243,
      "totalRecords": 192850,
      "metrics": {
        "bottlenecksIdentified": 8,
        "waitTimeCalculated": 150243,
        "cycleTimeCalculated": 150243
      }
    },
    {
      "stageName": "Report Generation",
      "stageOrder": 4,
      "status": "Pending",
      "progress": 0,
      "estimatedStartTime": "2024-01-20T10:48:00Z",
      "estimatedEndTime": "2024-01-20T10:52:00Z"
    }
  ],
  "currentActivity": {
    "component": "PerformanceAnalyzer",
    "operation": "Calculating resource utilization metrics",
    "details": "Processing activity transitions for efficiency analysis"
  },
  "resourceUsage": {
    "memoryUsage": "2.3 GB",
    "memoryLimit": "4.0 GB",
    "cpuUsage": 67,
    "diskUsage": "890 MB",
    "networkIO": "12 MB",
    "processingRate": "1250 records/second"
  },
  "qualityMetrics": {
    "dataQualityScore": 94.8,
    "validationsPassed": 15,
    "validationsFailed": 1,
    "warningsGenerated": 11,
    "errorsEncountered": 2
  }
}

ジョブ実行タイムラインの取得

GET /api/{tenantId}/{projectId}/execution/job/{jobId}/timeline

ジョブ実行イベントの詳細なタイムラインを取得します。ステージの遷移、リソース割り当ての変更、重要なマイルストーンを含みます。

クエリパラメーター

パラメーター 種類 説明
includeSubEvents boolean 詳細なサブイベントを含める (デフォルト: false)
granularity string タイムラインの粒度: seconds, minutes, major_events (デフォルト: minutes)

レスポンス

{
  "jobId": "cc0e8400-e29b-41d4-a716-446655440000",
  "jobName": "Customer Journey Analysis",
  "timelineScope": {
    "startTime": "2024-01-20T10:30:00Z",
    "currentTime": "2024-01-20T10:45:33Z",
    "endTime": null,
    "granularity": "minutes"
  },
  "timeline": [
    {
      "timestamp": "2024-01-20T10:30:00Z",
      "eventType": "JobStarted",
      "description": "ジョブ実行開始",
      "details": {
        "submittedBy": "user123",
        "priority": "High",
        "estimatedDuration": "20-25 minutes",
        "resourcesAllocated": {
          "cpuUnits": 2,
          "memoryGB": 4,
          "workerNode": "worker-node-02"
        }
      }
    },
    {
      "timestamp": "2024-01-20T10:30:15Z",
      "eventType": "StageStarted",
      "description": "データローディングステージ開始",
      "details": {
        "stageName": "Data Loading",
        "expectedDuration": "2-3 minutes",
        "datasetSize": "45.7 MB",
        "recordCount": 192850
      }
    },
    {
      "timestamp": "2024-01-20T10:32:15Z",
      "eventType": "StageCompleted",
      "description": "データローディングステージ完了",
      "details": {
        "stageName": "Data Loading",
        "actualDuration": "2 minutes 15 seconds",
        "recordsLoaded": 192850,
        "dataQualityScore": 98.2,
        "errorsFound": 0
      }
    },
    {
      "timestamp": "2024-01-20T10:32:15Z",
      "eventType": "StageStarted",
      "description": "プロセスディスカバリーステージ開始",
      "details": {
        "stageName": "Process Discovery",
        "expectedDuration": "8-12 minutes",
        "algorithm": "Alpha Miner Enhanced"
      }
    },
    {
      "timestamp": "2024-01-20T10:35:30Z",
      "eventType": "Milestone",
      "description": "プロセスモデル発見",
      "details": {
        "activitiesFound": 47,
        "uniqueActivities": 47,
        "processComplexity": "Medium"
      }
    },
    {
      "timestamp": "2024-01-20T10:38:22Z",
      "eventType": "Warning",
      "description": "データ品質問題検出",
      "details": {
        "issue": "タイムスタンプの欠損",
        "affectedRecords": 125,
        "resolution": "タイムスタンプを推定",
        "impact": "Minimal"
      }
    },
    {
      "timestamp": "2024-01-20T10:41:10Z",
      "eventType": "Error",
      "description": "メモリ制限に接近",
      "details": {
        "memoryUsage": "3.8 GB",
        "memoryLimit": "4.0 GB",
        "action": "ディスクベース処理に切り替え",
        "performanceImpact": "15% 遅延処理"
      }
    },
    {
      "timestamp": "2024-01-20T10:41:30Z",
      "eventType": "StageCompleted",
      "description": "プロセスディスカバリーステージ完了",
      "details": {
        "stageName": "Process Discovery",
        "actualDuration": "9 minutes 15 seconds",
        "processVariants": 234,
        "pathsDiscovered": 156
      }
    },
    {
      "timestamp": "2024-01-20T10:41:30Z",
      "eventType": "StageStarted",
      "description": "パフォーマンス分析ステージ開始",
      "details": {
        "stageName": "Performance Analysis",
        "expectedDuration": "6-8 minutes",
        "analysisTypes": ["Bottleneck", "Resource Utilization", "Cycle Time"]
      }
    },
    {
      "timestamp": "2024-01-20T10:45:33Z",
      "eventType": "Progress",
      "description": "パフォーマンス分析 78% 完了",
      "details": {
        "stageName": "Performance Analysis",
        "progress": 78,
        "currentOperation": "リソース利用率分析",
        "recordsProcessed": 150243,
        "remainingRecords": 42607
      }
    }
  ],
  "upcomingEvents": [
    {
      "estimatedTime": "2024-01-20T10:48:00Z",
      "eventType": "StageCompletion",
      "description": "パフォーマンス分析ステージ完了予定"
    },
    {
      "estimatedTime": "2024-01-20T10:48:00Z",
      "eventType": "StageStart",
      "description": "レポート生成ステージ開始予定"
    },
    {
      "estimatedTime": "2024-01-20T10:52:00Z",
      "eventType": "JobCompletion",
      "description": "ジョブ完了予定"
    }
  ]
}

ジョブパフォーマンス指標の取得

GET /api/{tenantId}/{projectId}/execution/job/{jobId}/metrics

ジョブ実行の詳細なパフォーマンス指標を取得します。リソース利用率、スループット、効率測定を含みます。

クエリパラメーター

パラメーター 種類 説明
interval string 指標収集間隔: 1m, 5m, 15m (デフォルト: 5m)
metrics string カンマ区切りの指標リスト: cpu, memory, disk, network, throughput
includeHistory boolean 過去の指標データも含める (デフォルト: false)

レスポンス

{
  "jobId": "cc0e8400-e29b-41d4-a716-446655440000",
  "metricsCollectionTime": "2024-01-20T10:45:33Z",
  "currentMetrics": {
    "resourceUtilization": {
      "cpu": {
        "usage": 67,
        "cores": 2,
        "efficiency": 89.2
      },
      "memory": {
        "used": "2.3 GB",
        "allocated": "4.0 GB",
        "peak": "3.8 GB",
        "efficiency": 87.5
      },
      "disk": {
        "reads": "450 MB",
        "writes": "89 MB",
        "iops": 145,
        "latency": "12ms"
      },
      "network": {
        "bytesIn": "67 MB",
        "bytesOut": "12 MB",
        "connections": 8
      }
    },
    "processing": {
      "recordsPerSecond": 1250,
      "recordsProcessed": 150243,
      "totalRecords": 192850,
      "processingEfficiency": 78.3,
      "errorRate": 0.001,
      "retryRate": 0.015
    },
    "stages": {
      "completed": 2,
      "running": 1,
      "pending": 1,
      "averageStageTime": "5.75 minutes",
      "stageEfficiency": 91.2
    }
  },
  "historicalMetrics": [
    {
      "timestamp": "2024-01-20T10:30:00Z",
      "cpu": 15,
      "memory": 0.8,
      "recordsPerSecond": 0,
      "stage": "Initialization"
    },
    {
      "timestamp": "2024-01-20T10:35:00Z",
      "cpu": 85,
      "memory": 1.9,
      "recordsPerSecond": 1427,
      "stage": "Data Loading"
    },
    {
      "timestamp": "2024-01-20T10:40:00Z",
      "cpu": 72,
      "memory": 3.2,
      "recordsPerSecond": 1156,
      "stage": "Process Discovery"
    },
    {
      "timestamp": "2024-01-20T10:45:00Z",
      "cpu": 67,
      "memory": 2.3,
      "recordsPerSecond": 1250,
      "stage": "Performance Analysis"
    }
  ],
  "performanceTrends": {
    "cpuTrend": "Stable",
    "memoryTrend": "Declining",
    "throughputTrend": "Improving",
    "overallEfficiency": "Good",
    "predictionAccuracy": 94.2
  },
  "benchmarks": {
    "jobType": "ProcessMining",
    "averageJobDuration": "18.5 minutes",
    "averageThroughput": "1180 records/second",
    "currentPerformanceRank": "85th percentile",
    "similarJobsComparison": {
      "fasterThan": 85,
      "similarTo": 12,
      "slowerThan": 3
    }
  }
}

複数ジョブの追跡

GET /api/{tenantId}/{projectId}/execution/tracking/batch

複数のジョブの追跡情報を同時に取得します。ダッシュボード表示やバッチ監視に便利です。

クエリパラメーター

パラメーター 種類 説明
jobIds string 追跡するジョブIDのカンマ区切りリスト
status string ステータスでフィルタ: Running, Queued, Completed, Failed
submittedBy string ジョブを送信したユーザーでフィルタ
includeMetrics boolean 各ジョブのパフォーマンス指標を含める (デフォルト: false)
refreshInterval integer リアルタイム追跡の自動更新間隔(秒)

レスポンス

{
  "trackingTime": "2024-01-20T10:45:33Z",
  "jobCount": 5,
  "summary": {
    "running": 3,
    "queued": 1,
    "completed": 1,
    "failed": 0
  },
  "jobs": [
    {
      "jobId": "cc0e8400-e29b-41d4-a716-446655440000",
      "jobName": "Customer Journey Analysis",
      "status": "Running",
      "progress": 85,
      "startTime": "2024-01-20T10:30:00Z",
      "estimatedCompletion": "2024-01-20T10:52:00Z",
      "currentStage": "Performance Analysis",
      "submittedBy": "user123",
      "priority": "High",
      "resourceUsage": {
        "cpu": 67,
        "memory": "2.3 GB",
        "processingRate": "1250 records/second"
      }
    },
    {
      "jobId": "dd0e8400-e29b-41d4-a716-446655440000",
      "jobName": "Sales Data Enrichment",
      "status": "Running",
      "progress": 45,
      "startTime": "2024-01-20T10:35:00Z",
      "estimatedCompletion": "2024-01-20T11:05:00Z",
      "currentStage": "Data Enrichment",
      "submittedBy": "system",
      "priority": "Normal",
      "resourceUsage": {
        "cpu": 52,
        "memory": "1.8 GB",
        "processingRate": "890 records/second"
      }
    },
    {
      "jobId": "ee0e8400-e29b-41d4-a716-446655440000",
      "jobName": "Weekly Report Generation",
      "status": "Queued",
      "progress": 0,
      "queuePosition": 2,
      "estimatedStartTime": "2024-01-20T10:55:00Z",
      "estimatedCompletion": "2024-01-20T11:20:00Z",
      "submittedBy": "user456",
      "priority": "Normal"
    }
  ],
  "systemHealth": {
    "overallLoad": 73,
    "queueHealth": "Good",
    "resourceAvailability": "Medium",
    "estimatedCapacity": "6 additional jobs"
  }
}

ジョブイベントの購読

POST /api/{tenantId}/{projectId}/execution/job/{jobId}/subscribe

ジョブイベントに対してリアルタイム購読を確立し、ライブ追跡を行います。WebSocket接続およびWebhook通知に対応。

リクエストボディ

{
  "subscriptionType": "webhook",
  "webhookUrl": "https://your-app.com/webhooks/job-events",
  "events": [
    "stageStarted",
    "stageCompleted",
    "progressUpdate",
    "error",
    "warning",
    "jobCompleted"
  ],
  "filters": {
    "minProgressIncrement": 5,
    "includeDebugEvents": false,
    "notifyOnErrors": true
  },
  "authentication": {
    "type": "bearer",
    "token": "your-webhook-auth-token"
  }
}

レスポンス

{
  "subscriptionId": "sub-123e8400-e29b-41d4-a716-446655440000",
  "jobId": "cc0e8400-e29b-41d4-a716-446655440000",
  "subscriptionType": "webhook",
  "status": "Active",
  "webhookUrl": "https://your-app.com/webhooks/job-events",
  "eventsSubscribed": [
    "stageStarted",
    "stageCompleted",
    "progressUpdate",
    "error",
    "warning",
    "jobCompleted"
  ],
  "createdAt": "2024-01-20T10:45:33Z",
  "expiresAt": "2024-01-20T18:45:33Z"
}

ジョブ依存関係の取得

GET /api/{tenantId}/{projectId}/execution/job/{jobId}/dependencies

ジョブ依存関係の情報を取得します。前提ジョブ、依存リソース、ブロッキング条件を含みます。

レスポンス

{
  "jobId": "cc0e8400-e29b-41d4-a716-446655440000",
  "dependencies": {
    "prerequisiteJobs": [
      {
        "jobId": "aa0e8400-e29b-41d4-a716-446655440000",
        "jobName": "Data Preparation",
        "status": "Completed",
        "completedAt": "2024-01-20T10:25:00Z",
        "dependency": "Dataset must be validated before analysis"
      }
    ],
    "resourceDependencies": [
      {
        "resourceType": "Dataset",
        "resourceId": "880e8400-e29b-41d4-a716-446655440000",
        "resourceName": "Customer Journey Data",
        "status": "Available",
        "lastModified": "2024-01-20T10:25:00Z"
      },
      {
        "resourceType": "ComputeNode",
        "resourceId": "worker-node-02",
        "status": "Allocated",
        "allocatedAt": "2024-01-20T10:30:00Z"
      }
    ],
    "dependentJobs": [
      {
        "jobId": "ee0e8400-e29b-41d4-a716-446655440000",
        "jobName": "Weekly Report Generation",
        "status": "Queued",
        "waitingFor": "Customer Journey Analysis results"
      }
    ]
  },
  "blockingConditions": [
    {
      "condition": "Memory allocation below 2GB",
      "status": "Resolved",
      "resolvedAt": "2024-01-20T10:30:00Z",
      "resolution": "Additional memory allocated"
    }
  ],
  "dependencyGraph": {
    "nodes": [
      {
        "id": "aa0e8400-e29b-41d4-a716-446655440000",
        "type": "PrerequisiteJob",
        "status": "Completed"
      },
      {
        "id": "cc0e8400-e29b-41d4-a716-446655440000",
        "type": "CurrentJob",
        "status": "Running"
      },
      {
        "id": "ee0e8400-e29b-41d4-a716-446655440000",
        "type": "DependentJob",
        "status": "Queued"
      }
    ],
    "edges": [
      {
        "from": "aa0e8400-e29b-41d4-a716-446655440000",
        "to": "cc0e8400-e29b-41d4-a716-446655440000",
        "type": "prerequisite"
      },
      {
        "from": "cc0e8400-e29b-41d4-a716-446655440000",
        "to": "ee0e8400-e29b-41d4-a716-446655440000",
        "type": "dependency"
      }
    ]
  }
}

例: 完全なジョブトラッキングワークフロー

この例は包括的なジョブ追跡と監視の流れを示しています:

// 1. ジョブの追跡を開始
const trackJob = async (jobId) => {
  // 初期ジョブ状態を取得
  const progress = await getJobProgress(jobId);
  console.log(`ジョブ追跡中: ${progress.jobName}`);
  console.log(`現在の進捗: ${progress.overallProgress.percentage}%`);

  // リアルタイムイベントを購読
  await subscribeToJobEvents(jobId);

  return progress;
};

// 2. 詳細なジョブ進捗を取得
const getJobProgress = async (jobId) => {
  const response = await fetch(`/api/{tenantId}/{projectId}/execution/job/${jobId}/progress`, {
    headers: {
      'Authorization': `Bearer ${token}`
    }
  });

  return await response.json();
};

// 3. リアルタイムジョブイベントに購読
const subscribeToJobEvents = async (jobId) => {
  const response = await fetch(`/api/{tenantId}/{projectId}/execution/job/${jobId}/subscribe`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${token}`
    },
    body: JSON.stringify({
      subscriptionType: 'webhook',
      webhookUrl: 'https://your-app.com/webhooks/job-events',
      events: [
        'stageStarted',
        'stageCompleted',
        'progressUpdate',
        'error',
        'warning',
        'jobCompleted'
      ],
      filters: {
        minProgressIncrement: 10,
        includeDebugEvents: false,
        notifyOnErrors: true
      }
    })
  });

  const subscription = await response.json();
  console.log(`ジョブイベントに購読: ${subscription.subscriptionId}`);

  return subscription;
};

// 4. ジョブパフォーマンス指標を取得
const getJobMetrics = async (jobId) => {
  const response = await fetch(`/api/{tenantId}/{projectId}/execution/job/${jobId}/metrics?interval=5m&includeHistory=true`, {
    headers: {
      'Authorization': `Bearer ${token}`
    }
  });

  const metrics = await response.json();
  console.log('パフォーマンス指標:');
  console.log(`  CPU 使用率: ${metrics.currentMetrics.resourceUtilization.cpu.usage}%`);
  console.log(`  メモリ使用量: ${metrics.currentMetrics.resourceUtilization.memory.used}`);
  console.log(`  処理速度: ${metrics.currentMetrics.processing.recordsPerSecond} 件/秒`);

  return metrics;
};

// 5. ジョブ実行ログを取得
const getJobLogs = async (jobId, level = 'INFO') => {
  const response = await fetch(`/api/{tenantId}/{projectId}/execution/job/${jobId}/logs?level=${level}&limit=100`, {
    headers: {
      'Authorization': `Bearer ${token}`
    }
  });

  const logs = await response.json();
  console.log(`ログエントリ数: ${logs.logs.length}`);

  // 重要な最近のログを表示
  logs.logs.filter(log => log.level !== 'DEBUG').forEach(log => {
    console.log(`[${log.timestamp}] ${log.level}: ${log.message}`);
  });

  return logs;
};

// 6. ダッシュボードで複数ジョブを追跡
const trackMultipleJobs = async (jobIds) => {
  const response = await fetch(`/api/{tenantId}/{projectId}/execution/tracking/batch?jobIds=${jobIds.join(',')}&includeMetrics=true`, {
    headers: {
      'Authorization': `Bearer ${token}`
    }
  });

  const tracking = await response.json();
  console.log(`${tracking.jobCount} 件のジョブを追跡中:`);

  tracking.jobs.forEach(job => {
    console.log(`  ${job.jobName}: ${job.status} (${job.progress}%)`);
  });

  return tracking;
};

// 7. ジョブタイムラインを監視
const getJobTimeline = async (jobId) => {
  const response = await fetch(`/api/{tenantId}/{projectId}/execution/job/${jobId}/timeline?includeSubEvents=true&granularity=minutes`, {
    headers: {
      'Authorization': `Bearer ${token}`
    }
  });

  const timeline = await response.json();
  console.log('ジョブタイムライン:');

  timeline.timeline.forEach(event => {
    console.log(`[${event.timestamp}] ${event.eventType}: ${event.description}`);
  });

  return timeline;
};

// 包括的な追跡ワークフローを実行
const runTrackingWorkflow = async (jobId) => {
  try {
    console.log('包括的なジョブ追跡を開始します...');

    // ジョブ進捗を追跡
    const progress = await trackJob(jobId);

    // パフォーマンス指標を取得
    const metrics = await getJobMetrics(jobId);

    // 実行ログを取得
    const logs = await getJobLogs(jobId, 'WARN');

    // タイムラインを取得
    const timeline = await getJobTimeline(jobId);

    // 完了まで監視
    const monitoring = setInterval(async () => {
      const currentProgress = await getJobProgress(jobId);

      if (currentProgress.status === 'Completed') {
        console.log('ジョブが正常に完了しました!');
        clearInterval(monitoring);

        // 最終指標取得
        const finalMetrics = await getJobMetrics(jobId);
        console.log(`最終効率: ${finalMetrics.performanceTrends.overallEfficiency}`);

      } else if (currentProgress.status === 'Failed') {
        console.log('ジョブが失敗しました!');
        clearInterval(monitoring);

        // エラーログを取得
        const errorLogs = await getJobLogs(jobId, 'ERROR');
        console.log('エラー詳細:', errorLogs.logs);
      } else {
        console.log(`進捗更新: ${currentProgress.overallProgress.percentage}%`);
      }
    }, 30000); // 30秒毎に確認

  } catch (error) {
    console.error('追跡ワークフローが失敗しました:', error);
  }
};

// 追跡開始
runTrackingWorkflow('cc0e8400-e29b-41d4-a716-446655440000');

Pythonの例

import requests
import time
import json
from datetime import datetime, timedelta

class JobTracker:
    def __init__(self, base_url, tenant_id, project_id, token):
        self.base_url = base_url
        self.tenant_id = tenant_id
        self.project_id = project_id
        self.headers = {
            'Authorization': f'Bearer {token}',
            'Content-Type': 'application/json'
        }

    def get_job_progress(self, job_id):
        """現在のジョブ進捗を取得"""
        url = f"{self.base_url}/api/{self.tenant_id}/{self.project_id}/execution/job/{job_id}/progress"
        response = requests.get(url, headers=self.headers)
        return response.json()

    def get_job_logs(self, job_id, level='INFO', limit=1000):
        """ジョブ実行ログを取得"""
        url = f"{self.base_url}/api/{self.tenant_id}/{self.project_id}/execution/job/{job_id}/logs"
        params = {'level': level, 'limit': limit}
        response = requests.get(url, params=params, headers=self.headers)
        return response.json()

    def get_job_metrics(self, job_id, interval='5m', include_history=False):
        """ジョブパフォーマンス指標を取得"""
        url = f"{self.base_url}/api/{self.tenant_id}/{self.project_id}/execution/job/{job_id}/metrics"
        params = {
            'interval': interval,
            'includeHistory': str(include_history).lower()
        }
        response = requests.get(url, params=params, headers=self.headers)
        return response.json()

    def get_job_timeline(self, job_id, include_sub_events=False, granularity='minutes'):
        """ジョブ実行タイムラインを取得"""
        url = f"{self.base_url}/api/{self.tenant_id}/{self.project_id}/execution/job/{job_id}/timeline"
        params = {
            'includeSubEvents': str(include_sub_events).lower(),
            'granularity': granularity
        }
        response = requests.get(url, params=params, headers=self.headers)
        return response.json()

    def track_multiple_jobs(self, job_ids, include_metrics=False):
        """複数ジョブを同時に追跡"""
        url = f"{self.base_url}/api/{self.tenant_id}/{self.project_id}/execution/tracking/batch"
        params = {
            'jobIds': ','.join(job_ids),
            'includeMetrics': str(include_metrics).lower()
        }
        response = requests.get(url, params=params, headers=self.headers)
        return response.json()

    def subscribe_to_job_events(self, job_id, webhook_url, events=None):
        """リアルタイムジョブイベントに購読"""
        url = f"{self.base_url}/api/{self.tenant_id}/{self.project_id}/execution/job/{job_id}/subscribe"
        payload = {
            'subscriptionType': 'webhook',
            'webhookUrl': webhook_url,