Cloudwatch: Fix Unexpected error (#74420)
Fix unexpected error when creating a new cloudwatch datasource. Involves a fair amount of refactoring, so if this causes unexpected issues related to region fetching we can turn this off with the cloudwatchNewRegionsHandler feature toggle, although we do not predict it will so we are enabling it to default to true and hope to remove it shortly.
This commit is contained in:
@@ -15,7 +15,6 @@ import (
|
||||
|
||||
func (e *cloudWatchExecutor) newResourceMux() *http.ServeMux {
|
||||
mux := http.NewServeMux()
|
||||
mux.HandleFunc("/regions", handleResourceReq(e.handleGetRegions))
|
||||
mux.HandleFunc("/ebs-volume-ids", handleResourceReq(e.handleGetEbsVolumeIds))
|
||||
mux.HandleFunc("/ec2-instance-attribute", handleResourceReq(e.handleGetEc2InstanceAttribute))
|
||||
mux.HandleFunc("/resource-arns", handleResourceReq(e.handleGetResourceArns))
|
||||
@@ -28,6 +27,13 @@ func (e *cloudWatchExecutor) newResourceMux() *http.ServeMux {
|
||||
mux.HandleFunc("/log-group-fields", routes.ResourceRequestMiddleware(routes.LogGroupFieldsHandler, logger, e.getRequestContext))
|
||||
mux.HandleFunc("/external-id", routes.ResourceRequestMiddleware(routes.ExternalIdHandler, logger, e.getRequestContext))
|
||||
|
||||
// feature is enabled by default, just putting behind a feature flag in case of unexpected bugs
|
||||
if e.features.IsEnabled("cloudwatchNewRegionsHandler") {
|
||||
mux.HandleFunc("/regions", routes.ResourceRequestMiddleware(routes.RegionsHandler, logger, e.getRequestContext))
|
||||
} else {
|
||||
mux.HandleFunc("/regions", handleResourceReq(e.handleGetRegions))
|
||||
}
|
||||
|
||||
// remove this once AWS's Cross Account Observability is supported in GovCloud
|
||||
mux.HandleFunc("/legacy-log-groups", handleResourceReq(e.handleGetLogGroups))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user