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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to