You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "barryib (via GitHub)" <gi...@apache.org> on 2026/01/16 15:51:27 UTC
[PR] feat: Add support to pass Datadog API Key as environment variable [flink]
barryib opened a new pull request, #27432:
URL: https://github.com/apache/flink/pull/27432
- Add DATADOG_API_KEY environment variable support in DatadogHttpReporterFactory
- Configuration property 'apikey' takes precedence over environment variable
- Environment variable provides fallback when no configuration is provided
- Add comprehensive test suite covering environment variable support and configuration scenarios
The API key resolution follows this order:
1. Configuration property 'apikey' (if provided and non-empty)
2. Environment variable 'DATADOG_API_KEY' (fallback)
This enhancement allows secure credential management using environment variables, which is particularly useful in containerized and cloud deployments.
<!--
*Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
*Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
## Contribution Checklist
- Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
- Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
- Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
- Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
- Each pull request should address only one issue, not mix up code from multiple issues.
- Each commit in the pull request has a meaningful commit message (including the JIRA id)
- Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
**(The sections below can be removed for hotfixes of typos)**
-->
## What is the purpose of the change
*(For example: This pull request makes task deployment go through the blob server, rather than through RPC. That way we avoid re-transferring them on each deployment (during recovery).)*
## Brief change log
*(for example:)*
- *The TaskInfo is stored in the blob store on job creation time as a persistent artifact*
- *Deployments RPC transmits only the blob storage reference*
- *TaskManagers retrieve the TaskInfo from the blob cache*
## Verifying this change
Please make sure both new and modified tests in this PR follow [the conventions for tests defined in our code quality guide](https://flink.apache.org/how-to-contribute/code-style-and-quality-common/#7-testing).
*(Please pick either of the following options)*
This change is a trivial rework / code cleanup without any test coverage.
*(or)*
This change is already covered by existing tests, such as *(please describe tests)*.
*(or)*
This change added tests and can be verified as follows:
*(example:)*
- *Added integration tests for end-to-end deployment with large payloads (100MB)*
- *Extended integration test for recovery after master (JobManager) failure*
- *Added test that validates that TaskInfo is transferred only once across recoveries*
- *Manually verified the change by running a 4 node cluster with 2 JobManagers and 4 TaskManagers, a stateful streaming program, and killing one JobManager and two TaskManagers during the execution, verifying that recovery happens correctly.*
## Does this pull request potentially affect one of the following parts:
- Dependencies (does it add or upgrade a dependency): (yes / no)
- The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / no)
- The serializers: (yes / no / don't know)
- The runtime per-record code paths (performance sensitive): (yes / no / don't know)
- Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
- The S3 file system connector: (yes / no / don't know)
## Documentation
- Does this pull request introduce a new feature? (yes / no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on code in PR #27432:
URL: https://github.com/apache/flink/pull/27432#discussion_r2707918524
##########
flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java:
##########
@@ -65,4 +66,25 @@ public MetricReporter createMetricReporter(Properties config) {
tags,
useLogicalIdentifier);
}
+
+ /**
+ * Retrieves the Datadog API key from configuration or environment variable.
+ *
+ * <p>The API key is resolved in the following order:
+ *
+ * <ol>
+ * <li>Configuration property "apikey"
+ * <li>Environment variable "DATADOG_API_KEY"
+ * </ol>
+ *
+ * @param config the configuration properties
+ * @return the Datadog API key, or null if not found in either location
+ */
+ private String getApiKey(Properties config) {
Review Comment:
On the whole this change seems reasonable. Some points to raise:
- would it not make sense for the environment variable to be honoured, so you can override the configuration at a more granular level?
- Could you add this environment variable name and usage to the English and Chinese docs.
- I notice [the docs](https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/config/) say
"On Docker-based deployments, you can use the FLINK_PROPERTIES environment variable for passing configuration values." Does this help you resolve this issue without this fix?
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-4434634020
@flinkbot run azure
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-4395008069
This PR is being marked as stale since it has not had any activity in the last 90 days.
If you would like to keep this PR alive, please leave a comment asking for a review.
If the PR has merge conflicts, update it with the latest from the base branch.
If you are having difficulty finding a reviewer, please reach out to the
community, contact details can be found here: https://flink.apache.org/what-is-flink/community/
If this PR is no longer valid or desired, please feel free to close it.
If no activity occurs in the next 30 days, it will be automatically closed.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-4780617198
As a related update: while waiting for this PR to be reviewed, we also contributed an alternative solution to the Datadog Agent side — [DataDog/integrations-core#23857](https://github.com/DataDog/integrations-core/pull/23857) — which was recently merged. It adds an OpenMetrics-based collection mode to the official Flink integration, allowing the Datadog Agent to scrape Flink's built-in Prometheus reporter instead of relying on the push-based `DatadogHttpReporterFactory`. This makes the API key a concern of the Agent (which already holds it in a standard k8s deployment) rather than Flink config, which is particularly useful when `flink-conf.yaml` is read-only (e.g. Flink Operator on Kubernetes).
The two approaches are complementary: this PR remains valuable for users who prefer the native Datadog reporter; the integrations-core PR offers an Agent-pull alternative for k8s-native setups.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-5889755232
Since there is no traction on the Flink community on this PR, I took another approach in datadog integration. See https://github.com/DataDog/integrations-core/pull/23857 for more details. I'm going to close this PR.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "davidradl (via GitHub)" <gi...@apache.org>.
davidradl commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-3772327460
I cant find the Jira - do you mean [FLINK-33994](https://issues.apache.org/jira/browse/FLINK-33994)
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-3767448891
@flinkbot run azure
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-3760727265
<!--
Meta data
{
"version" : 1,
"metaDataEntries" : [ {
"hash" : "f1c969a3db1a0bab8fceb38638b0804cbb3c1141",
"status" : "UNKNOWN",
"url" : "TBD",
"triggerID" : "f1c969a3db1a0bab8fceb38638b0804cbb3c1141",
"triggerType" : "PUSH"
} ]
}-->
## CI report:
* f1c969a3db1a0bab8fceb38638b0804cbb3c1141 UNKNOWN
<details>
<summary>Bot commands</summary>
The @flinkbot bot supports the following commands:
- `@flinkbot run azure` re-run the last Azure build
</details>
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-3770063270
@Sxnan is it possible to review this PR please 🙏🏽
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-4399436441
Remove stale
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-3767829569
cc @pinxiu for info
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on code in PR #27432:
URL: https://github.com/apache/flink/pull/27432#discussion_r2716263769
##########
flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java:
##########
@@ -65,4 +66,25 @@ public MetricReporter createMetricReporter(Properties config) {
tags,
useLogicalIdentifier);
}
+
+ /**
+ * Retrieves the Datadog API key from configuration or environment variable.
+ *
+ * <p>The API key is resolved in the following order:
+ *
+ * <ol>
+ * <li>Configuration property "apikey"
+ * <li>Environment variable "DATADOG_API_KEY"
+ * </ol>
+ *
+ * @param config the configuration properties
+ * @return the Datadog API key, or null if not found in either location
+ */
+ private String getApiKey(Properties config) {
Review Comment:
I did apply you reco.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-3767795743
@zentol @molsionmo can I get your attention on this PR please. It has been closed for few times. I tried to add tests
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-5885104705
This PR is being marked as stale since it has not had any activity in the last 90 days.
If you would like to keep this PR alive, please leave a comment asking for a review.
If the PR has merge conflicts, update it with the latest from the base branch.
If you are having difficulty finding a reviewer, please reach out to the
community, contact details can be found here: https://flink.apache.org/what-is-flink/community/
If this PR is no longer valid or desired, please feel free to close it.
If no activity occurs in the next 30 days, it will be automatically closed.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-4434263931
Rebased onto latest `master` (no conflicts), re-signed all commits, and fixed a small JavaDoc indentation nit in `DatadogHttpReporterFactory#getApiKey`. The PR description has also been updated to reflect the current behavior — **`DD_API_KEY` takes precedence over the `apikey` config property** (as suggested by @davidradl in his review), and the now-outdated Mockito references and inconsistent test counts have been corrected.
@davidradl yes, the second referenced ticket is FLINK-33994 — updated the description with proper Jira links.
@flinkbot run azure
Friendly ping @zentol @molsionmo @Sxnan @pinxiu for a review when you have a chance 🙏
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-4475978416
Started a [DISCUSS] thread on dev@ to build consensus per the Flink reviewing-PRs guidelines: https://lists.apache.org/thread/6c5zmh6k2rx13717t059hphvv9bdwoc4
Will follow up on the Jira ticket once my account is approved.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib closed pull request #27432: [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable
URL: https://github.com/apache/flink/pull/27432
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on PR #27432:
URL: https://github.com/apache/flink/pull/27432#issuecomment-3765756640
@flinkbot run azure
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on code in PR #27432:
URL: https://github.com/apache/flink/pull/27432#discussion_r2715905124
##########
flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java:
##########
@@ -65,4 +66,25 @@ public MetricReporter createMetricReporter(Properties config) {
tags,
useLogicalIdentifier);
}
+
+ /**
+ * Retrieves the Datadog API key from configuration or environment variable.
+ *
+ * <p>The API key is resolved in the following order:
+ *
+ * <ol>
+ * <li>Configuration property "apikey"
+ * <li>Environment variable "DATADOG_API_KEY"
+ * </ol>
+ *
+ * @param config the configuration properties
+ * @return the Datadog API key, or null if not found in either location
+ */
+ private String getApiKey(Properties config) {
Review Comment:
@davidradl Make sense, I'll change the order to prioritize the environment variable if it is present.
Regarding the FLINK_PROPERTIES suggestion: that mechanism works well in standard Docker environments, but it fails in Kubernetes when using the Flink Operator. The Operator mounts the configuration as a ConfigMap, which is read-only (can't be something else). Since the standard Docker entrypoint attempts to append FLINK_PROPERTIES to flink-conf.yaml, it causes the pod to crash with a "Read-only file system" error. This PR solves that by allowing the API key to be read directly from the environment without needing to modify the config file at runtime.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [FLINK-36456] feat: Add support to pass Datadog API Key as environment variable [flink]
Posted by "barryib (via GitHub)" <gi...@apache.org>.
barryib commented on code in PR #27432:
URL: https://github.com/apache/flink/pull/27432#discussion_r2715905124
##########
flink-metrics/flink-metrics-datadog/src/main/java/org/apache/flink/metrics/datadog/DatadogHttpReporterFactory.java:
##########
@@ -65,4 +66,25 @@ public MetricReporter createMetricReporter(Properties config) {
tags,
useLogicalIdentifier);
}
+
+ /**
+ * Retrieves the Datadog API key from configuration or environment variable.
+ *
+ * <p>The API key is resolved in the following order:
+ *
+ * <ol>
+ * <li>Configuration property "apikey"
+ * <li>Environment variable "DATADOG_API_KEY"
+ * </ol>
+ *
+ * @param config the configuration properties
+ * @return the Datadog API key, or null if not found in either location
+ */
+ private String getApiKey(Properties config) {
Review Comment:
@davidradl Make sense, I'll change the order to prioritize the environment variable if it is present.
Regarding the FLINK_PROPERTIES suggestion: that mechanism works well in standard Docker environments, but it fails in Kubernetes when using the Flink Operator. The Operator mounts the configuration as a ConfigMap, which is read-only by default. Since the standard Docker entrypoint attempts to append FLINK_PROPERTIES to flink-conf.yaml, it causes the pod to crash with a "Read-only file system" error. This PR solves that by allowing the API key to be read directly from the environment without needing to modify the config file at runtime.
--
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: issues-unsubscribe@flink.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org