Skip to content

Commit

Permalink
fix(logging): allow nil or custom zones in resource detection (#3997)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xSage committed May 3, 2021
1 parent dcfadaf commit aded90b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion logging/logging.go
Expand Up @@ -404,7 +404,11 @@ func monitoredResource(parent string) *mrpb.MonitoredResource {
}

func regionFromZone(zone string) string {
return zone[:strings.LastIndex(zone, "-")]
cutoff := strings.LastIndex(zone, "-")
if cutoff > 0 {
return zone[:cutoff]
}
return zone
}

func globalResource(projectID string) *mrpb.MonitoredResource {
Expand Down

0 comments on commit aded90b

Please sign in to comment.