Skip to content

Conversation

@aangelisc
Copy link
Contributor

@aangelisc aangelisc commented Aug 12, 2025

What is this feature?

Major improvements to the Azure resource picker used for metrics, logs, and traces query types.

This PR introduces filters for the subscription, resource type, and resource location. This change allows users with large Azure estates to more effectively find the resources they would like to query.

Things worth noting:

  • The changes are behind the feature toggle azureResourcePickerUpdates which is disabled by default.
  • The filters are applied to the getSubscriptions, getResourceGroups, and getResourceNames functions. When filters are applied the containing subscription and resource group will still be returned to preserve the hierarchical display.
  • Recent resources that a user has queried are now stored for each query type. A maximum of 30 resources are stored for each type. The recent resources are accessible via a tabbed view and multiple resources can be selected.
  • A minor improvement has been made to the size of the resource picker modal to improve the user experience. It is now ~ twice the size.
  • Tests have been added across the board for the new functionality and old missing tests have been added where necessary.
image image

Why do we need this feature?

To improve the UX for Azure users with large Azure estates.

Who is this feature for?

Users of Azure Monitor.

Which issue(s) does this PR fix?:

Closes #108925
Closes #108927
Closes #108928
Closes #108931
Closes #108932
Part of #99467

Special notes for your reviewer:

Please check that:

  • It works as expected from a user's perspective.
  • If this is a pre-GA feature, it is behind a feature toggle.
  • The docs are updated, and if this is a notable improvement, it's added to our What's New doc.

@github-actions
Copy link
Contributor

Since you've added the Add to what's new label, consider drafting a What's new note for this feature.

1 similar comment
@github-actions
Copy link
Contributor

Since you've added the Add to what's new label, consider drafting a What's new note for this feature.

@github-actions github-actions bot added type/docs Flags the technical writing team for documentation support; auto adds to org-wide docs project area/backend area/frontend labels Aug 12, 2025
@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 12, 2025

💻 Deploy preview deleted.

@adamyeats adamyeats moved this from Incoming to In Progress in Partner Datasources Aug 13, 2025
# Conflicts:
#	packages/grafana-data/src/types/featureToggles.gen.ts
#	pkg/services/featuremgmt/registry.go
#	pkg/services/featuremgmt/toggles_gen.csv
#	pkg/services/featuremgmt/toggles_gen.go
* Create feature toggle

* Fix namespace typo

* Retrieving default subscription ID

* Style updates

- Filter input styling
- Improved modal styling

* Pass data source to resource field

* Search style updates

* Function to support fetching filtered rows

* Filtering nested rows

* Filtering search

* Support subscriptions filtering

- Support filtering in resource graph functions
- Subscriptions filter component

* getSubscriptions tests

* Fix logs query editor test

* Update data source mock

* Update resourcePickerData tests

* Update tests, lint, and i18n

* Lint and test

* Simplify type
* Create feature toggle

* Fix namespace typo

* Retrieving default subscription ID

* Style updates

- Filter input styling
- Improved modal styling

* Pass data source to resource field

* Search style updates

* Function to support fetching filtered rows

* Filtering nested rows

* Filtering search

* Support subscriptions filtering

- Support filtering in resource graph functions
- Subscriptions filter component

* getSubscriptions tests

* Fix logs query editor test

* Update data source mock

* Update resourcePickerData tests

* Add types filter

* Update tests, lint, and i18n

* Lint and test

* Simplify type

* Rename variable for clarity
* Create feature toggle

* Fix namespace typo

* Retrieving default subscription ID

* Style updates

- Filter input styling
- Improved modal styling

* Pass data source to resource field

* Search style updates

* Function to support fetching filtered rows

* Filtering nested rows

* Filtering search

* Support subscriptions filtering

- Support filtering in resource graph functions
- Subscriptions filter component

* getSubscriptions tests

* Fix logs query editor test

* Update data source mock

* Update resourcePickerData tests

* Add types filter

* Locations filter

* Update tests, lint, and i18n

* Minor test updates

* Imports

* Lint and test

* Simplify type

* Rename variable for clarity

* Rename var
* Create feature toggle

* Fix namespace typo

* Retrieving default subscription ID

* Style updates

