Skip to content

Conversation

@johallar
Copy link
Contributor

@johallar johallar commented Oct 30, 2025

Description

With many flavors of presto, it has become more important to be able to identify which flavor is running. As a first step, a generic "cluster tag" approach was decided upon to allow this.

Motivation and Context

Allow presto users to tag a cluster for easy identification from the UI, eg. Worker type: Java, C++, GPU

Impact

With and without a cluster tag configured:

Screenshot 2025-10-30 at 12 02 34 PM Screenshot 2025-10-30 at 12 05 42 PM

Test Plan

  1. Do not set the cluster tag config flag. Confirm that the UI does not display a "Tag" column.
  2. Set the config flag to any string value, confirm that the UI displays this tag in the "Tag" column
  3. Set the cluster tag config value to a very long value. Confirm that the UI handles this long value appropriately by wrapping the UI tag

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.
  • If adding new dependencies, verified they have an OpenSSF Scorecard score of 5.0 or higher (or obtained explicit TSC approval for lower scores).

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

General Changes
* Add a configurable `clusterTag` config flag, which is returned from the `/v1/cluster` endpoints and displayed in the UI.


@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 30, 2025

Reviewer's Guide

Introduce a new clusterTag config flag, propagate it through the server’s ClusterStats API and Thrift model, and update the UI to fetch and display the tag in the navbar with supporting CSS utilities.

Sequence diagram for fetching and displaying cluster tag in the UI

sequenceDiagram
    participant User as actor User
    participant UI as Presto UI (PageTitle.jsx)
    participant Server as Presto Server (/v1/cluster)
    User->>UI: Load page
    UI->>Server: GET /v1/cluster
    Server-->>UI: { ..., clusterTag: "..." }
    UI-->>User: Display clusterTag in navbar if present
Loading

Entity relationship diagram for clusterTag propagation

