イベントスキーマ
クエリが期待するフィールド
| フィールド | 種類 | なぜ存在するのか |
|---|---|---|
| timestamp_utc | Timestamp | UTC finish-event time; use a fixed analysis window で production. |
| job_id | Utf8 | One fictional completed logical job per row. |
| schema_version | Int64 | Version of the event contract; 1 uses duration_ms and 2 uses latency_ms. |
| duration_ms | Int64 | Release-1 duration, null on release 2. |
| latency_ms | Int64 | Release-2 duration, null on release 1. |
クエリをコピーする
WITH normalized AS (
SELECT
job_id,
schema_version,
duration_ms,
CASE schema_version
WHEN 1 THEN duration_ms
WHEN 2 THEN latency_ms
END AS measured_ms
FROM job_finished
)
SELECT
COUNT(*) AS completed_jobs,
COUNT(duration_ms) AS jobs_in_old_average,
ROUND(AVG(duration_ms), 1) AS old_average_ms,
COUNT(measured_ms) AS jobs_with_duration,
SUM(CASE WHEN measured_ms IS NULL THEN 1 ELSE 0 END) AS unmeasured_jobs,
ROUND(100.0 * COUNT(measured_ms) / NULLIF(COUNT(*), 0), 1)
AS duration_coverage_pct,
ROUND(AVG(measured_ms), 1) AS schema_aware_average_ms
FROM normalized;この読み取り専用クエリは、空の型付きテーブルに対して計画され、実行されます。 アパッチ DataFusion 45.2.0。決定論的なサンプル出力は合成され、個別にレビューされます。フィールド タイプ、しきい値、ビジネス定義を独自のデータと照合して検証します。 テスト方法を読んでください。
クエリ結果
A plausible average can cover only half the jobs
The old field averages two fictional jobs at 475 ms. The version-aware query covers all four at 580 ms.
| completed_jobs | jobs_in_old_average | old_average_ms | jobs_with_duration | unmeasured_jobs | duration_coverage_pct | schema_aware_average_ms |
|---|---|---|---|---|---|---|
| 4 | 2 | 475 | 4 | 0 | 100 | 580 |
合成出力例。運用上の決定に使用する前に、独自のイベント スキーマとしきい値に対してクエリを実行します。
例を再現する
サンプルデータをダウンロードする
JSON バンドルには、型付きイベント コントラクトが含まれています。 reproducible 入力行、正確な SQL、予想される出力、レビューメモ、およびエンジンのバージョン。 CSV には、表示された結果が含まれます。
SQL の仕組み
- 1The old query AVG(duration_ms) still returns 475 ms because SQL averages ignore nulls. Only two of four completed jobs contribute to it.
- 2The version-aware CASE maps release 1 to duration_ms and release 2 to latency_ms, giving 580 ms across all four fictional jobs.
- 3Keep duration coverage beside the average. An unknown version or a missing field can leave the average unchanged while coverage falls.
確認するエッジケース
- Use a fixed UTC time window when comparing releases; this four-row lesson leaves all fictional rows で scope.
- This example assumes one finish row per completed logical job. Deduplicate repeated finish events by job_id before using it for a real job count.
- A field rename is comparable only if both versions time the same start and stop points で the same unit.
- A missing or unknown schema_version maps to null and lowers coverage; do not silently coalesce it to an old field.
- The four rows are fictional and do not describe a customer, a real incident, or measured product performance.
推奨されるダッシュボード
- Table: completed jobs, duration coverage, and average by release
- Trend: duration coverage percentage over deploy time
アラートガイダンス
Alert on falling duration coverage only after establishing an expected minimum event count and documenting the version mapping.
アラート設定を読むこのクエリに必要なイベントを設定する
関連する機器とガイド
分析を続ける
自分のイベントで実行する
テーブルを作成し、フィールドを調整して、結果を保存します
無料で始めて、構造化されたイベントを送信し、クエリ結果をグラフ、共有ダッシュボード ウィジェット、またはアラート入力として使用します。