- Filter input styling
- Improved modal styling

* Pass data source to resource field

* Search style updates

* Function to support fetching filtered rows

* Filtering nested rows

* Filtering search

* Support subscriptions filtering

- Support filtering in resource graph functions
- Subscriptions filter component

* getSubscriptions tests

* Fix logs query editor test

* Update data source mock

* Update resourcePickerData tests

* Add types filter

* Locations filter

* Update tests, lint, and i18n

* Minor test updates

* Imports

* Lint and test

* Resource picker filter tests

* Update tests

* Simplify type

* Rename variable for clarity

* Rename var
* Create feature toggle

* Fix namespace typo

* Retrieving default subscription ID

* Style updates

- Filter input styling
- Improved modal styling

* Pass data source to resource field

* Search style updates

* Function to support fetching filtered rows

* Filtering nested rows

* Filtering search

* Support subscriptions filtering

- Support filtering in resource graph functions
- Subscriptions filter component

* getSubscriptions tests

* Fix logs query editor test

* Update data source mock

* Update resourcePickerData tests

* Add types filter

* Locations filter

* Update tests, lint, and i18n

* Minor test updates

* Imports

* Lint and test

* Resource picker filter tests

* Update tests

* Event for filter usage

* Function to support local storage

* Recent resources view

- Add LocalStorageValueProvider to store recent resources
- Add tabbed view to support switching between recent resources and resource picker
- Extract the base resource picker out to a functional component for reusability
- Extract the base resource table out to a functional component for reusability

* Update i18n keys

* Export resource key

* Add no recent resources text

* Run legacy tests with feature toggle off

* Add filters test without feature toggle

* Don't use as type assertions

* Add tests for recent resources

* Store resources for each query type

* i18n-extract

* Simplify type

* Minor performance improvement

* Rename variable for clarity

* Rename var

* Add placeholders
@grafana-pr-automation grafana-pr-automation bot added the levitate breaking change A label indicating a breaking change and assigned by Levitate. label Aug 26, 2025
@grafana-pr-automation grafana-pr-automation bot requested review from a team and removed request for a team August 26, 2025 10:52
@grafana-pr-automation grafana-pr-automation bot removed the levitate breaking change A label indicating a breaking change and assigned by Levitate. label Aug 26, 2025
@aangelisc aangelisc marked this pull request as ready for review August 28, 2025 14:09
@aangelisc aangelisc requested review from a team and grafanabot as code owners August 28, 2025 14:09
@aangelisc aangelisc requested review from adamyeats, alyssajoyner, beejeebus, bossinc and zoesyc and removed request for a team August 28, 2025 14:09
@github-actions github-actions bot added this to the 12.2.x milestone Aug 28, 2025
* Minor simplifying refactor

* Add more tests
Copy link
Contributor

@adamyeats adamyeats left a comment

Choose a reason for hiding this comment

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

LGTM, will let you make the decision on what to do with my comment, but would recommend taking a look.

if (selection.resourceGroup && !findRow(resources, resourceGroupURI)) {
const resourceGroups = await this.getResourceGroupsBySubscriptionId(selection.subscription, type);
resources = addResources(resources, `/subscriptions/${selection.subscription}`, resourceGroups);
let resources = subscriptions;
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this was here before you updated it here, but I'd encourage you to refactor this section. The mutation of the resources variable asynchronously inside the map here is an anti-pattern and a bug waiting to happen.

# Conflicts:
#	packages/grafana-data/src/types/featureToggles.gen.ts
#	pkg/services/featuremgmt/registry.go
#	pkg/services/featuremgmt/toggles_gen.csv
#	pkg/services/featuremgmt/toggles_gen.go
@aangelisc aangelisc merged commit 1a8d253 into main Sep 2, 2025
187 of 189 checks passed
@aangelisc aangelisc deleted the andreas/resource-picker-updates branch September 2, 2025 10:02
@github-project-automation github-project-automation bot moved this from In Progress to Done in Partner Datasources Sep 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add to changelog add to what's new area/backend area/frontend datasource/Azure Azure Monitor Datasource effort/large no-backport Skip backport of PR type/docs Flags the technical writing team for documentation support; auto adds to org-wide docs project type/feature-request

Projects

Status: Done

2 participants