Skip to content

fix(telemetry): set kernel user to match workload user for logs#572

Closed
kaixi-wang wants to merge 3 commits into
alan/telemetry-including-redisfrom
kacey/set-user-for-logs
Closed

fix(telemetry): set kernel user to match workload user for logs#572
kaixi-wang wants to merge 3 commits into
alan/telemetry-including-redisfrom
kacey/set-user-for-logs

Conversation

@kaixi-wang

@kaixi-wang kaixi-wang commented May 26, 2026

Copy link
Copy Markdown
Member

Rationale

  • set user so sidecar can access logs without elevated permissions

Review Priority

  • high
  • medium
  • low

Changes

Checklist

  • This PR maintains parity between Docker Compose and Helm

Testing

@kaixi-wang kaixi-wang self-assigned this May 26, 2026
@kaixi-wang kaixi-wang requested a review from a team as a code owner May 26, 2026 22:46
@coderabbitai

coderabbitai Bot commented May 26, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 1fa9acf4-b377-4047-b45c-37b5150575ae

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This pull request adds telemetry sidecar support to FiftyOne Enterprise v2.19+, enabling per-service metrics and logs via bundled Redis backend. Changes span Docker Compose and Kubernetes deployment documentation, Helm chart templates, comprehensive test coverage for new telemetry components, and updates to existing tests and fixtures to account for telemetry services and environment configuration.

Changes

Telemetry Deployment and Documentation

Layer / File(s) Summary
Docker Compose Telemetry Documentation and Environment Configuration
docker/README.md, docker/docs/configuring-*.md, docker/docs/upgrading.md, docker/internal-auth/env.template, docker/legacy-auth/env.template
Added comprehensive telemetry documentation for Docker Compose deployments, including how sidecars and Redis are bundled by default, opt-out mechanisms via compose overrides, delegated-operator worker scaling via COMPOSE_PROFILES=do-N (replacing the prior FIFTYONE_DELEGATED_OPERATOR_WORKER_REPLICAS env var), and environment variable overrides for Redis connectivity, images, and service target-name matching.
Kubernetes Orchestrator and Helm Upgrade Documentation
docs/orchestrators/configuring-kubernetes-orchestrator.md, helm/docs/upgrading.md
Added telemetry sidecar guidance for Kubernetes delegated-operator job templates using native sidecars with shared PID namespace, pod security requirements, full production template examples with telemetry wiring, and Helm upgrade guidance for v2.19+ including Redis persistence and external URL configuration.

Helm Chart Telemetry Implementation

Layer / File(s) Summary
Telemetry Template Helper Library
helm/fiftyone-teams-app/templates/_telemetry.tpl
New Helm template file with 11 helper templates for Redis service name/URL computation (supporting external override), label generation, RBAC object naming, RoleBinding subject defaults, sidecar environment variable rendering, and two sidecar container variants (standard and native-sidecar with readiness probe and restartPolicy: Always).
Telemetry Injection into Service Templates
helm/fiftyone-teams-app/templates/_do_targets.tpl, helm/fiftyone-teams-app/templates/_helpers.tpl, helm/fiftyone-teams-app/templates/NOTES.txt
Updated service templates to conditionally inject FIFTYONE_TELEMETRY_REDIS_URL and TELEMETRY_SOCKET environment variables into delegated-operator and service workloads; added NOTES.txt warning about ephemeral Redis storage and persistence configuration.
Helm Chart README Values Documentation and Security Context Defaults
helm/fiftyone-teams-app/README.md
Documented new telemetry values section covering enablement, Redis configuration (image, persistence, security context, resources), sidecar image/resources/pull policy, and service account bindings; updated pod security context defaults (UID/GID 1000, runAsNonRoot: true) for API, app, plugins, and delegated-operator templates.

Telemetry Test Coverage

