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 a metric tracking the selected replica #2231

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

josephschorr
Copy link
Member

@josephschorr josephschorr commented Feb 3, 2025

Allows for understanding which replica(s) are being used

@github-actions github-actions bot added area/datastore Affects the storage system area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Feb 3, 2025
@josephschorr josephschorr marked this pull request as ready for review February 3, 2025 17:35
@josephschorr josephschorr requested review from vroldanbet and a team as code owners February 3, 2025 17:35
Copy link
Contributor

@vroldanbet vroldanbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one suggestion with memdb.

if err != nil {
return "", errors.New("could not parse datastore URL")
}
return u.Host + u.Path, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that returning host+path will lead to explosion of cardinality when having many spiced clusters in the same physical database. I do see the value in disambiguating telemetry across spicedb clusters, just something to note.

@@ -100,6 +100,10 @@ type snapshot struct {
db *memdb.MemDB
}

func (mdb *memdbDatastore) MetricsID() (string, error) {
return "memdb-" + mdb.uniqueID, nil
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this almost certainly cause explosion in cadinality for these metrics. E.g. when MemDB SpiceDB is embedded in another process, each restart will bring different uniqueID. I'd personally just have it as memdb - the scenario of multiple SpiceDB processes in memory is less likely, and the explosion in cardinality can have severe cost implications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/datastore Affects the storage system area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants