From 65e2a448d3411b848b29d43f56439ec008803f52 Mon Sep 17 00:00:00 2001 From: Nicolas Bigler Date: Thu, 28 Dec 2023 09:42:33 +0100 Subject: [PATCH] Adjust instanceID for objectStorage to ensure uniqueness the instanceID must be unique in a single SO. Since objectstorage is billed on multiple metrics (storage, requests and trafficout) we need to adjust the instanceID to ensure it's unique for all metrics. Signed-off-by: Nicolas Bigler --- pkg/cloudscale/objectstorage.go | 6 +++--- pkg/exoscale/objectstorage.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/cloudscale/objectstorage.go b/pkg/cloudscale/objectstorage.go index d313f4d..c55e305 100644 --- a/pkg/cloudscale/objectstorage.go +++ b/pkg/cloudscale/objectstorage.go @@ -137,7 +137,7 @@ func (o *ObjectStorage) createOdooRecord(bucketMetricsData cloudscale.BucketMetr return []odoo.OdooMeteredBillingRecord{ { ProductID: productIdStorage, - InstanceID: instanceId, + InstanceID: instanceId + "/storage", ItemDescription: bucketMetricsData.Subject.BucketName, ItemGroupDescription: itemGroup, SalesOrder: salesOrder, @@ -150,7 +150,7 @@ func (o *ObjectStorage) createOdooRecord(bucketMetricsData cloudscale.BucketMetr }, { ProductID: productIdTrafficOut, - InstanceID: instanceId, + InstanceID: instanceId + "/trafficout", ItemDescription: bucketMetricsData.Subject.BucketName, ItemGroupDescription: itemGroup, SalesOrder: salesOrder, @@ -163,7 +163,7 @@ func (o *ObjectStorage) createOdooRecord(bucketMetricsData cloudscale.BucketMetr }, { ProductID: productIdQueryRequests, - InstanceID: instanceId, + InstanceID: instanceId + "/requests", ItemDescription: bucketMetricsData.Subject.BucketName, ItemGroupDescription: itemGroup, SalesOrder: salesOrder, diff --git a/pkg/exoscale/objectstorage.go b/pkg/exoscale/objectstorage.go index 8838ddc..4b25910 100644 --- a/pkg/exoscale/objectstorage.go +++ b/pkg/exoscale/objectstorage.go @@ -126,7 +126,7 @@ func (o *ObjectStorage) getOdooMeteredBillingRecords(ctx context.Context, sosBuc o := odoo.OdooMeteredBillingRecord{ ProductID: productIdStorage, - InstanceID: instanceId, + InstanceID: instanceId + "/storage", ItemDescription: bucketDetail.BucketName, ItemGroupDescription: itemGroup, SalesOrder: salesOrder,