|
@@ -35,6 +35,7 @@ type CustomMetricsCache struct {
|
|
|
|
|
|
|
|
var customMetricsMetricsMap map[string]map[string]map[string]*CustomMetricsCache
|
|
var customMetricsMetricsMap map[string]map[string]map[string]*CustomMetricsCache
|
|
|
var customMetricsDimensionsMap map[string]map[string]map[string]*CustomMetricsCache
|
|
var customMetricsDimensionsMap map[string]map[string]map[string]*CustomMetricsCache
|
|
|
|
|
+var regionCache sync.Map
|
|
|
|
|
|
|
|
func init() {
|
|
func init() {
|
|
|
metricsMap = map[string][]string{
|
|
metricsMap = map[string][]string{
|
|
@@ -45,6 +46,7 @@ func init() {
|
|
|
"AWS/Billing": {"EstimatedCharges"},
|
|
"AWS/Billing": {"EstimatedCharges"},
|
|
|
"AWS/CloudFront": {"Requests", "BytesDownloaded", "BytesUploaded", "TotalErrorRate", "4xxErrorRate", "5xxErrorRate"},
|
|
"AWS/CloudFront": {"Requests", "BytesDownloaded", "BytesUploaded", "TotalErrorRate", "4xxErrorRate", "5xxErrorRate"},
|
|
|
"AWS/CloudSearch": {"SuccessfulRequests", "SearchableDocuments", "IndexUtilization", "Partitions"},
|
|
"AWS/CloudSearch": {"SuccessfulRequests", "SearchableDocuments", "IndexUtilization", "Partitions"},
|
|
|
|
|
+ "AWS/Connect": {"CallsBreachingConcurrencyQuota", "CallBackNotDialableNumber", "CallRecordingUploadError", "CallsPerInterval", "ConcurrentCalls", "ConcurrentCallsPercentage", "ContactFlowErrors", "ContactFlowFatalErrors", "LongestQueueWaitTime", "MissedCalls", "MisconfiguredPhoneNumbers", "PublicSigningKeyUsage", "QueueCapacityExceededError", "QueueSize", "ThrottledCalls", "ToInstancePacketLossRate"},
|
|
|
"AWS/DMS": {"FreeableMemory", "WriteIOPS", "ReadIOPS", "WriteThroughput", "ReadThroughput", "WriteLatency", "ReadLatency", "SwapUsage", "NetworkTransmitThroughput", "NetworkReceiveThroughput", "FullLoadThroughputBandwidthSource", "FullLoadThroughputBandwidthTarget", "FullLoadThroughputRowsSource", "FullLoadThroughputRowsTarget", "CDCIncomingChanges", "CDCChangesMemorySource", "CDCChangesMemoryTarget", "CDCChangesDiskSource", "CDCChangesDiskTarget", "CDCThroughputBandwidthTarget", "CDCThroughputRowsSource", "CDCThroughputRowsTarget", "CDCLatencySource", "CDCLatencyTarget"},
|
|
"AWS/DMS": {"FreeableMemory", "WriteIOPS", "ReadIOPS", "WriteThroughput", "ReadThroughput", "WriteLatency", "ReadLatency", "SwapUsage", "NetworkTransmitThroughput", "NetworkReceiveThroughput", "FullLoadThroughputBandwidthSource", "FullLoadThroughputBandwidthTarget", "FullLoadThroughputRowsSource", "FullLoadThroughputRowsTarget", "CDCIncomingChanges", "CDCChangesMemorySource", "CDCChangesMemoryTarget", "CDCChangesDiskSource", "CDCChangesDiskTarget", "CDCThroughputBandwidthTarget", "CDCThroughputRowsSource", "CDCThroughputRowsTarget", "CDCLatencySource", "CDCLatencyTarget"},
|
|
|
"AWS/DX": {"ConnectionState", "ConnectionBpsEgress", "ConnectionBpsIngress", "ConnectionPpsEgress", "ConnectionPpsIngress", "ConnectionCRCErrorCount", "ConnectionLightLevelTx", "ConnectionLightLevelRx"},
|
|
"AWS/DX": {"ConnectionState", "ConnectionBpsEgress", "ConnectionBpsIngress", "ConnectionPpsEgress", "ConnectionPpsIngress", "ConnectionCRCErrorCount", "ConnectionLightLevelTx", "ConnectionLightLevelRx"},
|
|
|
"AWS/DynamoDB": {"ConditionalCheckFailedRequests", "ConsumedReadCapacityUnits", "ConsumedWriteCapacityUnits", "OnlineIndexConsumedWriteCapacity", "OnlineIndexPercentageProgress", "OnlineIndexThrottleEvents", "ProvisionedReadCapacityUnits", "ProvisionedWriteCapacityUnits", "ReadThrottleEvents", "ReturnedBytes", "ReturnedItemCount", "ReturnedRecordsCount", "SuccessfulRequestLatency", "SystemErrors", "TimeToLiveDeletedItemCount", "ThrottledRequests", "UserErrors", "WriteThrottleEvents"},
|
|
"AWS/DynamoDB": {"ConditionalCheckFailedRequests", "ConsumedReadCapacityUnits", "ConsumedWriteCapacityUnits", "OnlineIndexConsumedWriteCapacity", "OnlineIndexPercentageProgress", "OnlineIndexThrottleEvents", "ProvisionedReadCapacityUnits", "ProvisionedWriteCapacityUnits", "ReadThrottleEvents", "ReturnedBytes", "ReturnedItemCount", "ReturnedRecordsCount", "SuccessfulRequestLatency", "SystemErrors", "TimeToLiveDeletedItemCount", "ThrottledRequests", "UserErrors", "WriteThrottleEvents"},
|
|
@@ -119,6 +121,7 @@ func init() {
|
|
|
"AWS/Billing": {"ServiceName", "LinkedAccount", "Currency"},
|
|
"AWS/Billing": {"ServiceName", "LinkedAccount", "Currency"},
|
|
|
"AWS/CloudFront": {"DistributionId", "Region"},
|
|
"AWS/CloudFront": {"DistributionId", "Region"},
|
|
|
"AWS/CloudSearch": {},
|
|
"AWS/CloudSearch": {},
|
|
|
|
|
+ "AWS/Connect": {"InstanceId", "MetricGroup", "Participant", "QueueName", "Stream Type", "Type of Connection"},
|
|
|
"AWS/DMS": {"ReplicationInstanceIdentifier", "ReplicationTaskIdentifier"},
|
|
"AWS/DMS": {"ReplicationInstanceIdentifier", "ReplicationTaskIdentifier"},
|
|
|
"AWS/DX": {"ConnectionId"},
|
|
"AWS/DX": {"ConnectionId"},
|
|
|
"AWS/DynamoDB": {"TableName", "GlobalSecondaryIndexName", "Operation", "StreamLabel"},
|
|
"AWS/DynamoDB": {"TableName", "GlobalSecondaryIndexName", "Operation", "StreamLabel"},
|
|
@@ -233,13 +236,20 @@ func parseMultiSelectValue(input string) []string {
|
|
|
// Whenever this list is updated, frontend list should also be updated.
|
|
// Whenever this list is updated, frontend list should also be updated.
|
|
|
// Please update the region list in public/app/plugins/datasource/cloudwatch/partials/config.html
|
|
// Please update the region list in public/app/plugins/datasource/cloudwatch/partials/config.html
|
|
|
func (e *CloudWatchExecutor) handleGetRegions(ctx context.Context, parameters *simplejson.Json, queryContext *tsdb.TsdbQuery) ([]suggestData, error) {
|
|
func (e *CloudWatchExecutor) handleGetRegions(ctx context.Context, parameters *simplejson.Json, queryContext *tsdb.TsdbQuery) ([]suggestData, error) {
|
|
|
|
|
+ dsInfo := e.getDsInfo("default")
|
|
|
|
|
+ profile := dsInfo.Profile
|
|
|
|
|
+ if cache, ok := regionCache.Load(profile); ok {
|
|
|
|
|
+ if cache2, ok2 := cache.([]suggestData); ok2 {
|
|
|
|
|
+ return cache2, nil
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
regions := []string{
|
|
regions := []string{
|
|
|
"ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1",
|
|
"ap-northeast-1", "ap-northeast-2", "ap-northeast-3", "ap-south-1", "ap-southeast-1", "ap-southeast-2", "ca-central-1",
|
|
|
"eu-central-1", "eu-north-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2",
|
|
"eu-central-1", "eu-north-1", "eu-west-1", "eu-west-2", "eu-west-3", "me-south-1", "sa-east-1", "us-east-1", "us-east-2", "us-west-1", "us-west-2",
|
|
|
"cn-north-1", "cn-northwest-1", "us-gov-east-1", "us-gov-west-1", "us-isob-east-1", "us-iso-east-1",
|
|
"cn-north-1", "cn-northwest-1", "us-gov-east-1", "us-gov-west-1", "us-isob-east-1", "us-iso-east-1",
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- err := e.ensureClientSession("us-east-1")
|
|
|
|
|
|
|
+ err := e.ensureClientSession("default")
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
return nil, err
|
|
return nil, err
|
|
|
}
|
|
}
|
|
@@ -269,6 +279,7 @@ func (e *CloudWatchExecutor) handleGetRegions(ctx context.Context, parameters *s
|
|
|
for _, region := range regions {
|
|
for _, region := range regions {
|
|
|
result = append(result, suggestData{Text: region, Value: region})
|
|
result = append(result, suggestData{Text: region, Value: region})
|
|
|
}
|
|
}
|
|
|
|
|
+ regionCache.Store(profile, result)
|
|
|
|
|
|
|
|
return result, nil
|
|
return result, nil
|
|
|
}
|
|
}
|