Repository navigation
Conversation
core logic changes
Codecov Report✅ All modified and coverable lines are covered by tests. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@EkVid is this ready for review? |
…Level to use const
Feat/web socket logging
Revert "Feat/web socket logging"
This reverts commit 50b55b7.
feat(controller): websocket logging with fix
…rator-internal variable
|
FYI @EkVid : a recent PR #508 clarifies when to use enums vs loosely typed properties, and might impact how you want to implement log levels. I suspect this will be the exception to the rule, where we want to use enums as opposed to just pass-through strings, as we need to standardize these across components. Curious to hear your thoughts. |
|
@villebro Thanks for the heads up! I agree, log level should be an enum. I went through #508, seems like its rule is to use an enum when the operator defines the allowed values and a plain string when it passes them unchanged to upstream. So log level should be using enum since the user can pick a value from the operator's allowed list, and the operator then translates it into what each component expects. I also saw that #508 keeps |
Resolve the overlap with apache#508 by keeping webServer.gunicorn.logLevel removed: Gunicorn's level now comes from spec.logLevel / webServer.logLevel. Drop the unused defaultLogLevel constant, regenerate CRDs and API docs, and update the Gunicorn log level docs.
e8d076f to
744a6a9
Compare
feat: celery flower log level configuration and tests
|
Hi @villebro, this PR should be ready for review now. I've added instructions for testing the behavior as an end user if you need them. Setupkind create cluster
kubectl apply -f config/samples/dev-dependencies.yaml
make install && make runKeep apiVersion: superset.apache.org/v1alpha1
kind: Superset
metadata:
name: my-superset
spec:
image:
tag: "6.1.0-dev" # seems like 6.1.0 doesn't have psycopg2, so change to dev
environment: Development
secretKey: thisIsNotSecure_changeInProduction!
metastore:
host: postgres
port: 5432
database: superset
username: superset
password: superset
valkey:
host: valkey
password: superset
logLevel: info # top level default for everything below
webServer: {}
celeryWorker: {}
celeryBeat: {}
mcpServer: {}
celeryFlower:
bootstrapScript: |
uv pip install --no-cache flower
podTemplate:
podSecurityContext: # flower isn't in the image, we need to install it at startup as root
runAsNonRoot: false
runAsUser: 0
websocketServer: # experimental feature, which needs its own image
image:
repository: oneacrefund/superset-websocket
tag: "latest"
config:
logLevel: debug
jwtSecret: CHANGE-ME-to-a-32-char-or-longer-secret
redis: {host: valkey, port: 6379, password: superset}
lifecycle: {}Apply the configuration and monitor the Superset resource: kubectl apply -f test.yaml
kubectl get superset my-superset -wWait for Test Instructions
For every component, a log level shows its own severity and everything more severe:
|
There was a problem hiding this comment.
Thanks for marking this ready, it's coming along nicely. Before this can merge, the scope needs to change and a few pieces are still missing. The env-var approach for LOG_LEVEL is right: level changes stay out of ConfigHash and init's EnvHash.
Looking at this against the development guidelines, I've changed my mind on several answers I gave in #453, and I'm sorry for the back-and-forth, especially where you'd already implemented what I asked for. The reversals:
- Q1: I said to remove
webServer.gunicorn.logLevel. It should stay as on main. - Q3 (Gunicorn part): I said to inject
GUNICORN_LOGLEVELeven withgunicorn.preset: disabled. It goes back under the preset, as on main. - Q5: I suggested setting
FASTMCP_LOG_LEVELon the MCP container. Leave it out of this PR. - Websocket: I asked you to inject
LOG_LEVELwhen a level is set explicitly. It shouldn't be injected at all. - Flower: I suggested mapping
criticaltoerror. Tornado acceptscritical, so pass it through.
Thanks for your patience. Here's the full revised scope in one place:
logLevel is the Superset app level.
spec.logLevel, a per-componentlogLevelon the Python components (web server, Celery worker, Celery Beat, Flower, MCP server), andlifecycle.logLevel. Same scoping assqlaEngineOptions.- It stays an enum, which fits the guideline: the operator defines the values and acts on them. It translates them per component and detects
debugfor theDebugLoggingcondition. - Mechanisms:
- Rendered
LOG_LEVELeverywhere. --loglevelfor the Celery worker and Beat.FLOWER_LOGGINGfor Flower.- Celery and Flower need the extra setting for the same reason: both reset the root logger at startup, so the app and the tool share one logger.
- Rendered
Server-process loggers keep their own native settings. The guidelines say not to enum values passed through to software the operator doesn't control, and they name the Gunicorn log level as the example. They also say to keep a field per-component when its meaning is specific to one component.
- Gunicorn: revising Q1. Keep
webServer.gunicorn.logLevelexactly as on main: a pass-through*stringwith aninfodefault, independent oflogLevel. Gunicorn's--log-levelonly affects thegunicorn.errorlogger, not the app. That also revises Q3 for Gunicorn:GUNICORN_LOGLEVELgoes back under the tuning preset, as on main. Celery's fallback command still gets--loglevel, as agreed. - Websocket: it doesn't read
superset_config.pyand already has a nativewebsocketServer.config.logLevel. It ignores the top-level value, the way Beat ignoresautoscaling. NoLOG_LEVELinjection and no Winston translation, which replaces my earlier "inject only when explicit" answer. - MCP: same idea for FastMCP/Uvicorn. Leave
FASTMCP_LOG_LEVELout of this PR. It can become a per-component pass-through later if there's demand.
What this simplifies:
- No breaking change, so no
**Breaking:**release note. - The precedence question between the websocket env and its config goes away.
- Less translation code.
- A Gunicorn level change still restarts every component via the shared checksum, as on main. That's the separate issue from Q2.
Still needed before merge, in order of importance. These are the items from the PR description (the list lost its "Not in this draft yet" heading but still applies), plus a few from this review:
- Tests that a level change keeps the rendered config,
ConfigHashand init'sEnvHashunchanged, and only rolls the affected component's pods. The design depends on this, so it's the most important missing piece. - The
DebugLoggingcondition + a Warning Event emitted once, covering only the app level, and docs/release note. The release note should mention that the Celery worker and Beat now log at INFO instead of Celery's WARNING. - Docs: update the mapping table and reserved env var table in
configuration.md. That means removing the websocketLOG_LEVELrow, describinggunicorn.logLevelas separate fromlogLevel, and adding a sentence on where to set the Gunicorn and websocket levels. - Please confirm
FLOWER_LOGGINGon a running Flower pod. The branch history has it removed as unconfirmed and then added back. - Since this PR now renders
LOG_LEVELitself,FLASK_DEBUG=1no longer implies debug logging (upstream setsLOG_LEVEL = DEBUG if DEBUG else INFO). A one-line note in the docs is enough.
fix: Reverted changes for Gunicorn, WebSocket, and refactored Flower
…-changes feat: add checks for loglevel configHash
…-main # Conflicts: # internal/config/renderer_test.go
|
Hi @villebro, I have made the necessary changes based on the comments. It would be great if you can review it again whenever you have time. I confirmed that (Assumes the pod is already running, and change the logLevel to info, debug, and critical) In addition, the # Mock Staging Superset with debug that uses secretKeyFrom
kubectl create secret generic superset-secret --from-literal=secret-key="$(openssl rand -base64 42)"
kubectl apply -f - <<'EOF'
apiVersion: superset.apache.org/v1alpha1
kind: Superset
metadata:
name: superset-staging
spec:
environment: Staging
image:
tag: 6.1.0-dev
secretKeyFrom:
name: superset-secret
key: secret-key
logLevel: debug
webServer: {}
celeryBeat: {}
lifecycle:
disabled: true
EOF
# Condition is True, listing webserver and celery beat, and one Warning Event is emitted
kubectl get superset superset-staging -o jsonpath='{.status.conditions[?(@.type=="DebugLogging")]}'
kubectl describe superset superset-staging | sed -n '/^Events:/,$p'
# Check another reconcile doesn't repeat the event
kubectl annotate superset superset-staging test/poke="$(date +%s)" --overwrite
kubectl describe superset superset-staging | sed -n '/^Events:/,$p'
# A component override updates the message to just webserver
kubectl patch superset superset-staging --type merge -p '{"spec":{"celeryBeat":{"logLevel":"info"}}}'
kubectl get superset superset-staging -o jsonpath='{.status.conditions[?(@.type=="DebugLogging")].message}'
# Turning debug off removes the condition
kubectl patch superset superset-staging --type merge -p '{"spec":{"logLevel":"info"}}'
kubectl get superset superset-staging -o jsonpath='{.status.conditions[*].type}'
# The Control that has no condition in DEV
kubectl patch superset superset-dev --type merge -p '{"spec":{"logLevel":"debug"}}'
kubectl get superset superset-dev -o jsonpath='{.status.conditions[?(@.type=="DebugLogging")]}'Please let me know if you want me to share more details of the testing, and thank you so much for your time! |
feat: documentation, debug condition+warning, and release notes
Summary
Adds a top-level
spec.logLevel(debug,info,warning,error,critical, default toinfo) for the Superset application log level. It's inherited by the Python components and lifecycle tasks, with a per componentlogLevelonwebServer,celeryWorker,celeryBeat,celeryFlowerandmcpServer, and a singlelifecycle.logLevelthat override it. The operator maps the resolved level onto each component's own mechanism.Part of #453
Details
Design notes
ConfigHashor init'sEnvHash, and lifecycle tasks aren't triggered againlogLevel,infois applied at resolutionMechanisms
LOG_LEVELin every renderedsuperset_config.py, read fromSUPERSET_OPERATOR__LOG_LEVEL--loglevelfor the Celery worker and Beat, including the fallback command used withpreset: disabledFLOWER_LOGGINGfor Flower, Celery and Flower both reset the root logger at startup, so they need the extra settingServer process loggers keep their own native settings:
webServer.gunicorn.logLevelis unchanged from main and is independent oflogLevelwebsocketServer.config.logLevel, and noLOG_LEVELis injectedFASTMCP_LOG_LEVELis set on the MCP serverDebugLoggingconditionWhen any resolved level is
debugandenvironmentisn'tDevelopment, the Superset status gets aDebugLoggingcondition listing the affected components, and the operator emits one Warning Event when it first appears. The condition is removed when debug is turned off and doesn't affectReadyorAvailable. Only the typed field is checked, not aLOG_LEVELset inconfigUpgrade effects
There's no breaking change. These effects are in the release notes and docs:
superset_config.pygains theLOG_LEVELline, so upgrading the operator rolls every Python component once and runs init onceinfoinstead of Celery'swarningdefaultFLASK_DEBUG=1no longer implies debug logging, since the operator setsLOG_LEVELitselfTests and docs
logLevel, the checksum behaviors (rendered config,ConfigHashand init inputs unchanged), and theDebugLoggingcondition and Eventconfiguration.md: updated log level mapping table and reserved env var table, where to set the gunicorn and websocket levels, a "Debug Logging Outside Development" section, and theFLASK_DEBUGnote