Skip to content

Commit

Permalink
Add Global Cache OLAP telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
kwapik committed Dec 8, 2023
1 parent 6670f88 commit 0e2ecbb
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
12 changes: 8 additions & 4 deletions pkg/otelcollector/consts/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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. */

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 4 additions & 2 deletions pkg/otelcollector/metricsprocessor/internal/labels_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 0e2ecbb

Please sign in to comment.