Skip to content

Add Micrometer custom counters for tracking searches by municipality/state#73

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/add-micrometer-counters
Draft

Add Micrometer custom counters for tracking searches by municipality/state#73
Copilot wants to merge 2 commits intomainfrom
copilot/add-micrometer-counters

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

Adds inline Micrometer counters at key access points to track usage patterns across epidemiological queries, risk assessments, triage evaluations, and hospital referrals — exposed via Spring Boot Actuator.

New metrics

Counter Location Tags
vigisus.buscas.municipio PerfilEpidemiologicoService coIbge, municipio, uf
vigisus.buscas.ranking ConsultarRankingMunicipalUseCase uf
vigisus.buscas.linguagem_natural BuscaCompletaUseCase query_tipo
vigisus.buscas.risco ConsultarPrevisaoRiscoUseCase coIbge, classificacao_risco
vigisus.triagens.avaliadas AvaliarTriagemUseCase prioridade
vigisus.encaminhamentos ConsultarEncaminhamentoUseCase tipo_leito

Changes

  • MetricsConfig.java — new @Configuration placeholder in config/; counters are created inline via MeterRegistry injection
  • PerfilEpidemiologicoService, ConsultarRankingMunicipalUseCase, BuscaCompletaUseCase, ConsultarPrevisaoRiscoUseCase, AvaliarTriagemUseCase, ConsultarEncaminhamentoUseCaseMeterRegistry injected via @RequiredArgsConstructor; counter incremented after successful response construction
  • All affected unit tests updated to supply new SimpleMeterRegistry()

Example counter registration pattern used throughout:

meterRegistry.counter("vigisus.buscas.municipio",
    "coIbge", coIbge,
    "municipio", response.getMunicipio(),
    "uf", response.getUf()
).increment();

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Agent-Logs-Url: https://github.com/fiap-tech-challenge-java/vigisus/sessions/6d44c68a-0aad-4a9d-b8b0-4db09cfddbf3

Co-authored-by: rebecanonato89 <38442994+rebecanonato89@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants