Skip to content

Conversation

laserninja
Copy link

@laserninja laserninja commented Jul 17, 2025

Add support for X-Trino-Client-Tags header

Description

This PR adds support for the X-Trino-Client-Tags header in the Grafana Trino datasource plugin. The X-Trino-Client-Tags header is part of the official Trino client protocol and allows sending a comma-separated list of tag strings to identify Trino resource groups, which is useful for resource management and query monitoring.

How to Use

  1. Navigate to the Trino datasource configuration page in Grafana
  2. In the "Trino" section, find the "Client tags" field
  3. Enter a comma-separated list of tags (e.g., grafana,dashboard,analytics)
  4. Save the configuration

The tags will be automatically sent with every query to help Trino administrators identify and manage resource usage from different client sources.

Technical Details

  • The X-Trino-Client-Tags header is only sent when client tags are configured (optional field)
  • Tags are stored as a comma-separated string in the datasource configuration
  • No breaking changes - existing configurations will continue to work unchanged

Testing

  • Go backend builds successfully
  • Frontend TypeScript compiles without errors
  • All existing functionality remains intact
  • New feature is optional and doesn't affect existing setups

References

Copy link

cla-bot bot commented Jul 17, 2025

Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to [email protected]. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla

@laserninja laserninja marked this pull request as ready for review July 26, 2025 03:46
@cla-bot cla-bot bot added the cla-signed label Jul 26, 2025
@laserninja laserninja marked this pull request as draft July 28, 2025 15:50
@laserninja laserninja marked this pull request as ready for review July 29, 2025 05:06
@harksin
Copy link

harksin commented Aug 12, 2025

Realy usefull ! is it planned to release this soon ?

@jaleed-sudo
Copy link

Good job !
I also need this PR
Do you have a release date for this PR ?

async function setupDataSourceWithAccessToken(page: Page) {
await page.getByTestId('data-testid Datasource HTTP settings url').fill('http://trino:8080');
await page.locator('div').filter({hasText: /^Impersonate logged in userAccess token$/}).getByLabel('Toggle switch').click();
await page.locator('#trino-settings-enable-impersonation').click({ force: true });

Choose a reason for hiding this comment

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

Why is it in the same pr? is it related to the client tags?

Copy link
Author

Choose a reason for hiding this comment

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

The CI tests were failing so I just fixed it here. Should I revert it?

Choose a reason for hiding this comment

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

In my opinion it should be a separated pr, taging a contributor that had merged pr recently. @nineinchnick

Copy link
Author

Choose a reason for hiding this comment

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

How do I fix the failing unit tests then?

Copy link
Author

Choose a reason for hiding this comment

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

yes, @nineinchnick let me know if I should create a new MR for this minor fix

Copy link
Member

Choose a reason for hiding this comment

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

That would be ideal, but also see #303 where I'm trying to refactor tests to run on the latest and newest supported Grafana versions. This is required for publishing a new release, but I'm blocked there since I don't know Playwright.

Copy link
Author

Choose a reason for hiding this comment

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

#318
I also don't know Playwright. I can take a look using Copilot if there is no one else to take a look.

@RoeyoOgen
Copy link

@laserninja pls address

laserninja and others added 2 commits September 20, 2025 23:00
Co-authored-by: Rotem Albukrek <[email protected]>
Co-authored-by: Rotem Albukrek <[email protected]>
async function setupDataSourceWithAccessToken(page: Page) {
await page.getByTestId('data-testid Datasource HTTP settings url').fill('http://trino:8080');
await page.locator('div').filter({hasText: /^Impersonate logged in userAccess token$/}).getByLabel('Toggle switch').click();
await page.locator('#trino-settings-enable-impersonation').click({ force: true });

Choose a reason for hiding this comment

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

In my opinion it should be a separated pr, taging a contributor that had merged pr recently. @nineinchnick

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

Successfully merging this pull request may close these issues.

6 participants