Skip to content

add datadog it support#37517

Open
derrickaw wants to merge 4 commits intoapache:masterfrom
derrickaw:20260204_addDatadogIt
Open

add datadog it support#37517
derrickaw wants to merge 4 commits intoapache:masterfrom
derrickaw:20260204_addDatadogIt

Conversation

@derrickaw
Copy link
Collaborator

@derrickaw derrickaw commented Feb 5, 2026

  1. Add some datadog it support.
  2. More support for [Task]: Add Datadog IO support to Beam #37318 :)
  3. Ported and refactored from here.
  4. ./gradlew :it:datadog:test

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @derrickaw, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a dedicated integration test module for Datadog within the Apache Beam project. It provides a robust framework for simulating Datadog interactions, allowing developers to effectively test Beam pipelines that produce or consume data from Datadog. The new module includes a resource manager to control a mock Datadog server, data structures for log entries, and assertion utilities to validate test outcomes.

Highlights

  • New Datadog Integration Test Module: A new Gradle module it:datadog has been added to provide integration test support for Datadog, enabling testing of Beam pipelines interacting with Datadog services.
  • DatadogResourceManager: Introduced DatadogResourceManager which leverages Testcontainers and MockServer to simulate a Datadog API endpoint, allowing for sending and retrieving log entries in a controlled test environment.
  • DatadogLogEntry and Utilities: Added DatadogLogEntry as an AutoValue class to represent Datadog log data, along with DatadogClientFactory for HTTP and MockServer client creation, and DatadogResourceManagerUtils for helper functions like API key generation and log entry mapping.
  • Testing Utilities: Included DatadogLogEntriesCheck for asserting the number of log entries received by the mock server and DatadogAsserts for Truth-based assertions on Datadog log entries in tests.
  • Comprehensive Test Coverage: Both unit tests (DatadogResourceManagerTest, DatadogResourceManagerUtilsTest) and an integration test (DatadogResourceManagerIT) have been added to ensure the reliability and functionality of the new Datadog IT support.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • it/datadog/build.gradle
    • Added new Gradle build file for the it:datadog module.
    • Configured dependencies including it:common, it:testcontainers, it:truthmatchers, it:conditions, org.testcontainers:mockserver, org.mock-server:mockserver-client-java, org.apache.httpcomponents:httpclient, and com.google.code.gson.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/DatadogClientFactory.java
    • Added DatadogClientFactory class to provide CloseableHttpClient for sending HTTP messages and MockServerClient for interacting with the mock server.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/DatadogLogEntry.java
    • Added DatadogLogEntry as an AutoValue class to model Datadog log entries with fields like ddsource, ddtags, hostname, service, and message.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/DatadogResourceManager.java
    • Added DatadogResourceManager to manage a mock Datadog server using Testcontainers.
    • Implemented methods to get HTTP and API endpoints, retrieve the API key, send single or multiple DatadogLogEntry events, and retrieve recorded log entries.
    • Configured the mock server to accept POST requests to /api/v2/logs with specific headers and JSON schema.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/DatadogResourceManagerException.java
    • Added DatadogResourceManagerException as a custom runtime exception for errors within the Datadog resource manager.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/DatadogResourceManagerUtils.java
    • Added DatadogResourceManagerUtils with static methods to convert DatadogLogEntry objects to a Map<String, Object> and to generate a secure Datadog API key.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/conditions/DatadogLogEntriesCheck.java
    • Added DatadogLogEntriesCheck as a ConditionCheck implementation to verify if the mock Datadog server has received a specified minimum (and optional maximum) number of log entries.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/conditions/package-info.java
    • Added package-info.java for the conditions subpackage.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/matchers/DatadogAsserts.java
    • Added DatadogAsserts utility class with static methods to convert DatadogLogEntry collections to a list of maps and to create RecordsSubject for Truth assertions.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/matchers/package-info.java
    • Added package-info.java for the matchers subpackage.
  • it/datadog/src/main/java/org/apache/beam/it/datadog/package-info.java
    • Added package-info.java for the main datadog package.
  • it/datadog/src/test/java/org/apache/beam/it/datadog/DatadogResourceManagerIT.java
    • Added integration tests for DatadogResourceManager to verify end-to-end functionality of sending and retrieving log entries.
  • it/datadog/src/test/java/org/apache/beam/it/datadog/DatadogResourceManagerTest.java
    • Added unit tests for DatadogResourceManager, covering client factory interactions, HTTP endpoint generation, API key handling, and error scenarios during event sending and retrieval.
  • it/datadog/src/test/java/org/apache/beam/it/datadog/DatadogResourceManagerUtilsTest.java
    • Added unit tests for DatadogResourceManagerUtils, specifically for datadogEntryToMap conversion and generateApiKey functionality.
  • settings.gradle.kts
    • Added include(":it:datadog") to the settings.gradle.kts file to include the new Datadog integration test module in the project build.
Activity
  • The pull request was opened by derrickaw with the title "add datadog it support" and a description outlining the purpose of adding Datadog integration test support.
  • The description includes a standard checklist for contributions, such as mentioning issues, updating CHANGES.md, and filing an ICLA if applicable.
  • Links to build health status and CI information are provided in the PR description.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@derrickaw derrickaw marked this pull request as ready for review February 5, 2026 17:18
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

Assigning reviewers:

R: @damccorm added as fallback since no labels match configuration

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

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