feat: worktime scoring strategy for Prometheus discovery#54
Draft
Copilot wants to merge 2 commits into
Draft
Conversation
Implements a strategy pattern for time-based weighting of Prometheus range query data points. The WorktimeStrategy allows configuring time-of-day windows with weight multipliers, so images discovered during business hours score higher than those discovered at night. API additions: - ScoringStrategy type with worktime variant - WorktimeStrategy with configurable windows and timezone - WorktimeWindow with startHour, endHour, weight Implementation: - ScoreWeighter interface in internal/discovery/scoring.go - worktimeWeighter implementation with timezone support - Integration into aggregateRangeValues via optional weighter param - Controller wiring in buildSource Closes #53
Copilot
AI
changed the title
[WIP] Implement developer worktime scoring function for metric lookups
feat: worktime scoring strategy for Prometheus discovery
Jun 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a strategy-pattern–based scoring function that weights Prometheus range query data points by time of day before aggregation. This lets operators prioritize images pulled during business hours over nighttime noise.
Changes
api/v1alpha1):ScoringStrategy,WorktimeStrategy,WorktimeWindow— configurable time-of-day windows with weight multipliers and timezone supportinternal/discovery/scoring.go):ScoreWeighterinterface withworktimeWeighterimplementation; extensible for future strategiesaggregateRangeValuesapplies per-datapoint weight multiplication when a weighter is configured; no-op when nil (backward compatible)buildSourceconstructs the weighter from API config and passes it through toPrometheusSourcemake codegenExample
Data points at 3am get weight 0 (dropped from sum); data points at 10am get full weight. The strategy is optional and nil-safe — existing configs are unaffected.