Skip to content

feat(explorer): add Java agent version selector to Configuration Builder#492

Merged
jaydeluca merged 2 commits into
open-telemetry:mainfrom
lucacavenaghi97:feat/475-java-agent-version-selector
May 18, 2026
Merged

feat(explorer): add Java agent version selector to Configuration Builder#492
jaydeluca merged 2 commits into
open-telemetry:mainfrom
lucacavenaghi97:feat/475-java-agent-version-selector

Conversation

@lucacavenaghi97
Copy link
Copy Markdown
Member

Closes #475.

Adds an Agent version selector next to the Schema one in the header. Switching it refetches the registry and updates the YAML preview. No persistence, same as the schema selector. Drops the now-unused useLatestJavaAgentVersion hook.

@lucacavenaghi97 lucacavenaghi97 requested review from a team as code owners May 15, 2026 16:07
@netlify
Copy link
Copy Markdown

netlify Bot commented May 15, 2026

Deploy Preview for otel-ecosystem-explorer ready!

Name Link
🔨 Latest commit b6f885a
🔍 Latest deploy log https://app.netlify.com/projects/otel-ecosystem-explorer/deploys/6a0748bd757156000873c91c
😎 Deploy Preview https://deploy-preview-492--otel-ecosystem-explorer.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a Java agent version selector to the Java agent Configuration Builder page header, wiring it through to instrumentation registry fetching and YAML preview generation, and removes the superseded “latest agent version” hook.

Changes:

  • Add an “Agent” version selector alongside the existing schema selector and plumb the selected agent version through the builder.
  • Refetch Java agent instrumentation registry data when the agent version changes and reflect the selection in the YAML preview header.
  • Remove useLatestJavaAgentVersion (and its unit test) and update PreviewCard to accept the agent version as an explicit prop; add an integration test for the new selector behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
ecosystem-explorer/src/test/integration/configuration-builder-instrumentation-version.integration.test.tsx New integration coverage for agent version selector + refetch + YAML header behavior.
ecosystem-explorer/src/hooks/use-latest-java-agent-version.ts Removed now-unneeded hook that derived the latest Java agent version implicitly.
ecosystem-explorer/src/hooks/use-latest-java-agent-version.test.ts Removed unit test for the deleted hook.
ecosystem-explorer/src/features/java-agent/configuration/configuration-builder-page.tsx Adds agent selector state, passes javaAgentVersion into instrumentation registry lookups and preview rendering.
ecosystem-explorer/src/features/java-agent/configuration/components/preview-card.tsx Makes the agent version an explicit input prop to YAML generation (instead of reading it via a hook).
ecosystem-explorer/src/features/java-agent/configuration/components/preview-card.test.tsx Updates tests for the new PreviewCard prop and adds coverage for a non-latest agent version.
Comments suppressed due to low confidence (2)

ecosystem-explorer/src/test/integration/configuration-builder-instrumentation-version.integration.test.tsx:63

  • This interaction is coupled to a specific fixture version (selecting "2.26.1") and to a specific rendering string ("2 versions"). Since integration tests read from public/data/javaagent/**, these assumptions can break whenever the registry data changes. Consider selecting a non-latest option dynamically (e.g., pick the first option that is not latest) and asserting that some stable instrumentation-specific content changes between the two selections, rather than matching a particular count string.
    const reactorRow = (await screen.findByTestId(
      "instrumentation-row-reactor",
      {},
      { timeout: 10_000 }
    )) as HTMLElement;
    expect(within(reactorRow).getByText("2 versions")).toBeInTheDocument();

    await user.selectOptions(agent, "2.26.1");

ecosystem-explorer/src/test/integration/configuration-builder-instrumentation-version.integration.test.tsx:119

  • expect(localStorage.length).toBe(0) makes this test sensitive to any other feature that might legitimately write to localStorage during render (e.g., theme, feature flags, router state). To keep the test focused on agent-version persistence, it would be more robust to only assert that the agent selector resets to the latest value after remount, without asserting the entire localStorage is empty.
    unmount();
    expect(localStorage.length).toBe(0);

Comment on lines +110 to +123
it("does not persist the Agent selection — remount resets to latest with empty localStorage", async () => {
const { unmount } = renderPage();
const user = userEvent.setup();
const agent = await findAgentSelector();
await user.selectOptions(agent, "2.26.1");
expect(agent.value).toBe("2.26.1");

unmount();
expect(localStorage.length).toBe(0);

renderPage();
const reloaded = await findAgentSelector();
expect(reloaded.value).toBe("2.27.0");
});
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.

The schema selector on the same page doesn't persist either, both default to latest. Avoids the stale-config case where someone reopens the builder weeks later and silently targets an old agent.

@jaydeluca jaydeluca added this pull request to the merge queue May 18, 2026
Merged via the queue into open-telemetry:main with commit f3e44c9 May 18, 2026
14 checks passed
@lucacavenaghi97 lucacavenaghi97 deleted the feat/475-java-agent-version-selector branch May 18, 2026 16:34
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.

Add Java agent version selector to the Configuration Builder Instrumentation tab

3 participants