erDiagram
    SERVER_CONFIG ||--o{ CLUSTER_STATS : provides
    CLUSTER_STATS {
        string clusterTag
    }
    SERVER_CONFIG {
        string clusterTag
    }
Loading

Class diagram for updated ClusterStats and ServerConfig classes

classDiagram
    class ServerConfig {
        +String clusterTag
        +String getClusterTag()
        +ServerConfig setClusterTag(String)
    }
    class ClusterStats {
        +String clusterTag
        +getClusterTag()
    }
    ServerConfig <.. ClusterStats : provides clusterTag
Loading

File-Level Changes

Change Details Files
Add clusterTag config property and expose via ClusterStats endpoints
  • Introduce clusterTag field in ServerConfig with @config binding
  • Bind ServerConfig in ServerMainModule
  • Pass clusterTag into ClusterStatsResource and DistributedClusterStatsResource constructors
  • Extend ClusterStats model and JSON/Thrift serialization to include clusterTag
  • Update TestThriftClusterStats to validate clusterTag round-trip
presto-main-base/src/main/java/com/facebook/presto/server/ServerConfig.java
presto-main/src/main/java/com/facebook/presto/server/ServerMainModule.java
presto-main/src/main/java/com/facebook/presto/server/ClusterStatsResource.java
presto-main/src/main/java/com/facebook/presto/resourcemanager/DistributedClusterStatsResource.java
presto-main/src/test/java/com/facebook/presto/server/TestThriftClusterStats.java
Fetch and render clusterTag in Presto UI navbar
  • Add clusterTag state and fetch effect in PageTitle.jsx
  • Conditionally render a Tag column with a truncated badge in the navbar
  • Adjust navbar layout (gaps, flex properties) for responsive display
presto-ui/src/components/PageTitle.jsx
Introduce CSS utilities for layout and badge truncation
  • Add .min-width-0, .flex-basis-20/40 utility classes
  • Define .truncated-badge to handle long tag strings
  • Adjust .navbar-cluster-info padding
presto-ui/src/static/assets/presto.css

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@johallar
Copy link
Contributor Author

@tdcmeehan WIP as a step 1, lemme know if this is in line with what you were envisioning

steveburnett
steveburnett previously approved these changes Oct 30, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull branch, local doc build, looks good. Thanks!

@tdcmeehan
Copy link
Contributor

@tdcmeehan WIP as a step 1, lemme know if this is in line with what you were envisioning

This is almost exactly what I had in mind!

@johallar johallar force-pushed the cluster_tag_config_flag branch from d0f2926 to fbe9923 Compare November 7, 2025 18:02
@johallar johallar marked this pull request as ready for review November 12, 2025 16:35
@johallar johallar requested review from a team, elharo and yhwang as code owners November 12, 2025 16:35
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `presto-ui/src/components/PageTitle.jsx:225-235` </location>
<code_context>
+                            {clusterTag && (
</code_context>

<issue_to_address>
**suggestion (bug_risk):** Check for empty string or whitespace-only clusterTag before rendering.

The current check allows empty or whitespace-only clusterTag values, resulting in unnecessary rendering. Please trim clusterTag and ensure it is not empty before rendering.

```suggestion
{clusterTag && clusterTag.trim() !== "" && (
    <li key="cluster-tag" className="min-width-0 flex-shrink-0">
        <div className="navbar-cluster-info">
            <div className="uppercase">Tag</div>
            <div className="text" title="Cluster Tag">
                <span
                    title={clusterTag}
                    className="badge bg-secondary truncated-badge d-inline-block"
                >
                    {clusterTag}
                </span>
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +225 to +235
{clusterTag && (
<li key="cluster-tag" className="min-width-0 flex-shrink-0">
<div className="navbar-cluster-info">
<div className="uppercase">Tag</div>
<div className="text" title="Cluster Tag">
<span
title={clusterTag}
className="badge bg-secondary truncated-badge d-inline-block"
>
{clusterTag}
</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (bug_risk): Check for empty string or whitespace-only clusterTag before rendering.

The current check allows empty or whitespace-only clusterTag values, resulting in unnecessary rendering. Please trim clusterTag and ensure it is not empty before rendering.

Suggested change
{clusterTag && (
<li key="cluster-tag" className="min-width-0 flex-shrink-0">
<div className="navbar-cluster-info">
<div className="uppercase">Tag</div>
<div className="text" title="Cluster Tag">
<span
title={clusterTag}
className="badge bg-secondary truncated-badge d-inline-block"
>
{clusterTag}
</span>
{clusterTag && clusterTag.trim() !== "" && (
<li key="cluster-tag" className="min-width-0 flex-shrink-0">
<div className="navbar-cluster-info">
<div className="uppercase">Tag</div>
<div className="text" title="Cluster Tag">
<span
title={clusterTag}
className="badge bg-secondary truncated-badge d-inline-block"
>
{clusterTag}
</span>

yhwang
yhwang previously approved these changes Nov 13, 2025
Copy link
Member

@yhwang yhwang left a comment

Choose a reason for hiding this comment

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

The UX changes look good to me
Good enhancement.

@yhwang
Copy link
Member

yhwang commented Nov 13, 2025

One question for the tag:
Would it be possible that we may want to expand the tag to tags? I guess in that case, we probably can use a dropdown list to display the list of tags.

@johallar
Copy link
Contributor Author

One question for the tag: Would it be possible that we may want to expand the tag to tags? I guess in that case, we probably can use a dropdown list to display the list of tags.

Yeah good question, I could see that being a nice improvement. Maybe worth seeing how folks use the cluster tag first? I know for our initial use case a single tag does the job, but others may be different.

Definitely UI wise we would need some kind of tooltip or dropdown, or more real estate in one way or another.

@tdcmeehan
Copy link
Contributor

LGTM, but please check the test failure, it's related.

steveburnett
steveburnett previously approved these changes Nov 19, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull branch, local doc build.

@johallar
Copy link
Contributor Author

LGTM, but please check the test failure, it's related.

@tdcmeehan Apologies, I've updated the failing tests to include the new flag. New failures seem like unrelated network errors grabbing jars. Is there an easy way to re-run?

johallar added a commit to rapidsai/velox-testing that referenced this pull request Nov 20, 2025
Adds cluster tag config to our velox-testing start scripts for java,
cpu, gpu.

Sister PR to prestodb/presto#26485, which will
display this tag in the UI so we can easily identify which type of
cluster we have created.
@steveburnett
Copy link
Contributor

LGTM, but please check the test failure, it's related.

@tdcmeehan Apologies, I've updated the failing tests to include the new flag. New failures seem like unrelated network errors grabbing jars. Is there an easy way to re-run?

Hi @johallar, I just started a re-run of failed jobs for this PR. Hope that helps!

@tdcmeehan tdcmeehan changed the title feat: Add cluster tag config and UI feat(ui): Add cluster tag Nov 20, 2025
@tdcmeehan
Copy link
Contributor

Thanks @johallar!

@tdcmeehan tdcmeehan merged commit 34bd50e into prestodb:master Nov 20, 2025
116 of 118 checks passed
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.

4 participants