Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cache limits for resources and attributes #509

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
292 changes: 0 additions & 292 deletions exporter/metadataexporter/cache.go

This file was deleted.

33 changes: 33 additions & 0 deletions exporter/metadataexporter/cache/cache.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package metadataexporter

import (
"context"

"go.opentelemetry.io/collector/pipeline"
)

type KeyCache interface {
// AddAttrsToResource adds attribute fingerprints for a specific resource fingerprint,
// respecting the maximum cardinalities for resource count and attributes per resource.
AddAttrsToResource(ctx context.Context, resourceFp uint64, attrFps []uint64, ds pipeline.Signal) error

// AttrsExistForResource checks which of the given attrFps exist for the given resourceFp.
// Returns a parallel slice of booleans for each attrFp.
AttrsExistForResource(ctx context.Context, resourceFp uint64, attrFps []uint64, ds pipeline.Signal) ([]bool, error)

// Debug logs internal state (for debugging).
Debug(ctx context.Context)

// ResourcesLimitExceeded returns true if the resource limit has been exceeded.
ResourcesLimitExceeded(ctx context.Context, ds pipeline.Signal) bool

// CardinalityLimitExceeded returns true if the cardinality limit has been exceeded for the given resourceFp.
CardinalityLimitExceeded(ctx context.Context, resourceFp uint64, ds pipeline.Signal) bool

// CardinalityLimitExceededMulti returns true if the cardinality limit has been exceeded for given resourceFps.
// Returns a parallel slice of booleans for each resourceFp.
CardinalityLimitExceededMulti(ctx context.Context, resourceFps []uint64, ds pipeline.Signal) ([]bool, error)

// TotalCardinalityLimitExceeded returns true if the total cardinality limit has been exceeded.
TotalCardinalityLimitExceeded(ctx context.Context, ds pipeline.Signal) bool
}
Loading
Loading