Skip to content

Commit

Permalink
feat: Quarkus upgraded to 3.10.0 and used mil-common to trace MongoDB. (
Browse files Browse the repository at this point in the history
  • Loading branch information
antoniotarricone authored May 6, 2024
1 parent 8b0f4f2 commit cf1e2af
Show file tree
Hide file tree
Showing 11 changed files with 2,990 additions and 3,207 deletions.
6,038 changes: 2,977 additions & 3,061 deletions dep-sha256.json

Large diffs are not rendered by default.

41 changes: 10 additions & 31 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@
<!-- Quarkus version -->
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id>
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id>
<quarkus.platform.version>3.9.4</quarkus.platform.version>
<quarkus.platform.version>3.10.0</quarkus.platform.version>
<!-- Other dependecies version -->
<depcheck-plugin.version>1.1.1</depcheck-plugin.version>
<common.version>2.0.2</common.version>
<depcheck-plugin.version>1.2.1</depcheck-plugin.version>
<common.version>2.2.1</common.version>
<jedis.version>4.4.3</jedis.version>
<otel-exporter-azure.version>3.8.3.0</otel-exporter-azure.version>
<!-- Sonar config -->
<sonar.host.url>https://sonarcloud.io:443/</sonar.host.url>
<sonar.organization>pagopa</sonar.organization>
Expand Down Expand Up @@ -99,11 +100,6 @@
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf</artifactId>
</dependency>
<!-- Provides async non-blocking client calls for CXF -->
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-rt-transports-http-hc5</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand Down Expand Up @@ -192,34 +188,16 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-opentelemetry</artifactId>
</dependency>
<dependency>
<groupId>io.quarkiverse.cxf</groupId>
<artifactId>quarkus-cxf-integration-tracing-opentelemetry</artifactId>
</dependency>
<!-- OpenTelemetry exporter for Azure Application Insights -->
<dependency>
<groupId>io.quarkiverse.opentelemetry.exporter</groupId>
<artifactId>quarkus-opentelemetry-exporter-azure</artifactId>
<version>3.8.3.0</version>
</dependency>
<!-- Metrics -->
<!--
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-micrometer</artifactId>
</dependency>
-->
<!-- To send metrics data to Azure Insights Monitor -->
<!--
<dependency>
<groupId>io.quarkiverse.micrometer.registry</groupId>
<artifactId>quarkus-micrometer-registry-azure-monitor</artifactId>
<version>3.2.4</version>
</dependency>
-->
<!-- Health check -->
<!--
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
<version>${otel-exporter-azure.version}</version>
</dependency>
-->
</dependencies>
<repositories>
<repository>
Expand Down Expand Up @@ -305,6 +283,7 @@
</executions>
<configuration>
<fileName>dep-sha256.json</fileName>
<addFileName>dep-sha256-man.json</addFileName>
<includePlugins>false</includePlugins>
<includeParent>false</includeParent>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package it.pagopa.swclient.mil.paymentnotice.client;

import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.quarkus.rest.client.reactive.ClientQueryParam;
import io.smallrye.mutiny.Uni;
import it.pagopa.swclient.mil.paymentnotice.client.bean.ADAccessToken;
Expand All @@ -23,7 +21,6 @@ public interface AzureADRestClient {
@GET
@Produces(MediaType.APPLICATION_JSON)
@ClientQueryParam(name = "api-version", value = "${azure-auth-api.version}")
@WithSpan(kind = SpanKind.CLIENT)
Uni<ADAccessToken> getAccessToken(
@HeaderParam("x-identity-header") String identity,
@QueryParam("resource") String scope);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package it.pagopa.swclient.mil.paymentnotice.client;

import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.smallrye.mutiny.Uni;
import it.pagopa.swclient.mil.paymentnotice.client.bean.AcquirerConfiguration;
import jakarta.ws.rs.HeaderParam;
Expand All @@ -25,7 +23,6 @@ public interface MilRestResource {
@GET
@Path("/acquirers/{acquirerId}.json")
@ClientHeaderParam(name = "x-ms-version", value = "${azure-storage-api.version}")
@WithSpan(kind = SpanKind.CLIENT)
Uni<AcquirerConfiguration> getPspConfiguration(
@HeaderParam("Authorization") String authorization,
@PathParam(value = "acquirerId") String acquirerId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import jakarta.annotation.PostConstruct;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.quarkiverse.cxf.annotation.CXFClient;
import io.smallrye.mutiny.Uni;
import it.gov.pagopa.pagopa_api.node.nodeforpsp.ActivatePaymentNoticeV2Request;
Expand Down Expand Up @@ -64,7 +62,6 @@ public class NodeForPspWrapper {
* @param verifyPaymentNoticeReq the request to be serialized and passed to the node
* @return an @{@link Uni} emitting the response of the SOAP service
*/
@WithSpan(kind = SpanKind.CLIENT)
public Uni<VerifyPaymentNoticeRes> verifyPaymentNotice(VerifyPaymentNoticeReq verifyPaymentNoticeReq) {
return Uni.createFrom().future(() ->
(Future<VerifyPaymentNoticeRes>)nodeForPsp.verifyPaymentNoticeAsync(verifyPaymentNoticeReq, res -> {}));
Expand All @@ -75,7 +72,6 @@ public Uni<VerifyPaymentNoticeRes> verifyPaymentNotice(VerifyPaymentNoticeReq ve
* @param activatePaymentNoticeV2Request the request to be serialized and passed to the node
* @return an @{@link Uni} emitting the response of the SOAP service
*/
@WithSpan(kind = SpanKind.CLIENT)
public Uni<ActivatePaymentNoticeV2Response> activatePaymentNoticeV2Async(ActivatePaymentNoticeV2Request activatePaymentNoticeV2Request) {
return Uni.createFrom().future(() ->
(Future<ActivatePaymentNoticeV2Response>)nodeForPsp.activatePaymentNoticeV2Async(activatePaymentNoticeV2Request, res -> {}));
Expand All @@ -86,7 +82,6 @@ public Uni<ActivatePaymentNoticeV2Response> activatePaymentNoticeV2Async(Activat
* @param req
* @return
*/
@WithSpan(kind = SpanKind.CLIENT)
public Uni<SendPaymentOutcomeV2Response> sendPaymentOutcomeV2Async(SendPaymentOutcomeV2Request req) {
return Uni.createFrom().future(() ->
(Future<SendPaymentOutcomeV2Response>)nodeForPsp.sendPaymentOutcomeV2Async(req, res -> {}));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package it.pagopa.swclient.mil.paymentnotice.client;

import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.quarkus.rest.client.reactive.ClientQueryParam;
import it.pagopa.swclient.mil.paymentnotice.client.bean.NodeClosePaymentRequest;
import it.pagopa.swclient.mil.paymentnotice.client.bean.NodeClosePaymentResponse;
Expand Down Expand Up @@ -33,7 +31,6 @@ public interface NodeRestService {
@Path("/closepayment")
@ClientHeaderParam(name = "Ocp-Apim-Subscription-Key", value = "{determineHeaderValue}", required=false)
@ClientQueryParam(name="clientId", value = "${node-rest-client.client-id}")
@WithSpan(kind = SpanKind.CLIENT)
Uni<NodeClosePaymentResponse> closePayment(@QueryParam("deviceId") String deviceId, NodeClosePaymentRequest nodeClosePaymentRequest);

default String determineHeaderValue(String headerName) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import jakarta.enterprise.context.ApplicationScoped;

import io.quarkus.mongodb.panache.reactive.ReactivePanacheMongoRepositoryBase;
import it.pagopa.swclient.mil.paymentnotice.utils.Trace;
import it.pagopa.swclient.mil.observability.TraceReactivePanacheMongoRepository;

/**
* MongoDB repository for payment transactions, reactive flavor
*/
@Trace
@TraceReactivePanacheMongoRepository
@ApplicationScoped
public class PaymentTransactionRepository implements ReactivePanacheMongoRepositoryBase<PaymentTransactionEntity, String> { //NOSONAR

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package it.pagopa.swclient.mil.paymentnotice.redis;

import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.annotations.WithSpan;
import io.quarkus.redis.datasource.ReactiveRedisDataSource;
import io.quarkus.redis.datasource.value.ReactiveValueCommands;
import io.smallrye.mutiny.Uni;
Expand Down Expand Up @@ -37,7 +35,6 @@ public PaymentNoticeService(ReactiveRedisDataSource ds) {
* @param paymentTokens a list of payment tokens
* @return a {@link Map} containing the payment notices as values or null if not found
*/
@WithSpan(value = "redis")
public Uni<Map<String, Notice>> mget(List<String> paymentTokens) {
return commands.mget(paymentTokens.toArray(new String[0]));
}
Expand All @@ -48,7 +45,6 @@ public Uni<Map<String, Notice>> mget(List<String> paymentTokens) {
* @param paymentToken the ID of the payment
* @return a {@link Uni} emitting Void
*/
@WithSpan(kind = SpanKind.CLIENT)
public Uni<Void> set(String paymentToken, Notice notice) {
return commands.set(paymentToken, notice);
}
Expand Down

This file was deleted.

This file was deleted.

11 changes: 1 addition & 10 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,4 @@ quarkus.opentelemetry.tracer.exporter.azure.enabled=false
quarkus.otel.azure.applicationinsights.connection.string=InstrumentationKey=dummy;IngestionEndpoint=https://dummy/;LiveEndpoint=https://dummy/;ApplicationId=dummy

%prod.quarkus.opentelemetry.tracer.exporter.azure.enabled=true
%prod.quarkus.otel.azure.applicationinsights.connection.string=${application-insights.connection-string}

# ------------------------------------------------------------------------------
# MicroMeter
# ------------------------------------------------------------------------------
quarkus.micrometer.export.azuremonitor.enabled=false

%prod.quarkus.micrometer.export.azuremonitor.enabled=true
%prod.quarkus.micrometer.export.azuremonitor.instrumentationKey=${application-insights.instrumentation-key}
%prod.quarkus.micrometer.export.azuremonitor.connectionString=${application-insights.connection-string}
%prod.quarkus.otel.azure.applicationinsights.connection.string=${application-insights.connection-string}

0 comments on commit cf1e2af

Please sign in to comment.