Skip to content

Commit 18f96c0

Browse files
committed
canonicalize azure locations
Signed-off-by: Markus Blaschke <mblaschke82@gmail.com>
1 parent d995ee2 commit 18f96c0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

loganalytics/misc.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ func ParamsGetListRequired(params url.Values, name string) (list []string, err e
2323

2424
return
2525
}
26+
27+
// canonicalizeAzureLocation tries to get canonicalized azure location names
28+
func canonicalizeAzureLocation(val string) string {
29+
val = strings.ToLower(val)
30+
// transform "west europe" into "westeurope"
31+
val = strings.ReplaceAll(val, " ", "")
32+
return val
33+
}

loganalytics/prober.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ func (p *LogAnalyticsProber) translateWorkspaceIntoConfig(val string) WorkspaceC
174174
workspaceConfig.Labels["workspaceResourceID"] = strings.ToLower(workspaceConfig.ResourceID)
175175
workspaceConfig.Labels["workspaceResourceGroup"] = strings.ToLower(resourceInfo.ResourceGroup)
176176
workspaceConfig.Labels["workspaceResourceName"] = strings.ToLower(resourceInfo.ResourceName)
177-
workspaceConfig.Labels["workspaceLocation"] = strings.ToLower(to.String(workspaceResource.Location))
177+
workspaceConfig.Labels["workspaceLocation"] = canonicalizeAzureLocation(to.String(workspaceResource.Location))
178178

179179
// add custom labels
180180
workspaceConfig.Labels = p.tagManagerConfig.AddResourceTagsToPrometheusLabels(

0 commit comments

Comments
 (0)