Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

adding-ingestion-warnings

БесплатноБез исполняемых скриптовНе проверен

How to add a new ingestion warning type to the event ingestion pipeline. Use when emitting a new warning from nodejs ingestion code (emitIngestionWarning…

PostHogот PostHog★ 41 278 звёзд на GitHub

Об этом скилле

Adding ingestion warnings

Ingestion warnings tell customers their events were ingested with problems (or dropped). They are produced to the clickhouse_ingestion_warnings Kafka topic and land in two ClickHouse tables: v1 (ingestion_warnings) and v2 (ingestion_warnings_v2, which materializes structured columns from the details JSON).

The registry is the source of truth

Every warning type must be registered in INGESTION_WARNING_TYPES in nodejs/src/ingestion/common/ingestion-warning-types.ts (a dependency-free leaf, re-exported from ingestion-warnings.ts, so codegen and its test can import it cheaply). The registry fixes the type's category and severity; they are resolved at serialization time, so callsites cannot drift or forget them. An unregistered type is a compile error (IngestionWarningType is the registry's key union).

To add a new warning:

  1. Register the type in INGESTION_WARNING_TYPES, inside the matching group comment block. Pick:
    • category — one of size, merge, event, quota, transformation, replay. Extend IngestionWarningCategory only when the warning genuinely doesn't fit an existing group; new categories flow into API filters and agent-facing docs, so keep the vocabulary small.
    • severity — follow the convention: error = the event or message was dropped, warning = ingested but modified or partially rejected, info = informational or an intentional, team-configured drop.
  2. Emit it (see below), passing only per-occurrence fields: details, pipelineStep, optional key / alwaysSend.
  3. Update downstream surfaces (see checklist).

Emitting

Two paths, both end at serializeIngestionWarning:

  • Pipeline steps (preferred): return warnings on the result — ok(value, sideEffects, warnings) or drop(reason, [], warnings). They accumulate in context.warnings and are sent by handleIngestionWarnings(), which requires a teamAware() block. See the framework doc test 09-ingestion-warnings.
  • Direct emit: emitIngestionWarning(outputs, teamId, warning) (outputs-based, preferred) or captureIngestionWarning(kafkaProducer, teamId, warning) (legacy) for code outside the pipeline result flow.

Details keys ClickHouse v2 materializes

ingestion_warnings_v2 derives columns from these exact JSON key names (see posthog/models/ingestion_warnings/sql_v2.py) — use them, don't invent variants:

details key v2 column
eventUuid event_uuid
distinctId distinct_id
personId person_id
groupKey group_key

category, severity, and pipelineStep are appended to details by the serializer — never set them in details yourself; a stray key cannot override them (structured fields are spread last).

Debouncing

Warnings are rate-limited per team:type:key. Set key to the entity you want to debounce by (e.g. a distinct ID) and alwaysSend: true only for warnings that must never be dropped by the limiter.

Rust

Rust services emit warnings through the common-ingestion-warnings crate (rust/common/ingestion_warnings). Unlike nodejs (which has database access and writes the v2 row directly), Rust producers have no token→team resolution, so they don't write the row themselves. Instead they emit a synthetic $$client_ingestion_warning CapturedEvent onto the existing client_ingestion_warning topic; the nodejs clientwarnings consumer resolves the token to a team_id, reads the structured type/details/source, and writes the v2 row (see handle-client-ingestion-warning-step.ts).

The Rust WarningType is generated — nodejs is the single source of truth

There is no hand-maintained Rust copy of the type list. A generator mirrors the whole registry — every type with its category, severity, and captureProduced flag — into a committed artifact the Rust build reads:

INGESTION_WARNING_TYPES (all entries)                        # nodejs — source of truth
  → pnpm --filter=@posthog/nodejs gen:ingestion-warning-types
  → rust/common/ingestion_warnings/warning_types.generated.json   # committed
  → build.rs → WarningType enum + ALL + as_str/category/severity/capture_produced

Every edit to INGESTION_WARNING_TYPES requires regenerating and committing the artifact — not just capture-produced types. The nodejs no-drift test (generate-ingestion-warning-types.test.ts) fails CI whenever the committed artifact and the generator output diverge, including when a type you didn't add lands on master while your branch is in flight: rebase, regenerate, recommit.

The artifact is committed inside the Rust crate so the isolated Rus

Полный SKILL.md на GitHub

Установить adding-ingestion-warnings в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл adding-ingestion-warnings?

How to add a new ingestion warning type to the event ingestion pipeline. Use when emitting a new warning from nodejs ingestion code (emitIngestionWarning, captureIngestionWarning, pipeline `warnings` arrays, `drop()` with warnings), when adding a warning type, category, or severity, or when a typecheck error says a string is not assignable to IngestionWarningType. Covers the INGESTION_WARNING_TYPES registry (the single source of truth for type, category, and severity), the details-key conventions that ClickHouse v2 materializes into columns, debouncing, and the downstream surfaces to keep in sync (v1 UI map, resolving-ingestion-warnings skill, docs, v2 API).

Как установить скилл adding-ingestion-warnings?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл adding-ingestion-warnings запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить adding-ingestion-warnings с