Default Observe time window to 7 days - #470
Closed
Paulo Lacerda (placerda) wants to merge 1 commit into
Closed
Conversation
Change the Observe screen's default lookback from 24 hours to 7 days when no start/end is present in the URL. Updates the backend lookback constant, the UI range constant, and the mirrored constant in the embedded JavaScript, plus docstrings and docs. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
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.
Muda a janela de tempo padrão da tela Observe de 24 horas para 7 dias quando
/observeé aberto semstart/endna URL.Pontos alterados
src/agentops/agent/observe/queries.py—DEFAULT_LOOKBACK_HOURS2424 * 7src/agentops/agent/observe/ui.py—DEFAULT_RANGE_HOURS2424 * 7src/agentops/agent/observe/ui.py— JSDEFAULT_RANGE_MS(dentro de_OBSERVE_SCRIPT)24 * 60 * 60 * 10007 * 24 * 60 * 60 * 1000Grep adicional encontrou três referências de documentação que também diziam
24 hourse foram atualizadas: o docstring dedefault_lookback_windowemqueries.py, o docstring de módulo e o derender_filter_baremui.py, edocs/observe.md.Sobre as duas constantes
DEFAULT_RANGE_HOURS(ui) eDEFAULT_LOOKBACK_HOURS(queries) foram mantidas duplicadas de propósito:ui.pyé um módulo de renderização puro — sem I/O de rede, sem env vars, sem Azure SDK, importando apenas stdlib. Importarqueries.pytrariaagentops.core.attribution,agentops.core.costeagentops.core.observejunto._OBSERVE_SCRIPTé uma string tripla comum (não f-string), então o valor JS não pode ser interpolado sem escapar todas as chaves do JavaScript.MAX_TREND_POINTSeAUTO_REFRESH_MS.Foi adicionado um comentário explícito em
ui.pyapontando o espelhamento, e os testes cobrem os dois valores.Testes
tests/unit/test_observe_queries.py:test_default_lookback_window_is_24_hours→test_default_lookback_window_is_7_days, com assert adicionalend - start == timedelta(days=7)tests/unit/test_observe_ui.py:assert ui.DEFAULT_RANGE_HOURS == 24 * 7etest_script_computes_default_24_hour_range_when_missing_from_url→..._7_day_...verificando o novo literal JSpython -m pytest tests/unit/test_observe_queries.py tests/unit/test_observe_ui.py→ 260 passed (após rebase emdevelop).Nota:
src/agentops/agent/time_range.pynão foi tocado — é do cockpit e já usa 7 dias.