Skip to content

feat: add Kafka extractor and DSM - #837

Open
jeastham1993 wants to merge 4 commits into
mainfrom
feat/support-kafka
Open

jeastham1993 wants to merge 4 commits into
mainfrom
feat/support-kafka

Conversation

@jeastham1993

@jeastham1993 jeastham1993 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Add support for extraction and DSM checkpointing for Kafka. This supports the default Kafka event structure, but noted that if customers have some custom configuration this won't work - https://docs.aws.amazon.com/lambda/latest/dg/services-consume-kafka-events.html#services-consume-kafka-events-payload

Motivation

Adding support for all Lambda ESM's.

Testing Guidelines

Unit tests added to test functionality, tested with custom deployed version of layer.

Additional Notes

Hold off merging this PR until 830 is merged. PR 830 is a community contribution that adds the extraction support, but doesn't add DSM support. Merge the two together once the first is complete.

Types of Changes

  • Bug fix
  • [ X ] New feature
  • Breaking change
  • Misc (docs, refactoring, dependency upgrade, etc.)

Check all that apply

  • [ X ] This PR's description is comprehensive
  • This PR contains breaking changes that are documented in the description
  • This PR introduces new APIs or parameters that are documented and unlikely to change in the foreseeable future
  • This PR impacts documentation, and it has been updated (or a ticket has been logged)
  • [ X ] This PR's changes are covered by the automated tests
  • This PR collects user input/sensitive content into Datadog
  • This PR passes the integration tests (ask a Datadog member to run the tests)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-15T16:11:06.463147Z b6ca569 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 1c9f4477ac

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/event-validator.ts Outdated
Comment thread src/trace/context/extractors/kafka.ts Outdated
Self-managed Kafka events arrive with eventSource "aws:SelfManagedKafka",
so the previous comparison against "SelfManagedKafka" never matched. Those
invocations fell through to generic Lambda-context extraction and lost both
Kafka header propagation and DSM checkpointing.

Also stop skipping the DSM consume checkpoint when a record has no headers.
Guard only on the topic and pass the nullable carrier through, matching the
SQS/Kinesis extractors so uninstrumented producers still get consume nodes
and pathway roots.

@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: 9a98cf8d47

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread yarn.lock Outdated
Comment thread yarn.lock
Comment thread src/trace/context/extractors/kafka.ts

@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: b6ca569e8e

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


static isKafkaEvent(event: any): event is MSKEvent | SelfManagedKafkaEvent {
return (
(event.eventSource === "aws:kafka" || event.eventSource === "aws:SelfManagedKafka") &&

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 Accept the unprefixed self-managed Kafka source

For self-managed Kafka event source mappings, Lambda emits eventSource: "SelfManagedKafka" (without the aws: prefix), matching the SelfManagedKafkaEvent shape imported above. This predicate therefore rejects those events, so they fall through to generic Lambda-context extraction and receive neither Kafka header propagation nor DSM checkpoints; accept the unprefixed value (or both variants).

Useful? React with 👍 / 👎.

@jeastham1993

Copy link
Copy Markdown
Contributor Author

Hold off merging this PR until 830 is merged. PR 830 is a community contribution that adds the extraction support, but doesn't add DSM support. Merge the two together once the first is complete.

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.

2 participants