Skip to content

[kafka_consumer] Emit consumer_membership DSM events#24601

Open
piochelepiotr wants to merge 5 commits into
masterfrom
piotr.wolski/dsm-consumer-group-membership
Open

[kafka_consumer] Emit consumer_membership DSM events#24601
piochelepiotr wants to merge 5 commits into
masterfrom
piotr.wolski/dsm-consumer-group-membership

Conversation

@piochelepiotr

Copy link
Copy Markdown
Contributor

What

The kafka_consumer integration now emits a consumer_membership data-streams-message per consumer group, containing kafka_cluster_id, group_id, and the sorted list of member_ids. Emitted from _collect_consumer_group_metadata where the member list is already gathered.

Why

DSM uses this to reconcile consumer-group membership: drop departed members and seed tagless rows for members the tracer hasn't reported, while tracer-sourced infra tags win.

Part of a cross-repo change

Feeds the same dsm-kafka-configs pipeline as the dd-trace-java tracer: → dsm-kafka-configs-writer → orgstore consumer_group_members → dsm-api.

Tests

ddev test kafka_consumertests/test_cluster_metadata.py all pass (54), including new test_consumer_membership_event_emitted.

🤖 Generated with Claude Code

Emit a consumer_membership data-streams-message per consumer group with the
kafka cluster id, group id and current member ids, so DSM can reconcile
group membership with infra tags.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Tests  Code Coverage

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
Patch Coverage: 92.59%
Overall Coverage: 91.82% (+3.49%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 7fac138 | Docs | Datadog PR Page | Give us feedback!

@piochelepiotr piochelepiotr added the qa/skip-qa Automatically skip this PR for the next QA label Jul 17, 2026
@piochelepiotr
piochelepiotr marked this pull request as ready for review July 17, 2026 21:16
@piochelepiotr
piochelepiotr requested a review from a team as a code owner July 17, 2026 21:16

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31861a8462

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

aggregator.assert_metric('kafka.consumer_group.membership_changes', count=0)


def _consumer_membership_events(check):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Rename the test helper without a leading underscore

In this repo, AGENTS.md explicitly says that module-level helpers in test files should not use a leading underscore unless they are instance methods or reusable-library helpers with non-obvious side effects. This newly added test helper is a free function in a test module, so keeping the _consumer_membership_events name violates the repository convention; rename it without the privacy prefix and update the call site.

Useful? React with 👍 / 👎.

piochelepiotr and others added 3 commits July 17, 2026 15:35
The describe_consumer_groups response already carries client_id and host per
member, so include them (as a 'members' detail list) alongside member_ids.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… comments

Rename _consumer_membership_events -> consumer_membership_events per AGENTS.md
(module-level test helpers don't take a leading underscore). Remove a couple
of now-redundant explanatory comments.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ents

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@dd-octo-sts

dd-octo-sts Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Validation Report

All 21 validations passed.

Show details
Validation Description Status
agent-reqs Verify check versions match the Agent requirements file
ci Validate CI configuration and code coverage settings
codeowners Validate every integration has a CODEOWNERS entry
config Validate default configuration files against spec.yaml
dep Verify dependency pins are consistent and Agent-compatible
http Validate integrations use the HTTP wrapper correctly
imports Validate check imports do not use deprecated modules
integration-style Validate check code style conventions
jmx-metrics Validate JMX metrics definition files and config
labeler Validate PR labeler config matches integration directories
legacy-signature Validate no integration uses the legacy Agent check signature
license-headers Validate Python files have proper license headers
licenses Validate third-party license attribution list
metadata Validate metadata.csv metric definitions
models Validate configuration data models match spec.yaml
openmetrics Validate OpenMetrics integrations disable the metric limit
package Validate Python package metadata and naming
qa-label Validate the pull request declares whether it needs QA for the next Agent release
readmes Validate README files have required sections
saved-views Validate saved view JSON file structure and fields
version Validate version consistency between package and changelog

View full run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant