Skip to content

Add two initial metrics to the indexer - #1389

Open
dcookspi wants to merge 2 commits into
mainfrom
indexer-add-metrics
Open

Add two initial metrics to the indexer#1389
dcookspi wants to merge 2 commits into
mainfrom
indexer-add-metrics

Conversation

@dcookspi

Copy link
Copy Markdown
Collaborator

This adds some initial metrics to the indexer. It moves the metrics code to the spk-config crate to do this, and avoid creating a dependency cycle between the spk-solver and spk-storage crates.

This adds two metrics:

  • one after each indexer heartbeat message is sent
  • one just before starting any index update

@dcookspi dcookspi self-assigned this Jun 19, 2026
@dcookspi dcookspi added enhancement New feature or request SPI AOI Area of interest for SPI labels Jun 19, 2026
@dcookspi
dcookspi requested a review from jrray June 19, 2026 22:20
@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

@dcookspi
dcookspi requested a review from rydrman June 19, 2026 22:54
Comment thread crates/spk-config/src/metrics.rs Outdated
Comment on lines +109 to +115
.unwrap_or_else(|_| String::from("spk.indexer_heartbeat_count"))
});

// TODO: add the default value to a config file, once spk has one
pub static SPK_INDEXER_INDEX_UPDATE_METRIC: Lazy<String> = Lazy::new(|| {
std::env::var("SPK_INDEXER_INDEX_UPDATE_METRIC")
.unwrap_or_else(|_| String::from("spk.indexer_index_update_count"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead of having hard-coded fallbacks, please make it so sending these count changes is disabled unless the metric names are found in the configuration.

@dcookspi dcookspi Jul 13, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

  • Remove the indexer metric names, change to not send indexer metrics unless the names are configured.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I've removed the default metrics names and moved them to the Indexer config section. The metrics won't be sent unless the metric names are configured. Getting the correct metric name to the point where the event messages are sent required adding the IndexUpdateContext helper struct.

Moves metrics code to spk-config crate.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi
dcookspi force-pushed the indexer-add-metrics branch from ee32db5 to bfda313 Compare July 13, 2026 17:44
@dcookspi dcookspi changed the title Add some metrics to the indexer Add two initial metrics to the indexer Jul 13, 2026
Moves indexer metric naming to spk config. Indexer metrics will only
be sent if configured, and the heartbeat metric will be updated for
all index update events.

Adds IndexUpdateContext helper struct.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi
dcookspi force-pushed the indexer-add-metrics branch from af83bd4 to 208a9ef Compare July 14, 2026 23:56
@dcookspi
dcookspi requested a review from jrray July 15, 2026 00:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request SPI AOI Area of interest for SPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants