codeant-ai-for-open-source[bot] commented on code in PR #32487:
URL: https://github.com/apache/superset/pull/32487#discussion_r3464333082


##########
docker/entrypoints/run-server.sh:
##########
@@ -18,6 +18,9 @@
 # under the License.
 #
 HYPHEN_SYMBOL='-'
+STATSD_HOST="${SERVER_STATSD_HOST:-localhost}"
+STATSD_PORT="${SERVER_STATSD_PORT:-8125}"
+STATSD_ADDRESS="${STATSD_HOST}:${STATSD_PORT}"

Review Comment:
   **Suggestion:** The new defaults make StatsD instrumentation always enabled 
because `--statsd-host`/`--statsd-prefix` are always passed, even when no 
StatsD config is provided. This changes default runtime behavior, emits metrics 
traffic unexpectedly, and removes a clean "disabled" mode. Make these flags 
conditional on explicit env configuration instead of forcing `localhost:8125` 
and `superset`. [incorrect condition logic]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ⚠️ Docker-based Superset always enables Gunicorn StatsD metrics.
   - ⚠️ Deployments without StatsD still emit UDP metric traffic.
   - ⚠️ Harder to fully disable Gunicorn instrumentation via env config.
   - ⚠️ Helm/K8s flows using docker-bootstrap inherit this behavior.
   ```
   </details>
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Start Superset using the documented Docker image, whose CMD is
   `"/app/docker/entrypoints/run-server.sh"` as shown in
   `docs/admin_docs/installation/docker-builds.mdx:112`.
   
   2. Ensure no StatsD-related environment variables are set in the container 
(i.e.,
   `SERVER_STATSD_HOST`, `SERVER_STATSD_PORT`, `SERVER_STATSD_PREFIX` are 
unset).
   
   3. When the container starts, `/app/docker/entrypoints/run-server.sh` runs 
and executes
   lines 21–23 in `docker/entrypoints/run-server.sh`, assigning 
`STATSD_HOST="localhost"`,
   `STATSD_PORT="8125"`, and `STATSD_ADDRESS="${STATSD_HOST}:${STATSD_PORT}"` 
via the
   `${VAR:-default}` expansions.
   
   4. The script then executes `gunicorn` with `--statsd-host 
"${STATSD_ADDRESS}"` and
   `--statsd-prefix "${SERVER_STATSD_PREFIX:-superset}"` at lines 39–40 in
   `docker/entrypoints/run-server.sh`, causing Gunicorn's StatsD 
instrumentation to be
   enabled and emit metrics to `localhost:8125` with prefix `superset` even 
though the user
   did not explicitly configure any StatsD environment variables, removing a 
true "disabled"
   default mode.
   ```
   </details>
   
   [![Fix in 
Cursor](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-cursor-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=1f78ce991921439f9bb4e082f86332a5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
 [![Fix in VSCode 
Claude](https://new-codeant-butcket.s3.us-west-1.amazonaws.com/badges/fix-in-vscode-claude-flat.svg)](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=1f78ce991921439f9bb4e082f86332a5&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
   
   *(Use Cmd/Ctrl + Click for best experience)*
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** docker/entrypoints/run-server.sh
   **Line:** 21:23
   **Comment:**
        *Incorrect Condition Logic: The new defaults make StatsD 
instrumentation always enabled because `--statsd-host`/`--statsd-prefix` are 
always passed, even when no StatsD config is provided. This changes default 
runtime behavior, emits metrics traffic unexpectedly, and removes a clean 
"disabled" mode. Make these flags conditional on explicit env configuration 
instead of forcing `localhost:8125` and `superset`.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve 
this? If you propose a fix, implement it and please make it concise.
   Once fix is implemented, also check other comments on the same PR, and ask 
user if the user wants to fix the rest of the comments as well. if said yes, 
then fetch all the comments validate the correctness and implement a minimal fix
   ```
   </details>
   <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F32487&comment_hash=0b9a914ea2c0f3d02798538054f5cf91176a47669a8edcbf334da3e773d9c738&reaction=like'>👍</a>
 | <a 
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F32487&comment_hash=0b9a914ea2c0f3d02798538054f5cf91176a47669a8edcbf334da3e773d9c738&reaction=dislike'>👎</a>



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to