Search in sources :

Example 1 with Event

use of no.nav.common.metrics.Event in project veilarbportefolje by navikt.

the class VeilederController method hentPortefoljeForVeileder.

@PostMapping("/{veilederident}/portefolje")
public Portefolje hentPortefoljeForVeileder(@PathVariable("veilederident") String veilederIdent, @RequestParam("enhet") String enhet, @RequestParam(value = "fra", required = false) Integer fra, @RequestParam(value = "antall", required = false) Integer antall, @RequestParam("sortDirection") String sortDirection, @RequestParam("sortField") String sortField, @RequestBody Filtervalg filtervalg) {
    ValideringsRegler.sjekkVeilederIdent(veilederIdent, false);
    ValideringsRegler.sjekkEnhet(enhet);
    ValideringsRegler.sjekkSortering(sortDirection, sortField);
    ValideringsRegler.sjekkFiltervalg(filtervalg);
    authService.tilgangTilOppfolging();
    authService.tilgangTilEnhet(enhet);
    String ident = AuthUtils.getInnloggetVeilederIdent().toString();
    String identHash = DigestUtils.md5Hex(ident).toUpperCase();
    BrukereMedAntall brukereMedAntall = opensearchService.hentBrukere(enhet, Optional.of(veilederIdent), sortDirection, sortField, filtervalg, fra, antall);
    List<Bruker> sensurerteBrukereSublist = authService.sensurerBrukere(brukereMedAntall.getBrukere());
    Portefolje portefolje = PortefoljeUtils.buildPortefolje(brukereMedAntall.getAntall(), sensurerteBrukereSublist, enhet, Optional.ofNullable(fra).orElse(0));
    Event event = new Event("minoversiktportefolje.lastet");
    event.addFieldToReport("identhash", identHash);
    metricsClient.report(event);
    return portefolje;
}
Also used : BrukereMedAntall(no.nav.pto.veilarbportefolje.domene.BrukereMedAntall) Portefolje(no.nav.pto.veilarbportefolje.domene.Portefolje) Event(no.nav.common.metrics.Event) Bruker(no.nav.pto.veilarbportefolje.domene.Bruker) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Example 2 with Event

use of no.nav.common.metrics.Event in project veilarbportefolje by navikt.

the class VeilederController method hentStatusTall.

@GetMapping("/{veilederident}/statustall")
public StatusTall hentStatusTall(@PathVariable("veilederident") String veilederIdent, @RequestParam("enhet") String enhet) {
    Event event = new Event("minoversiktportefolje.statustall.lastet");
    metricsClient.report(event);
    ValideringsRegler.sjekkEnhet(enhet);
    ValideringsRegler.sjekkVeilederIdent(veilederIdent, false);
    authService.tilgangTilEnhet(enhet);
    return opensearchService.hentStatusTallForVeileder(veilederIdent, enhet);
}
Also used : Event(no.nav.common.metrics.Event) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 3 with Event

use of no.nav.common.metrics.Event in project veilarbportefolje by navikt.

the class OpensearchCountService method reportDocCountToInfluxdb.

private void reportDocCountToInfluxdb(long count) {
    Event event = new Event("portefolje.antall.brukere");
    event.addFieldToReport("antall_brukere", count);
    metricsClient.report(event);
}
Also used : Event(no.nav.common.metrics.Event)

Example 4 with Event

use of no.nav.common.metrics.Event in project veilarbportefolje by navikt.

the class InternalController method metrikkOppdatering.

// Daglig kl 00:05
@Scheduled(cron = "5 0 0 * * ?")
private void metrikkOppdatering() {
    String sql = "SELECT count(*) FROM AKTOERID_TO_PERSONID " + "WHERE PERSONID IN " + "(SELECT PERSONID FROM AKTOERID_TO_PERSONID GROUP BY PERSONID HAVING max(GJELDENE) = 0)";
    var brukere = db.queryForObject(sql, Integer.class);
    Event event = new Event("portefolje.metrikker.usermapping");
    event.addFieldToReport("brukere", brukere);
    metricsClient.report(event);
}
Also used : Event(no.nav.common.metrics.Event) Scheduled(org.springframework.scheduling.annotation.Scheduled)

Example 5 with Event

use of no.nav.common.metrics.Event in project veilarbportefolje by navikt.

the class EnhetController method hentPortefoljeForEnhet.

@PostMapping("/{enhet}/portefolje")
public Portefolje hentPortefoljeForEnhet(@PathVariable("enhet") String enhet, @RequestParam(value = "fra", required = false) Integer fra, @RequestParam(value = "antall", required = false) Integer antall, @RequestParam("sortDirection") String sortDirection, @RequestParam("sortField") String sortField, @RequestBody Filtervalg filtervalg) {
    ValideringsRegler.sjekkEnhet(enhet);
    ValideringsRegler.sjekkSortering(sortDirection, sortField);
    ValideringsRegler.sjekkFiltervalg(filtervalg);
    authService.tilgangTilOppfolging();
    authService.tilgangTilEnhet(enhet);
    String ident = AuthUtils.getInnloggetVeilederIdent().toString();
    String identHash = DigestUtils.md5Hex(ident).toUpperCase();
    BrukereMedAntall brukereMedAntall = opensearchService.hentBrukere(enhet, Optional.empty(), sortDirection, sortField, filtervalg, fra, antall);
    List<Bruker> sensurerteBrukereSublist = authService.sensurerBrukere(brukereMedAntall.getBrukere());
    Portefolje portefolje = PortefoljeUtils.buildPortefolje(brukereMedAntall.getAntall(), sensurerteBrukereSublist, enhet, Optional.ofNullable(fra).orElse(0));
    Event event = new Event("enhetsportefolje.lastet");
    event.addFieldToReport("identhash", identHash);
    metricsClient.report(event);
    return portefolje;
}
Also used : BrukereMedAntall(no.nav.pto.veilarbportefolje.domene.BrukereMedAntall) Portefolje(no.nav.pto.veilarbportefolje.domene.Portefolje) Event(no.nav.common.metrics.Event) Bruker(no.nav.pto.veilarbportefolje.domene.Bruker) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

Event (no.nav.common.metrics.Event)5 Bruker (no.nav.pto.veilarbportefolje.domene.Bruker)2 BrukereMedAntall (no.nav.pto.veilarbportefolje.domene.BrukereMedAntall)2 Portefolje (no.nav.pto.veilarbportefolje.domene.Portefolje)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 Scheduled (org.springframework.scheduling.annotation.Scheduled)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1