gemini-code-assist[bot] commented on PR #37517: URL: https://github.com/apache/beam/pull/37517#issuecomment-3853986762
## Summary of Changes Hello @derrickaw, I'm Gemini Code Assist[^1]! 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](https://codeassist.google/code-review/login) to enable Memory in your admin console.** <details> <summary><b>Changelog</b></summary> * **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. </details> <details> <summary><b>Activity</b></summary> * 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. </details> <details> <summary><b>Using Gemini Code Assist</b></summary> <br> The full guide for Gemini Code Assist can be found on our [documentation page](https://developers.google.com/gemini-code-assist/docs/review-github-code), here are some quick tips. <b>Invoking Gemini</b> 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. <b>Customization</b> 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](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). <b>Limitations & Feedback</b> Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: 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](https://google.qualtrics.com/jfe/form/SV_2cyuGuTWsEw84yG). <b>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](https://cloud.google.com/products/gemini/code-assist).</b> </details> [^1]: Review the [Privacy Notices](https://policies.google.com/privacy), [Generative AI Prohibited Use Policy](https://policies.google.com/terms/generative-ai/use-policy), [Terms of Service](https://policies.google.com/terms), and learn how to configure Gemini Code Assist in GitHub [here](https://developers.google.com/gemini-code-assist/docs/customize-gemini-behavior-github). Gemini can make mistakes, so double check it and [use code with caution](https://support.google.com/legal/answer/13505487). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