Layer / File(s) Summary
Telemetry Redis Helm Template Tests
tests/unit/helm/telemetry-redis_test.go
19 new test methods validating telemetry Redis Deployment/Service/PVC rendering, enabled-by-default behavior, explicit disablement, external URL override, environment variable wiring to API and delegated-operator workloads, image defaults/overrides, and persistence interactions (emptyDir vs. PVC vs. existing claim precedence).
Telemetry RBAC Helm Template Tests
tests/unit/helm/telemetry-rolebinding_test.go
7 new test methods validating Role and RoleBinding rendering, metadata, exact RBAC rules (get on pods and pods/log), subject binding to service accounts with default and override scenarios, and roleRef targeting.
Telemetry Sidecar Container Helm Template Tests
tests/unit/helm/telemetry-sidecar_test.go
4 new test methods validating sidecar injection: shareProcessNamespace enablement when telemetry is on/off, security context (capability dropping, privilege escalation disabled, SYS_PTRACE only for executor mode).
Test Helper Functions and YAML Utilities
tests/unit/helm/yaml_helpers.go
New utility functions: splitYAMLDocs for multi-document YAML parsing and disableTelemetry for setting telemetry.enabled=false in test cases.
Existing Helm Deployment Tests Updated for Telemetry
tests/unit/helm/api-*.go, tests/unit/helm/app-deployment_test.go, tests/unit/helm/delegated-operator-*.go, tests/unit/helm/plugins-deployment_test.go, tests/unit/helm/teams-app-deployment_test.go, tests/unit/helm/common_test.go
Updated 8 existing test files across 100+ test methods to wrap test values with disableTelemetry() helper, verify pod security context defaults (1000 UID/GID), add telemetry socket volume/mount injection tests, and update build tag constraints for telemetry-specific test variants.
Docker Compose Unit Tests for Telemetry Services and Volumes
tests/unit/compose/docker-compose-internal-auth_test.go, tests/unit/compose/docker-compose-legacy-auth_test.go
Updated service name, image, environment, and volume assertions across 3 test methods to account for telemetry-redis and telemetry-sidecar services, FIFTYONE_TELEMETRY_REDIS_URL environment variable, TELEMETRY_SOCKET for delegated-operator, and telemetry volume mounts; added Compose profile wiring for delegated-operator slot selection.
Integration Tests and Test Fixtures for Telemetry Support
tests/integration/compose/docker-compose-*_test.go, tests/fixtures/docker/integration_*.env, utils/bump-fixtures-helm.sh, utils/validate-docker-pulls.sh
Updated integration test log expectations (Registering executor builtin) and whitespace-tolerant regex for compose output; bumped test fixture image versions to rc14/rc13; added conditional Helm telemetry sidecar image tag syncing; updated expected Docker image list to include redis:7-alpine and voxel51/telemetry-sidecar.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • voxel51/fiftyone-teams-app-deploy#571: Both PRs update delegated-operator worker scaling from environment variable to Compose profiles and align Docker Compose integration test expectations for the new Registering executor builtin startup log.

Poem

🐰 Metrics flow like streams of clover,
Sidecars guard each operation's border.
Redis caches what the service knows—
Telemetry blooms where the data flows! 📊

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The PR description lacks concrete details about changes, testing approach, and priority level required by template. Complete the PR description by: (1) filling in the Rationale section with details about why kernel user needs to match workload user for logs, (2) checking a Review Priority box (high/medium/low), (3) expanding Changes section with specific modifications made, (4) confirming parity between Docker Compose and Helm in the checklist, (5) describing how the changes were tested.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately reflects the main change: fixing telemetry by setting the kernel user to match the workload user for proper log collection.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch kacey/set-user-for-logs

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (2)
tests/unit/helm/delegated-operator-instance-deployment_test.go (1)

5764-5769: ⚡ Quick win

Use the shared YAML-doc splitter in this test.

strings.Split(output, "---") with positional indexing is brittle. Reusing the test helper for multi-doc YAML parsing will make this check less formatting-sensitive.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/helm/delegated-operator-instance-deployment_test.go` around lines
5764 - 5769, Replace the brittle strings.Split(output, "---") + docs[1] approach
with the repository's shared YAML-doc splitter helper (e.g., SplitYAMLDocuments
or testhelper.SplitYAMLDocs) to parse output into documents; call that helper
with output, assert you got the expected number of docs, locate the deployment
document from the returned slice, and pass that document to
helm.UnmarshalK8SYaml(subT, doc, &deployment) instead of using positional
indexing on the raw split.
tests/unit/helm/delegated-operator-job-configmap_test.go (1)

748-751: ⚡ Quick win

Avoid relying on container index for mount assertions.

Asserting against Containers[0] is order-sensitive. Resolve the target workload container by name first, then assert telemetry mount count on that container.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/helm/delegated-operator-job-configmap_test.go` around lines 748 -
751, The test currently indexes Containers[0] which is fragile; instead locate
the target container by matching its Name (e.g., find the container where c.Name
== <expected container name> used in the test) and then pass that container's
VolumeMounts into countMountsByName along with socketName; replace any use of
job.Spec.Template.Spec.Containers[0] with a lookup (fail the test if the named
container is not found) and then assert that
countMountsByName(foundContainer.VolumeMounts, socketName) equals
testCase.expectMnt.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docker/docs/configuring-gpu-workloads.md`:
- Around line 57-58: The example COMPOSE_PROFILES value uses an invalid profile
`do-1,gpu`; update the example to a valid Compose profile for slot + GPU, e.g.
use `COMPOSE_PROFILES=gpu` or `COMPOSE_PROFILES=slot-2,gpu` instead of
`do-1,gpu` so the documentation reflects the new slot model; change the example
string in the paragraph that shows COMPOSE_PROFILES accordingly.

In `@docker/docs/upgrading.md`:
- Around line 143-144: The markdown line describing the capability requirement
has unbalanced bold markers around SYS_PTRACE which breaks rendering; update the
line in the documentation that mentions teams-do and SYS_PTRACE so the bold
markers are balanced (for example ensure both opening and closing ** wrap
SYS_PTRACE or wrap the entire phrase **`SYS_PTRACE`** consistently), preserving
the surrounding wording and inline code formatting for teams-do and the
capability name.

In `@helm/fiftyone-teams-app/templates/NOTES.txt`:
- Line 7: The INFO note's Helm conditional in templates/NOTES.txt incorrectly
requires both .Values.telemetry.redis.persistence.enabled to be false AND
.Values.telemetry.redis.persistence.existingClaim to be false to show the
warning; change the condition so the warning appears when persistence is not
effectively persistent by using an OR between those checks. Update the if
expression that currently reads (not
.Values.telemetry.redis.persistence.enabled) (not
.Values.telemetry.redis.persistence.existingClaim) to use (or (not
.Values.telemetry.redis.persistence.enabled) (not
.Values.telemetry.redis.persistence.existingClaim)) while keeping the other
checks (.Values.telemetry.enabled and not .Values.telemetry.redis.external.url)
the same so the note shows when Redis is ephemeral.

In `@tests/unit/helm/telemetry-redis_test.go`:
- Around line 139-147: The test currently only calls s.Equal(expectedURL,
ev.Value) when it finds an env var named "FIFTYONE_TELEMETRY_REDIS_URL", so a
missing env var can let the test pass; update the loop over
deployment.Spec.Template.Spec.Containers to first assert the env var exists for
each container (e.g., set a found flag or use s.Require().Truef/Assertf)
referencing "FIFTYONE_TELEMETRY_REDIS_URL" and container.Name, and only then
compare ev.Value to expectedURL with s.Equal(expectedURL, ev.Value) so missing
variables fail the test explicitly.

In `@tests/unit/helm/telemetry-sidecar_test.go`:
- Around line 183-194: The test currently only checks presence of "SYS_PTRACE"
via sc.Capabilities.Add and may miss accidental extra capabilities; update the
assertion to verify the exact capabilities list when tc.executor is true and
empty when false by comparing sc.Capabilities.Add to the expected slice/set.
Locate the loop and hasPtrace check around sc.Capabilities.Add and replace it
with an exact equality/assertion (e.g., compare as a sorted slice or convert to
a set) using tc.executor to decide the expected value so the test fails if any
unexpected capability is present.

---

Nitpick comments:
In `@tests/unit/helm/delegated-operator-instance-deployment_test.go`:
- Around line 5764-5769: Replace the brittle strings.Split(output, "---") +
docs[1] approach with the repository's shared YAML-doc splitter helper (e.g.,
SplitYAMLDocuments or testhelper.SplitYAMLDocs) to parse output into documents;
call that helper with output, assert you got the expected number of docs, locate
the deployment document from the returned slice, and pass that document to
helm.UnmarshalK8SYaml(subT, doc, &deployment) instead of using positional
indexing on the raw split.

In `@tests/unit/helm/delegated-operator-job-configmap_test.go`:
- Around line 748-751: The test currently indexes Containers[0] which is
fragile; instead locate the target container by matching its Name (e.g., find
the container where c.Name == <expected container name> used in the test) and
then pass that container's VolumeMounts into countMountsByName along with
socketName; replace any use of job.Spec.Template.Spec.Containers[0] with a
lookup (fail the test if the named container is not found) and then assert that
countMountsByName(foundContainer.VolumeMounts, socketName) equals
testCase.expectMnt.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d4a13e15-af1b-4fb1-88ad-bc3da0c57e02

📥 Commits

Reviewing files that changed from the base of the PR and between 195cff9 and d7e55c1.

⛔ Files ignored due to path filters (32)
  • docker/common-services.yaml is excluded by !**/*.yaml
  • docker/internal-auth/compose.dedicated-plugins.yaml is excluded by !**/*.yaml
  • docker/internal-auth/compose.delegated-operators.gpu.yaml is excluded by !**/*.yaml
  • docker/internal-auth/compose.delegated-operators.yaml is excluded by !**/*.yaml
  • docker/internal-auth/compose.plugins.yaml is excluded by !**/*.yaml
  • docker/internal-auth/compose.yaml is excluded by !**/*.yaml
  • docker/legacy-auth/compose.dedicated-plugins.yaml is excluded by !**/*.yaml
  • docker/legacy-auth/compose.delegated-operators.gpu.yaml is excluded by !**/*.yaml
  • docker/legacy-auth/compose.delegated-operators.yaml is excluded by !**/*.yaml
  • docker/legacy-auth/compose.plugins.yaml is excluded by !**/*.yaml
  • docker/legacy-auth/compose.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/api-deployment.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/api-role.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/app-deployment.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/delegated-operator-instance-deployment.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/delegated-operator-job-configmap.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/plugins-deployment.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/telemetry-redis-deployment.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/telemetry-redis-pvc.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/telemetry-redis-service.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/telemetry-role.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/templates/telemetry-rolebinding.yaml is excluded by !**/*.yaml
  • helm/fiftyone-teams-app/values.schema.json is excluded by !**/*.json
  • helm/fiftyone-teams-app/values.yaml is excluded by !**/*.yaml
  • tests/fixtures/docker/compose.override.mongodb.yaml is excluded by !**/*.yaml
  • tests/fixtures/docker/compose.override.mongodb_do.yaml is excluded by !**/*.yaml
  • tests/fixtures/docker/compose.override.mongodb_plugins.yaml is excluded by !**/*.yaml
  • tests/fixtures/helm/integration_values.yaml is excluded by !**/*.yaml
  • tests/unit/helm/test_data/delegated-operator-job-configmap_test/expected-cpu-default-override-template-values.yaml is excluded by !**/*.yaml
  • tests/unit/helm/test_data/delegated-operator-job-configmap_test/expected-cpu-default.yaml is excluded by !**/*.yaml
  • tests/unit/helm/test_data/delegated-operator-job-configmap_test/expected-override-example-cascading-template.yaml is excluded by !**/*.yaml
  • tests/unit/helm/test_data/delegated-operator-job-configmap_test/expected-override-example-template.yaml is excluded by !**/*.yaml
📒 Files selected for processing (34)
  • docker/README.md
  • docker/docs/configuring-delegated-operators.md
  • docker/docs/configuring-gpu-workloads.md
  • docker/docs/configuring-telemetry.md
  • docker/docs/upgrading.md
  • docker/internal-auth/env.template
  • docker/legacy-auth/env.template
  • docs/orchestrators/configuring-kubernetes-orchestrator.md
  • helm/docs/upgrading.md
  • helm/fiftyone-teams-app/README.md
  • helm/fiftyone-teams-app/templates/NOTES.txt
  • helm/fiftyone-teams-app/templates/_do_targets.tpl
  • helm/fiftyone-teams-app/templates/_helpers.tpl
  • helm/fiftyone-teams-app/templates/_telemetry.tpl
  • tests/fixtures/docker/integration_internal_auth.env
  • tests/fixtures/docker/integration_legacy_auth.env
  • tests/integration/compose/docker-compose-internal-auth_test.go
  • tests/integration/compose/docker-compose-legacy-auth_test.go
  • tests/unit/compose/docker-compose-internal-auth_test.go
  • tests/unit/compose/docker-compose-legacy-auth_test.go
  • tests/unit/helm/api-deployment_test.go
  • tests/unit/helm/api-role_test.go
  • tests/unit/helm/app-deployment_test.go
  • tests/unit/helm/common_test.go
  • tests/unit/helm/delegated-operator-instance-deployment_test.go
  • tests/unit/helm/delegated-operator-job-configmap_test.go
  • tests/unit/helm/plugins-deployment_test.go
  • tests/unit/helm/teams-app-deployment_test.go
  • tests/unit/helm/telemetry-redis_test.go
  • tests/unit/helm/telemetry-rolebinding_test.go
  • tests/unit/helm/telemetry-sidecar_test.go
  • tests/unit/helm/yaml_helpers.go
  • utils/bump-fixtures-helm.sh
  • utils/validate-docker-pulls.sh

Comment on lines +57 to +58
worker profile (e.g. `COMPOSE_PROFILES=do-1,gpu`); see
[Configuring Telemetry](./configuring-telemetry.md#scaling-teams-do-with-telemetry)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use a valid Compose profile example for slot 1 + GPU.

do-1 is not part of the new slot model (slot 1 is always on). This example can mislead users into setting a non-existent profile.

Suggested edit
- worker profile (e.g. `COMPOSE_PROFILES=do-1,gpu`); see
+ worker profile (e.g. `COMPOSE_PROFILES=gpu`); see
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
worker profile (e.g. `COMPOSE_PROFILES=do-1,gpu`); see
[Configuring Telemetry](./configuring-telemetry.md#scaling-teams-do-with-telemetry)
worker profile (e.g. `COMPOSE_PROFILES=gpu`); see
[Configuring Telemetry](./configuring-telemetry.md#scaling-teams-do-with-telemetry)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker/docs/configuring-gpu-workloads.md` around lines 57 - 58, The example
COMPOSE_PROFILES value uses an invalid profile `do-1,gpu`; update the example to
a valid Compose profile for slot + GPU, e.g. use `COMPOSE_PROFILES=gpu` or
`COMPOSE_PROFILES=slot-2,gpu` instead of `do-1,gpu` so the documentation
reflects the new slot model; change the example string in the paragraph that
shows COMPOSE_PROFILES accordingly.

Comment thread docker/docs/upgrading.md
Comment on lines +143 to +144
1. **`teams-do` requires the **`SYS_PTRACE`** capability to allow the
telemetry agent to observe the target process.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix malformed emphasis formatting in capability requirement line.

The bold markers are unbalanced around SYS_PTRACE, which breaks markdown rendering.

Suggested edit
-1. **`teams-do` requires the **`SYS_PTRACE`** capability to allow the
+1. **`teams-do` requires the `SYS_PTRACE` capability** to allow the
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker/docs/upgrading.md` around lines 143 - 144, The markdown line
describing the capability requirement has unbalanced bold markers around
SYS_PTRACE which breaks rendering; update the line in the documentation that
mentions teams-do and SYS_PTRACE so the bold markers are balanced (for example
ensure both opening and closing ** wrap SYS_PTRACE or wrap the entire phrase
**`SYS_PTRACE`** consistently), preserving the surrounding wording and inline
code formatting for teams-do and the capability name.

https://helm.fiftyone.ai for details.
{{ end }}

{{- if and .Values.telemetry.enabled (not .Values.telemetry.redis.external.url) (not .Values.telemetry.redis.persistence.enabled) (not .Values.telemetry.redis.persistence.existingClaim) }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix the warning condition for effective emptyDir mode.

Line 7 currently hides this INFO note when telemetry.redis.persistence.existingClaim is set, even if telemetry.redis.persistence.enabled is false. In that case Redis is still ephemeral, so the warning should still appear.

Proposed fix
-{{- if and .Values.telemetry.enabled (not .Values.telemetry.redis.external.url) (not .Values.telemetry.redis.persistence.enabled) (not .Values.telemetry.redis.persistence.existingClaim) }}
+{{- if and .Values.telemetry.enabled (not .Values.telemetry.redis.external.url) (not .Values.telemetry.redis.persistence.enabled) }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{{- if and .Values.telemetry.enabled (not .Values.telemetry.redis.external.url) (not .Values.telemetry.redis.persistence.enabled) (not .Values.telemetry.redis.persistence.existingClaim) }}
{{- if and .Values.telemetry.enabled (not .Values.telemetry.redis.external.url) (not .Values.telemetry.redis.persistence.enabled) }}
🧰 Tools
🪛 LanguageTool

[style] ~7-~7: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ues.telemetry.redis.external.url) (not .Values.telemetry.redis.persistence.enabled) (n...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[style] ~7-~7: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...emetry.redis.persistence.enabled) (not .Values.telemetry.redis.persistence.existingCla...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@helm/fiftyone-teams-app/templates/NOTES.txt` at line 7, The INFO note's Helm
conditional in templates/NOTES.txt incorrectly requires both
.Values.telemetry.redis.persistence.enabled to be false AND
.Values.telemetry.redis.persistence.existingClaim to be false to show the
warning; change the condition so the warning appears when persistence is not
effectively persistent by using an OR between those checks. Update the if
expression that currently reads (not
.Values.telemetry.redis.persistence.enabled) (not
.Values.telemetry.redis.persistence.existingClaim) to use (or (not
.Values.telemetry.redis.persistence.enabled) (not
.Values.telemetry.redis.persistence.existingClaim)) while keeping the other
checks (.Values.telemetry.enabled and not .Values.telemetry.redis.external.url)
the same so the note shows when Redis is ephemeral.

