diff --git a/README.md b/README.md index 6f51d8a6..70bfb43d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you are running Grafana on a machine instance in Oracle Cloud, use the Instan If you are running Grafana anywhere else you'll need to get the necessary provider and resource settings, as described in this section [Getting OCI Configuration values](https://github.com/oracle/oci-grafana-plugin/blob/master/docs/linux.md#getting-oci-configuration-values) -Latest plugin version 5.X.X (available on [Grafana Marketplace](https://grafana.com/grafana/plugins/oci-metrics-datasource/)) is compatible with **Grafana 10**. +Latest plugin version 6.5.X (available on [Grafana Marketplace](https://grafana.com/grafana/plugins/oci-metrics-datasource/)) is compatible with **Grafana 10**. **Breaking changes:** - In case you are migrating from a previous version (3.x.x or below) of the OCI Metrics Grafana Plugin and are not using Instance Principals (Environment not set as OCI instance), please refer to the [**Migration Instructions for Grafana OCI Metrics Data Source Settings (User Principals and Single Tenancy mode only)**](https://github.com/oracle/oci-grafana-metrics/blob/master/docs/migration.md) because you will have to reconfigure the plugin setup diff --git a/pkg/plugin/metrics_functions.go b/pkg/plugin/metrics_functions.go index ea47f48e..daf7c070 100644 --- a/pkg/plugin/metrics_functions.go +++ b/pkg/plugin/metrics_functions.go @@ -316,6 +316,14 @@ func (o *OCIDatasource) GetCompartments(ctx context.Context, tenancyOCID string, takey := o.GetTenancyAccessKey(tenancyOCID) + region, regErr := o.tenancyAccess[takey].config.Region() + if regErr != nil { + backend.Logger.Error("client", "GetCompartments", "error retrieving default region") + return nil + } + reg := common.StringToRegion(region) + o.tenancyAccess[takey].monitoringClient.SetRegion(string(reg)) + tenancyocid, tenancyErr := o.FetchTenancyOCID(takey) if tenancyErr != nil { backend.Logger.Warn("client", "GetSubscribedRegions", tenancyErr) @@ -505,6 +513,9 @@ func (o *OCIDatasource) GetNamespaceWithMetricNames( o.GetSubscribedRegions(ctx, tenancyOCID), ) } else { + if region != "" { + o.tenancyAccess[takey].monitoringClient.SetRegion(region) + } namespaceWithMetricNames = listMetricsMetadataPerRegion( ctx, o.cache, @@ -1167,6 +1178,10 @@ func (o *OCIDatasource) GetResourceGroups( o.GetSubscribedRegions(ctx, tenancyOCID), ) } else { + if region != "" { + o.tenancyAccess[takey].monitoringClient.SetRegion(region) + } + metricResourceGroups = listMetricsMetadataPerRegion( ctx, o.cache, @@ -1284,6 +1299,9 @@ func (o *OCIDatasource) GetDimensions( o.GetSubscribedRegions(ctx, tenancyOCID), ) } else { + if region != "" { + o.tenancyAccess[takey].monitoringClient.SetRegion(region) + } metricDimensions = listMetricsMetadataPerRegion( ctx, o.cache, diff --git a/pkg/plugin/utils.go b/pkg/plugin/utils.go index a43bb8d8..fc9a2220 100644 --- a/pkg/plugin/utils.go +++ b/pkg/plugin/utils.go @@ -104,6 +104,7 @@ func listMetricsMetadataFromAllRegion( for _, subscribedRegion := range regions { if subscribedRegion != constants.ALL_REGION { + mClient.SetRegion(subscribedRegion) wg.Add(1) go func(mc monitoring.MonitoringClient, sRegion string) { defer wg.Done() diff --git a/src/plugin.json b/src/plugin.json index ee34c5b5..68581f77 100644 --- a/src/plugin.json +++ b/src/plugin.json @@ -23,8 +23,8 @@ }, { "name": "UPL", "url": "https://oss.oracle.com/licenses/upl" } ], - "version": "6.5.2", - "updated": "2025-07-15", + "version": "6.5.3", + "updated": "2025-10-01", "screenshots":[ { "name":"OCI Metrics Dashboard",