Skip to content

feat(kafka): add dead-consumer scenario and refinements on top of #190 - #227

Draft
nr-jonathanpdx wants to merge 6 commits into
newrelic:mainfrom
nr-jonathanpdx:kafka-scenario
Draft

nr-jonathanpdx wants to merge 6 commits into
newrelic:mainfrom
nr-jonathanpdx:kafka-scenario

Conversation

@nr-jonathanpdx

@nr-jonathanpdx nr-jonathanpdx commented Aug 17, 2026

Copy link
Copy Markdown

Changes

Builds on the Kafka consumer-lag observability scenario from #190 (by @crshanks), adding four improvements on top. That PR was closed; this one is opened from a fork so the work stays available and can be reviewed as a unit. Full credit for the underlying scenario is @crshanks'.

Underlying scenario (from #190)

Kafka consumer-lag observability on the New Relic side of the demo:

  • Broker metrics via the kafkametrics receiver, on both the Docker and Kubernetes paths
  • kafka.cluster.name tagging for UI faceting
  • Kafka section on the service-baselines dashboard
  • Terraform alert conditions (consumer lag + producer-rate spike) and a fraud-detection consumer-lag SLO
  • README docs for the scenario

The lag-generating code itself (checkout producer burst, fraud-detection consumer sleep) is pre-existing base-demo code from open-telemetry#1528 — not part of this scenario. This work only adds the New Relic observability on top.

Additions in this PR

Commit What it adds
9ac8bf2 kafkaConsumerDead dead-consumer-group scenario (new flagd flag)
5e0f60c Dead-consumer alert condition, dashboard tile, and docs for it
30446f9 Pin collector host identity so the entity graph draws the host edge
720cfda Run the demo from an env-file only (OTLP endpoint + compose harness)

Testing

Enabling kafkaQueueProblems via the flagd UI produces the expected behavior end-to-end against a New Relic account: fraud-detection consumer lag climbs while accounting stays flat, matching the scenario design. The dashboard imports and renders.

Known issues to be aware of

  1. Stale local images. fraud-detection's local image can be stale and silently skip the flag's sleep delay — this looks like a flagd/OpenFeature issue but isn't. Rebuild from source (--build on compose up).
  2. A few NRQL tiles need query adjustment. Three dashboard/alert queries that combine derivative() with TIMESERIES on the per-partition Kafka metrics can render empty; rewriting those queries to compute the rate without TIMESERIES produces the expected result.
  3. Dashboard JSON export artifacts. newrelic/dashboards/service_baselines.json carries a stale page-level guid plus per-widget ids; both need stripping before import or it fails with "Failed to create dashboard."
  4. compose needs env-files. Bring the stack up/down with the --env-file flags or it fails on unresolved env vars (720cfda moves this to env-file-only).

Merge Requirements

This is a draft opened to preserve and share the work; a few of the dashboard queries still need refinement (see the known issues above) before it's ready to merge.

@CLAassistant

CLAassistant commented Aug 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@nr-jonathanpdx nr-jonathanpdx changed the title feat(kafka): Kafka consumer-lag observability scenario (team-shareable, builds on #190) feat(kafka): add dead-consumer scenario and refinements on top of #190 Aug 17, 2026
@github-actions

Copy link
Copy Markdown

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions Bot added the Stale label Aug 25, 2026
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions Bot closed this Sep 1, 2026
@dpacheconr dpacheconr reopened this Sep 1, 2026
@dpacheconr

Copy link
Copy Markdown

no stale, will be reviewed, after we upgrade the demo to V3

@dpacheconr dpacheconr removed the Stale label Sep 1, 2026
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

This PR was marked stale due to lack of activity. It will be closed in 7 days.

nr-jonathanpdx and others added 4 commits September 14, 2026 14:53
fraud-detection leaves the orders consumer group (unsubscribes and stops
polling) while checkout keeps producing, so the group empties (members -> 0)
and lag climbs against a zero-member group. Toggled live via the new
kafkaConsumerDead flagd flag (defaults off).

Also switches kafkaQueueProblems to a per-record sleep in milliseconds
(5sec/3sec/1sec/off) so the throttle is tunable from the flag.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds an NRQL alert condition (kafka_dead_consumer_group) that fires when
kafka.consumer_group.members drops below threshold for the orders group,
a Consumer Group Members dashboard tile faceted by group, and documents
the kafkaConsumerDead scenario in newrelic/README.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Adds a resource/host_identity processor that upserts a stable host.id and
host.name so the single Docker host resolves to one INFRA-HOST entity and
services (including the Kafka broker) form a "runs on" edge to it. Without
this, host.name/host.id come from the collector container's ephemeral
identity, so the host entity is unstable and the broker->host relationship
never synthesizes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…harness)

Makes a fresh clone runnable against any account/region by editing only
.env / .env.override, with no tracked config changes:

- Drive the collector's otlphttp/newrelic endpoint from
  ${env:NEW_RELIC_OTLP_ENDPOINT}, passed through on the otel-collector
  service; prod (US) default lives in tracked .env.
- Fix the compose build context (./ -> ../..) so the file runs from
  newrelic/docker/.
- Remap only the host binding of frontend-proxy via
  ${ENVOY_HOST_PORT:-${ENVOY_PORT}} to avoid host port conflicts.
- Pass LOCUST_SPAWN_RATE and LOCUST_BROWSER_TRAFFIC_ENABLED through instead
  of hardcoding, and add FLAGD_HOST/FLAGD_PORT to shipping.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants