Skip to content

Conversation

@MatousJobanek
Copy link

@MatousJobanek MatousJobanek commented Feb 11, 2026

This PR is fixing this issue: https://issues.redhat.com/browse/OCPBUGS-76556

Context

The special DevSandbox telemetry is not being properly used in the Developer Sandbox clusters. This is caused by two things:

  1. Developer Sandbox clusters were migrated from OSD to ROSA, thus the current if statement

    window.SERVER_FLAGS.telemetry?.CLUSTER_TYPE === 'OSD' &&
    is not applicable anymore. As a result, the cluster type is not marked as DEVSANDBOX, which means that any other DevSandbox-specific logic is not applied:
    // anonymize user ID if cluster is not a DEVSANDBOX cluster
    if (getClusterProperties().clusterType === 'DEVSANDBOX') {
    processedUserId =
    userResource?.metadata?.annotations?.['toolchain.dev.openshift.com/sso-user-id'];
    } else {
    processedUserId = await anonymizeId(userId);
    }

  2. The priority of loading the telemetry keys has been changed so the DEVSANDBOX_SEGMENT_API_KEY is loaded as the last one - see:

    const TELEMETRY_API_KEY =
    window.SERVER_FLAGS.telemetry?.SEGMENT_API_KEY ||
    window.SERVER_FLAGS.telemetry?.SEGMENT_PUBLIC_API_KEY ||
    window.SERVER_FLAGS.telemetry?.DEVSANDBOX_SEGMENT_API_KEY ||

    However, since the managed ROSA clusters already come with the SEGMENT_API_KEY set (set by SD team and we cannot do anything with it), then the DEVSANDBOX_SEGMENT_API_KEY is never used.
    The priority of the keys was changed in this commit 56139d0

Changes

This PR does the following:

  • drops the condition relying on specific cluster type - having telemetry.console.openshift.io/DEVSANDBOX: true should be sufficient
  • changes the priority of loading the telemetry api key so when DEVSANDBOX: true then it uses the DEVSANDBOX_SEGMENT_API_KEY (if set)

Assisted-by: Cursor

Summary by CodeRabbit

  • Chores

    • Improved telemetry configuration for DevSandbox environments: when DevSandbox mode is enabled, the DevSandbox-specific analytics key is used and cluster type is reported as DEVSANDBOX, ensuring consistent environment identification.
    • Extended telemetry settings to recognize DevSandbox-specific flags.
  • Tests

    • Updated telemetry tests to validate DevSandbox precedence, confirming cluster type is DEVSANDBOX when enabled regardless of other cluster settings.

Assisted-by: Cursor
@openshift-ci openshift-ci bot requested review from rhamilto and spadgett February 11, 2026 15:21
@openshift-ci openshift-ci bot added component/sdk Related to console-plugin-sdk component/shared Related to console-shared plugin-api-changed Categorizes a PR as containing plugin API changes labels Feb 11, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 11, 2026

📝 Walkthrough

Walkthrough

Adds two telemetry fields to Window.telemetry: DEVSANDBOX_SEGMENT_API_KEY (string) and DEVSANDBOX ('true' | 'false'). Updates Segment analytics key selection to prefer DEVSANDBOX_SEGMENT_API_KEY only when telemetry.DEVSANDBOX === 'true'; otherwise continues using existing SEGMENT_API_KEY fallbacks. Modifies useTelemetry cluster type derivation to set clusterType to 'DEVSANDBOX' whenever telemetry.DEVSANDBOX === 'true', independent of CLUSTER_TYPE. Adjusts unit tests to reflect the new precedence and outcomes for DevSandbox scenarios. No exported/public API signatures changed beyond the added telemetry fields on Window.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing Developer Sandbox telemetry. It is concise, specific, and directly reflects the PR's core objective of resolving telemetry issues in DevSandbox clusters.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Member

@spadgett spadgett left a comment

Choose a reason for hiding this comment

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

Looks good overall. One small comment.

it('returns DEVSANDBOX when DEVSANDBOX is "true" regardless of CLUSTER_TYPE', () => {
window.SERVER_FLAGS = {
...originServerFlags,
telemetry: { CLUSTER_TYPE: 'OSD', DEVSANDBOX: 'true' },
Copy link
Member

Choose a reason for hiding this comment

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

I'd suggest changing the mock data to ROSA if that's what we're actually using (here and in some of the other tests below). That way we know the actual expected values work. We have the a_FUTURE_DEVSANDBOX_KEY to test the case where it's set to something else.

Copy link
Author

Choose a reason for hiding this comment

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

sure, done in 25f426c

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 12, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MatousJobanek
Once this PR has been reviewed and has the lgtm label, please ask for approval from jhadvig. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Feb 12, 2026

@MatousJobanek: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/sdk Related to console-plugin-sdk component/shared Related to console-shared plugin-api-changed Categorizes a PR as containing plugin API changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants