Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fjerner tasktimer - bedre å query slutt-start for å tune #475

Merged
merged 2 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,11 @@

import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Tags;
import io.micrometer.core.instrument.Timer;

public class TaskMonitor {

public static final String TASK_LENGDE = "prosesstask.lengde";
public static final String TASK_ANTALL = "prosesstask.antall";

public static final Timer TASK_TIMER = Metrics.timer(TASK_LENGDE);

public static final Map<ProsessTaskStatus, AtomicInteger> TASK_GAUGES = Map.of(
ProsessTaskStatus.KLAR, statusGauge(ProsessTaskStatus.KLAR),
ProsessTaskStatus.VENTER_SVAR, statusGauge(ProsessTaskStatus.VENTER_SVAR),
Expand All @@ -24,7 +20,7 @@ ProsessTaskStatus.FEILET, statusGauge(ProsessTaskStatus.FEILET)
);

private TaskMonitor() {

}

public static void setStatusCount(ProsessTaskStatus status, Integer antall) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import no.nav.vedtak.felles.prosesstask.api.ProsessTask;
import no.nav.vedtak.felles.prosesstask.api.ProsessTaskData;
import no.nav.vedtak.felles.prosesstask.api.ProsessTaskHandler;
import no.nav.vedtak.felles.prosesstask.api.TaskMonitor;
import no.nav.vedtak.felles.prosesstask.api.TaskType;
import no.nav.vedtak.felles.prosesstask.impl.cron.CronExpression;
import no.nav.vedtak.felles.prosesstask.spi.ProsessTaskRetryPolicy;
Expand Down Expand Up @@ -87,15 +86,14 @@ public void close() {
}

if (bean.getClass().isAnnotationPresent(Dependent.class)) {
// må closes hvis @Dependent scoped siden vi slår opp. ApplicationScoped alltid
// ok. RequestScope også ok siden vi kjører med det.
// må closes hvis @Dependent scoped siden vi slår opp. ApplicationScoped alltid ok. RequestScope også ok siden vi kjører med det.
CDI.current().destroy(bean);
}
}

public void doTask(ProsessTaskData data) {
LOG.info("Starter task {}", data.getTaskType());
TaskMonitor.TASK_TIMER.record(() -> bean.doTask(data));
bean.doTask(data);
LOG.info("Stoppet task {}", data.getTaskType());
}

Expand Down