diff --git a/pkg/otelcollector/consts/consts.go b/pkg/otelcollector/consts/consts.go index dba9e65ac1..22250791ab 100644 --- a/pkg/otelcollector/consts/consts.go +++ b/pkg/otelcollector/consts/consts.go @@ -87,10 +87,14 @@ const ( ApertureFlowStatusOK = "OK" // ApertureFlowStatusError const for error status. ApertureFlowStatusError = "Error" - // ApertureCacheLookupStatusLabel describes status of the cache lookup. - ApertureCacheLookupStatusLabel = "aperture.cache_lookup_status" - // ApertureCacheOperationStatusLabel describes status of the cache operation. - ApertureCacheOperationStatusLabel = "aperture.cache_operation_status" + // ApertureResultCacheLookupStatusLabel describes status of the cache lookup. + ApertureResultCacheLookupStatusLabel = "aperture.cache_lookup_status" + // ApertureResultCacheOperationStatusLabel describes status of the cache operation. + ApertureResultCacheOperationStatusLabel = "aperture.cache_operation_status" + // ApertureGlobalCacheLookupStatusLabel describes status of the cache lookup. + ApertureGlobalCacheLookupStatusLabel = "aperture.global_cache_lookup_status" + // ApertureGlobalCacheOperationStatusLabel describes status of the cache operation. + ApertureGlobalCacheOperationStatusLabel = "aperture.global_cache_operation_status" /* HTTP Specific labels. */ diff --git a/pkg/otelcollector/metricsprocessor/internal/check_response_labels.go b/pkg/otelcollector/metricsprocessor/internal/check_response_labels.go index cba8becea2..d57648e717 100644 --- a/pkg/otelcollector/metricsprocessor/internal/check_response_labels.go +++ b/pkg/otelcollector/metricsprocessor/internal/check_response_labels.go @@ -59,10 +59,19 @@ func AddCheckResponseBasedLabels(attributes pcommon.Map, checkResponse *flowcont ) // Cache - if checkResponse.CacheLookupResponse != nil && checkResponse.CacheLookupResponse.ResultCacheResponse != nil { - resultCacheResponse := checkResponse.CacheLookupResponse.ResultCacheResponse - attributes.PutStr(otelconsts.ApertureCacheLookupStatusLabel, resultCacheResponse.LookupStatus.String()) - attributes.PutStr(otelconsts.ApertureCacheOperationStatusLabel, resultCacheResponse.OperationStatus.String()) + if checkResponse.CacheLookupResponse != nil { + if checkResponse.CacheLookupResponse.ResultCacheResponse != nil { + resultCacheResponse := checkResponse.CacheLookupResponse.ResultCacheResponse + attributes.PutStr(otelconsts.ApertureResultCacheLookupStatusLabel, resultCacheResponse.LookupStatus.String()) + attributes.PutStr(otelconsts.ApertureResultCacheOperationStatusLabel, resultCacheResponse.OperationStatus.String()) + } + for _, globalCacheResponse := range checkResponse.CacheLookupResponse.GlobalCacheResponses { + if globalCacheResponse == nil { + continue + } + attributes.PutStr(otelconsts.ApertureGlobalCacheLookupStatusLabel, globalCacheResponse.LookupStatus.String()) + attributes.PutStr(otelconsts.ApertureGlobalCacheOperationStatusLabel, globalCacheResponse.OperationStatus.String()) + } } // Note: Sorted alphabetically to help sorting attributes in rollupprocessor.key at least a bit. diff --git a/pkg/otelcollector/metricsprocessor/internal/labels_filter.go b/pkg/otelcollector/metricsprocessor/internal/labels_filter.go index 273a104197..c4b756dca7 100644 --- a/pkg/otelcollector/metricsprocessor/internal/labels_filter.go +++ b/pkg/otelcollector/metricsprocessor/internal/labels_filter.go @@ -40,8 +40,10 @@ var ( otelconsts.ResponseReceivedLabel, otelconsts.ApertureSourceServiceLabel, otelconsts.ApertureDestinationServiceLabel, - otelconsts.ApertureCacheLookupStatusLabel, - otelconsts.ApertureCacheOperationStatusLabel, + otelconsts.ApertureResultCacheLookupStatusLabel, + otelconsts.ApertureResultCacheOperationStatusLabel, + otelconsts.ApertureGlobalCacheLookupStatusLabel, + otelconsts.ApertureGlobalCacheOperationStatusLabel, } _includeAttributesHTTP = []string{