New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Azure Monitor: Fix migration issue with MetricDefinitionsQuery template variable query types #55262
Changes from 3 commits
7683de4
55a8be3
30757ab
ce385b9
a5f2401
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -258,7 +258,7 @@ const migrateGrafanaTemplateVariableFn = (query: AzureMonitorQuery) => { | |
return query; | ||
} | ||
|
||
const migratedQuery: AzureMonitorQuery = { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this can still be a const? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed, I thought I had to change it when I had the |
||
let migratedQuery: AzureMonitorQuery = { | ||
...query, | ||
}; | ||
if ('subscription' in grafanaTemplateVariableFn) { | ||
|
@@ -287,6 +287,9 @@ const migrateGrafanaTemplateVariableFn = (query: AzureMonitorQuery) => { | |
case 'MetricNamespaceQuery': | ||
migratedQuery.queryType = AzureQueryType.NamespacesQuery; | ||
break; | ||
case 'MetricDefinitionsQuery': | ||
migratedQuery.queryType = AzureQueryType.NamespacesQuery; | ||
break; | ||
case 'MetricNamesQuery': | ||
migratedQuery.queryType = AzureQueryType.MetricNamesQuery; | ||
break; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,13 @@ export interface MetricNamespaceQuery extends BaseGrafanaTemplateVariableQuery { | |
metricNamespace?: string; | ||
resourceName?: string; | ||
} | ||
export interface MetricDefinitionsQuery extends BaseGrafanaTemplateVariableQuery { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point |
||
kind: 'MetricDefinitionsQuery'; | ||
subscription: string; | ||
resourceGroup: string; | ||
metricNamespace?: string; | ||
resourceName?: string; | ||
} | ||
export interface MetricNamesQuery extends BaseGrafanaTemplateVariableQuery { | ||
kind: 'MetricNamesQuery'; | ||
subscription: string; | ||
|
@@ -62,6 +69,7 @@ export type GrafanaTemplateVariableQuery = | |
| ResourceGroupsQuery | ||
| ResourceNamesQuery | ||
| MetricNamespaceQuery | ||
| MetricDefinitionsQuery | ||
| MetricNamesQuery | ||
| WorkspacesQuery | ||
| UnknownQuery; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually it's good to leave these queries as the "old" way to check if we break migrations but for this case I guess it's okay to update them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it did not help us spot that we did break migrations ;)
I would rather update them in case someone uses them as template to create another curated dashboard.
But we could leave one (not importable) and use it in the tests...
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, it's not automated so it's difficult to catch errors ... but it's helpful to reproduce issues :) anyway I also get your point for people using these as templates so it's also fine to update them.