콘텐츠로 건너뛰기
데이터 품질 SQL 레시피

Catch event-field renames that hide rows from averages

Compare an old timing-field average with schema-aware coverage so an event rename cannot silently drop completed jobs.

중급job_finished검토됨 2026-09-30테스트됨 아파치 DataFusion 45.2.0

검토자 Telemetry 제품 팀 에 . SQL 문법, 필수 이벤트 필드, 예제 결과, 쿼리 사용 시 제한 사항을 확인했습니다. 이 페이지의 검토 담당자

질문에 답변됨

Did a field rename make the duration average ignore completed jobs?

A query can keep returning a plausible average after instrumentation changes. Count all completed events, map each documented schema version to its timing field, and show the share with a usable value beside the average.

이벤트 스키마

쿼리가 예상하는 필드

필드유형그것이 존재하는 이유
timestamp_utcTimestampUTC finish-event time; use a fixed analysis window in production.
job_idUtf8One fictional completed logical job per row.
schema_versionInt64Version of the event contract; 1 uses duration_ms and 2 uses latency_ms.
duration_msInt64Release-1 duration, null on release 2.
latency_msInt64Release-2 duration, null on release 1.
DataFusion SQL

쿼리 복사

sql
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_jobsjobs_in_old_averageold_average_msjobs_with_durationunmeasured_jobsduration_coverage_pctschema_aware_average_ms
4247540100580

합성 예제 출력. 운영 결정에 사용하기 전에 자체 이벤트 스키마 및 임계값에 대해 쿼리를 실행하세요.

A plausible average can cover only half the jobs: Catch event-field renames that hide rows from averages 예제 결과의 합성 jobs_with_duration 값에 대한 정적 차트
결정론적 예제 출력의 색인 생성 가능한 SVG입니다. 기사, 런북 또는 저작자가 포함된 디자인 검토를 위해 다운로드하세요.

예제 재현

샘플 데이터 다운로드

JSON 번들은 타입이 지정된 이벤트 계약을 포함합니다. reproducible 입력 행, 정확한 SQL, 예상 출력, 검토 참고 사항 및 엔진 버전. CSV에는 표시된 결과가 포함됩니다.

SQL 작동 방식

  1. 1The old query AVG(duration_ms) still returns 475 ms because SQL averages ignore nulls. Only two of four completed jobs contribute to it.
  2. 2The version-aware CASE maps release 1 to duration_ms and release 2 to latency_ms, giving 580 ms across all four fictional jobs.
  3. 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 in 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 in 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.

알림 설정 읽기

이 쿼리에 필요한 이벤트 설정하기

관련 계측 및 가이드

분석 계속하기

내 이벤트로 실행하기

테이블을 만들고, 필드를 조정하고, 결과를 저장하세요.

무료로 시작하고, 구조화된 이벤트를 보내고, 쿼리 결과를 차트, 공유 대시보드 위젯 또는 알림 입력으로 사용하세요.

API 키 받기