Comment on lines +139 to +147
for _, container := range deployment.Spec.Template.Spec.Containers {
for _, ev := range container.Env {
if ev.Name == "FIFTYONE_TELEMETRY_REDIS_URL" {
s.Equal(expectedURL, ev.Value,
"FIFTYONE_TELEMETRY_REDIS_URL on %s should be release-scoped in-cluster URL",
container.Name)
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Assert env var presence in bundled URL test before checking value.

At Line 139, this test only validates the value if FIFTYONE_TELEMETRY_REDIS_URL exists, so it can pass even when the env var is missing on a container.

Suggested fix
  expectedURL := fmt.Sprintf("redis://%s-telemetry-redis.%s.svc.cluster.local:6379",
  	s.releaseName, "fiftyone-teams")
  for _, container := range deployment.Spec.Template.Spec.Containers {
-		for _, ev := range container.Env {
-			if ev.Name == "FIFTYONE_TELEMETRY_REDIS_URL" {
-				s.Equal(expectedURL, ev.Value,
-					"FIFTYONE_TELEMETRY_REDIS_URL on %s should be release-scoped in-cluster URL",
-					container.Name)
-			}
-		}
+		var found *corev1.EnvVar
+		for i, ev := range container.Env {
+			if ev.Name == "FIFTYONE_TELEMETRY_REDIS_URL" {
+				found = &container.Env[i]
+				break
+			}
+		}
+		s.Require().NotNil(found,
+			"FIFTYONE_TELEMETRY_REDIS_URL should be set on %s container", container.Name)
+		s.Equal(expectedURL, found.Value,
+			"FIFTYONE_TELEMETRY_REDIS_URL on %s should be release-scoped in-cluster URL",
+			container.Name)
  }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for _, container := range deployment.Spec.Template.Spec.Containers {
for _, ev := range container.Env {
if ev.Name == "FIFTYONE_TELEMETRY_REDIS_URL" {
s.Equal(expectedURL, ev.Value,
"FIFTYONE_TELEMETRY_REDIS_URL on %s should be release-scoped in-cluster URL",
container.Name)
}
}
}
for _, container := range deployment.Spec.Template.Spec.Containers {
var found *corev1.EnvVar
for i, ev := range container.Env {
if ev.Name == "FIFTYONE_TELEMETRY_REDIS_URL" {
found = &container.Env[i]
break
}
}
s.Require().NotNil(found,
"FIFTYONE_TELEMETRY_REDIS_URL should be set on %s container", container.Name)
s.Equal(expectedURL, found.Value,
"FIFTYONE_TELEMETRY_REDIS_URL on %s should be release-scoped in-cluster URL",
container.Name)
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/helm/telemetry-redis_test.go` around lines 139 - 147, The test
currently only calls s.Equal(expectedURL, ev.Value) when it finds an env var
named "FIFTYONE_TELEMETRY_REDIS_URL", so a missing env var can let the test
pass; update the loop over deployment.Spec.Template.Spec.Containers to first
assert the env var exists for each container (e.g., set a found flag or use
s.Require().Truef/Assertf) referencing "FIFTYONE_TELEMETRY_REDIS_URL" and
container.Name, and only then compare ev.Value to expectedURL with
s.Equal(expectedURL, ev.Value) so missing variables fail the test explicitly.

Comment on lines +183 to +194
var hasPtrace bool
for _, capability := range sc.Capabilities.Add {
if capability == "SYS_PTRACE" {
hasPtrace = true
break
}
}
if tc.executor {
s.True(hasPtrace, "executor sidecar must add SYS_PTRACE for py-spy crash archives")
} else {
s.False(hasPtrace, "service-mode sidecar must not add SYS_PTRACE")
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Tighten capability assertions to prevent unnoticed extra capabilities.

At Line 190, the test only checks whether SYS_PTRACE exists. It won’t fail if other capabilities are accidentally added.

Suggested fix
-			var hasPtrace bool
-			for _, capability := range sc.Capabilities.Add {
-				if capability == "SYS_PTRACE" {
-					hasPtrace = true
-					break
-				}
-			}
-			if tc.executor {
-				s.True(hasPtrace, "executor sidecar must add SYS_PTRACE for py-spy crash archives")
-			} else {
-				s.False(hasPtrace, "service-mode sidecar must not add SYS_PTRACE")
-			}
+			if tc.executor {
+				s.ElementsMatch(
+					[]corev1.Capability{"SYS_PTRACE"},
+					sc.Capabilities.Add,
+					"executor sidecar should only add SYS_PTRACE")
+			} else {
+				s.Empty(sc.Capabilities.Add, "service-mode sidecar must not add capabilities")
+			}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var hasPtrace bool
for _, capability := range sc.Capabilities.Add {
if capability == "SYS_PTRACE" {
hasPtrace = true
break
}
}
if tc.executor {
s.True(hasPtrace, "executor sidecar must add SYS_PTRACE for py-spy crash archives")
} else {
s.False(hasPtrace, "service-mode sidecar must not add SYS_PTRACE")
}
if tc.executor {
s.ElementsMatch(
[]corev1.Capability{"SYS_PTRACE"},
sc.Capabilities.Add,
"executor sidecar should only add SYS_PTRACE")
} else {
s.Empty(sc.Capabilities.Add, "service-mode sidecar must not add capabilities")
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/unit/helm/telemetry-sidecar_test.go` around lines 183 - 194, The test
currently only checks presence of "SYS_PTRACE" via sc.Capabilities.Add and may
miss accidental extra capabilities; update the assertion to verify the exact
capabilities list when tc.executor is true and empty when false by comparing
sc.Capabilities.Add to the expected slice/set. Locate the loop and hasPtrace
check around sc.Capabilities.Add and replace it with an exact equality/assertion
(e.g., compare as a sorted slice or convert to a set) using tc.executor to
decide the expected value so the test fails if any unexpected capability is
present.

@kaixi-wang kaixi-wang changed the base branch from release/v2.19.0 to alan/telemetry-including-redis May 27, 2026 00:33
// Fast" startup line instead — works regardless of worker count or log
// level (INFO is the default).
log: "Goin' Fast",
log: "Goin' Fast",

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Starting worker" only fires in multi-worker mode. Goin' Fast prints in both

@kaixi-wang

Copy link
Copy Markdown
Member Author

closing in favor of #566

@kaixi-wang kaixi-wang closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant