Skip to content

Commit

Permalink
Remove influx metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
dragutin-nav committed Sep 2, 2024
1 parent 9f74a3e commit b5e898d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import io.vavr.control.Try;
import io.vavr.control.Validation;
import lombok.RequiredArgsConstructor;
import no.nav.common.metrics.Event;
import no.nav.common.metrics.MetricsClient;
import no.nav.common.types.identer.AktorId;
import no.nav.common.types.identer.EnhetId;
import no.nav.common.types.identer.Fnr;
Expand Down Expand Up @@ -34,7 +32,6 @@ public class ArbeidslisteService {
private final ArbeidslisteRepositoryV2 arbeidslisteRepositoryV2;
private final BrukerServiceV2 brukerServiceV2;
private final OpensearchIndexerV2 opensearchIndexerV2;
private final MetricsClient metricsClient;

public Try<Arbeidsliste> getArbeidsliste(Fnr fnr) {
return arbeidslisteRepositoryV2.retrieveArbeidsliste(fnr);
Expand All @@ -46,8 +43,6 @@ public List<Arbeidsliste> getArbeidslisteForVeilederPaEnhet(EnhetId enhet, Veile

public Try<ArbeidslisteDTO> createArbeidsliste(ArbeidslisteDTO dto) {

metricsClient.report((new Event("arbeidsliste.opprettet")));

Try<AktorId> aktoerId = hentAktorId(dto.getFnr());
if (aktoerId.isFailure()) {
return Try.failure(aktoerId.getCause());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import lombok.Data;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import no.nav.common.metrics.Event;
import no.nav.common.metrics.MetricsClient;
import no.nav.common.rest.client.RestUtils;
import no.nav.pto.veilarbportefolje.opensearch.domene.OpensearchClientConfig;
import okhttp3.OkHttpClient;
Expand All @@ -23,17 +21,14 @@
public class OpensearchCountService {
private final OpensearchClientConfig opensearchClientConfig;
private final String indexName;
private final MetricsClient metricsClient;
private final OkHttpClient client;

@Autowired
public OpensearchCountService(
OpensearchClientConfig opensearchClientConfig,
IndexName opensearchIndex,
MetricsClient metricsClient
IndexName opensearchIndex
) {
this.opensearchClientConfig = opensearchClientConfig;
this.metricsClient = metricsClient;
this.indexName = opensearchIndex.getValue();
client = baseClient();
}
Expand All @@ -49,22 +44,13 @@ public long getCount() {

try (Response response = client.newCall(request).execute()) {
RestUtils.throwIfNotSuccessful(response);
long count = RestUtils.parseJsonResponse(response, CountResponse.class)

return RestUtils.parseJsonResponse(response, CountResponse.class)
.map(CountResponse::getCount)
.orElse(0L);

reportDocCountToInfluxdb(count);
return count;
}
}

private void reportDocCountToInfluxdb(long count) {
Event event = new Event("portefolje.antall.brukere");
event.addFieldToReport("antall_brukere", count);

metricsClient.report(event);
}

public static String createAbsoluteUrl(OpensearchClientConfig config, String indexName) {
return String.format("%s%s/",
createAbsoluteUrl(config),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import no.nav.common.auth.context.AuthContextHolderThreadLocal;
import no.nav.common.auth.context.UserRole;
import no.nav.common.job.leader_election.LeaderElectionClient;
import no.nav.common.metrics.MetricsClient;
import no.nav.common.token_client.client.AzureAdMachineToMachineTokenClient;
import no.nav.common.token_client.client.AzureAdOnBehalfOfTokenClient;
import no.nav.common.utils.Credentials;
Expand Down Expand Up @@ -38,7 +37,6 @@
import no.nav.pto.veilarbportefolje.kodeverk.KodeverkClient;
import no.nav.pto.veilarbportefolje.kodeverk.KodeverkService;
import no.nav.pto.veilarbportefolje.mal.MalService;
import no.nav.pto.veilarbportefolje.mock.MetricsClientMock;
import no.nav.pto.veilarbportefolje.opensearch.*;
import no.nav.pto.veilarbportefolje.opensearch.domene.OpensearchClientConfig;
import no.nav.pto.veilarbportefolje.oppfolging.*;
Expand Down Expand Up @@ -234,11 +232,6 @@ public DefaultUnleash defaultUnleash() {
return mock;
}

@Bean
public MetricsClient metricsClient() {
return new MetricsClientMock();
}

@Bean
public RestHighLevelClient restHighLevelClient() {
return createClient(opensearchClientConfig());
Expand Down

This file was deleted.

0 comments on commit b5e898d

Please sign in to comment.