Azure: Add support for custom namespace and custom metrics variable queries (#99279)

* Add custom metric namespace and metric name queries

* Fix outdated type

* Support specifying custom

- Add custom support to getMetricNamespaces
- Ensure the customNamespace is specified in getMetricNames calls

* Update data source tests

* Support custom namespace/metrics variable queries

- Add tests

* Add fields to variable editor

- Update tests
- Update docs
- Update selectors

* Remove unneeded Promise.resolve

* Add comment

* Don't mutate expected path

* Lint

* Update docs/sources/datasources/azure-monitor/template-variables/index.md

Co-authored-by: Larissa Wandzura <126723338+lwandz13@users.noreply.github.com>

* Update docs/sources/datasources/azure-monitor/template-variables/index.md

Co-authored-by: Larissa Wandzura <126723338+lwandz13@users.noreply.github.com>

* Update docs

* Update conditionals

* Lint

---------

Co-authored-by: Larissa Wandzura <126723338+lwandz13@users.noreply.github.com>
This commit is contained in:
Andreas Christou
2025-01-27 15:53:00 +00:00
committed by GitHub
co-authored by Larissa Wandzura
parent c6ba0910b4
commit e01d8ad5b5
14 changed files with 394 additions and 39 deletions
@@ -48,19 +48,24 @@ For an introduction to templating and template variables, refer to the [Templati
You can specify these Azure Monitor data source queries in the Variable edit view's **Query Type** field.
| Name | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------------ |
| **Subscriptions** | Returns subscriptions. |
| **Resource Groups** | Returns resource groups for a specified. Supports multi-value. subscription. |
| **Namespaces** | Returns metric namespaces for the specified subscription and resource group. |
| **Regions** | Returns regions for the specified subscription |
| **Resource Names** | Returns a list of resource names for a specified subscription, resource group and namespace. Supports multi-value. |
| **Metric Names** | Returns a list of metric names for a resource. |
| **Workspaces** | Returns a list of workspaces for the specified subscription. |
| **Logs** | Use a KQL query to return values. |
| **Resource Graph** | Use an ARG query to return values. |
| Name | Description |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------ |
| **Subscriptions** | Returns subscriptions. |
| **Resource Groups** | Returns resource groups for a specified. Supports multi-value. subscription. |
| **Namespaces** | Returns metric namespaces for the specified subscription and resource group. |
| **Regions** | Returns regions for the specified subscription |
| **Resource Names** | Returns a list of resource names for a specified subscription, resource group and namespace. Supports multi-value. |
| **Metric Names** | Returns a list of metric names for a resource. |
| **Workspaces** | Returns a list of workspaces for the specified subscription. |
| **Logs** | Use a KQL query to return values. |
| **Custom Namespaces** | Returns metric namespaces for the specified resource. |
| **Custom Metric Names** | Returns a list of custom metric names for the specified resource. |
Any Log Analytics Kusto Query Language (KQL) query that returns a single list of values can also be used in the Query field.
{{< admonition type="note" >}}
Custom metrics cannot be emitted against a subscription or resource group. Select resources only when you need to retrieve custom metric namespaces or custom metric names associated with a specific resource.
{{< /admonition >}}
You can use any Log Analytics Kusto Query Language (KQL) query that returns a single list of values in the `Query` field.
For example:
| Query | List of values returned |