Skip to content

Commit

Permalink
[PAGOPA-1834] feat: Enhancing Registro Eventi's event tracing (#26)
Browse files Browse the repository at this point in the history
* [PAGOPA-1834] fix: refactored RE event, normalizing language and removing unused fields
* [PAGOPA-1834] fix: refactored internal step status enum
* [PAGOPA-1834] chore: removed unused files
* [PAGOPA-1834] fix: add logging level also on interceptors
* [PAGOPA-1834] fix: restructuring RE generation and MDC setting
* [PAGOPA-1834] fix: little refactoring of errors and added more descriptions
* [PAGOPA-1834] fix: removed RE logging for 'retrieve cache' invocations
* [PAGOPA-1834] fix: restructuring RE generation for PP generation and caching
* [PAGOPA-1834] fix: restructuring RE generation for Checkout communication
* [PAGOPA-1834] feat: added optional RE tracing for client invocation
* [PAGOPA-1834] feat: added optional RE tracing for internal status change
* [PAGOPA-1834] feat: added feature flags for RE tracing
* [PAGOPA-1834] fix: set injected parameters of RE tracing in client config
* [PAGOPA-1834] fix: resolved issue about log injection

---------

Co-authored-by: pagopa-github-bot <github-bot@pagopa.it>
  • Loading branch information
andrea-deri and pagopa-github-bot authored Jun 17, 2024
1 parent 8d907cd commit e20dbdb
Show file tree
Hide file tree
Showing 55 changed files with 1,101 additions and 1,348 deletions.
4 changes: 2 additions & 2 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: v2
name: pagopa-wisp-converter
description: A service that permits to handle nodoInviaRPT and nodoInviaCarrelloRPT request from WISP, interfacing them with GPD system
type: application
version: 0.54.0
appVersion: 0.0.21
version: 0.55.0
appVersion: 0.0.21-1-PAGOPA-1834-re-refactoring
dependencies:
- name: microservice-chart
version: 3.0.0
Expand Down
12 changes: 10 additions & 2 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.0.21"
tag: "0.0.21-1-PAGOPA-1834-re-refactoring"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -90,8 +90,16 @@ microservice-chart:
CLIENT_DECOUPLERCACHING_HOST: 'https://api.dev.platform.pagopa.it/wisp-converter/caching/api/v1'
CLIENT_CACHE_HOST: 'https://api.dev.platform.pagopa.it/api-config-cache/p/v1'
STATION_IN_GPD_PARTIAL_PATH: 'gpd-payments/api/v2'
RE_TRACING_INTERFACE_IUVGENERATOR_ENABLED: 'true'
RE_TRACING_INTERFACE_PAYMENTPOSITIONANALYSIS_ENABLED: 'true'
RE_TRACING_INTERFACE_DECOUPLERCACHING_ENABLED: 'true'
RE_TRACING_INTERFACE_CHECKOUTINTERACTION_ENABLED: 'true'
RE_TRACING_INTERNAL_RPTRETRIEVING_ENABLED: 'true'
RE_TRACING_INTERNAL_RPTEXTRACTION_ENABLED: 'true'
RE_TRACING_INTERNAL_PAYMENTPOSITIONANALYSIS_ENABLED: 'true'
RE_TRACING_INTERNAL_DECOUPLERCACHING_ENABLED: 'true'
RE_TRACING_INTERNAL_CHECKOUTINTERACTION_ENABLED: 'true'
SPRING_PROFILES_ACTIVE: "default,jsonLog"
CLIENT_CHECKOUT_USEBLUEDEPLOYMENT: 'true'
secretProvider:
create: true
envSecrets:
Expand Down
11 changes: 10 additions & 1 deletion helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.0.21"
tag: "0.0.21-1-PAGOPA-1834-re-refactoring"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -90,6 +90,15 @@ microservice-chart:
CLIENT_DECOUPLERCACHING_HOST: 'https://api.platform.pagopa.it/wisp-converter/caching/api/v1'
CLIENT_CACHE_HOST: 'https://api.platform.pagopa.it/api-config-cache/p/v1'
STATION_IN_GPD_PARTIAL_PATH: 'gpd-payments/api/v2'
RE_TRACING_INTERFACE_IUVGENERATOR_ENABLED: 'true'
RE_TRACING_INTERFACE_PAYMENTPOSITIONANALYSIS_ENABLED: 'true'
RE_TRACING_INTERFACE_DECOUPLERCACHING_ENABLED: 'true'
RE_TRACING_INTERFACE_CHECKOUTINTERACTION_ENABLED: 'true'
RE_TRACING_INTERNAL_RPTRETRIEVING_ENABLED: 'true'
RE_TRACING_INTERNAL_RPTEXTRACTION_ENABLED: 'true'
RE_TRACING_INTERNAL_PAYMENTPOSITIONANALYSIS_ENABLED: 'true'
RE_TRACING_INTERNAL_DECOUPLERCACHING_ENABLED: 'true'
RE_TRACING_INTERNAL_CHECKOUTINTERACTION_ENABLED: 'true'
SPRING_PROFILES_ACTIVE: "default,jsonLog"
secretProvider:
create: true
Expand Down
11 changes: 10 additions & 1 deletion helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart:
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.0.21"
tag: "0.0.21-1-PAGOPA-1834-re-refactoring"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -90,6 +90,15 @@ microservice-chart:
CLIENT_DECOUPLERCACHING_HOST: 'https://api.uat.platform.pagopa.it/wisp-converter/caching/api/v1'
CLIENT_CACHE_HOST: 'https://api.uat.platform.pagopa.it/api-config-cache/p/v1'
STATION_IN_GPD_PARTIAL_PATH: 'gpd-payments/api/v2'
RE_TRACING_INTERFACE_IUVGENERATOR_ENABLED: 'true'
RE_TRACING_INTERFACE_PAYMENTPOSITIONANALYSIS_ENABLED: 'true'
RE_TRACING_INTERFACE_DECOUPLERCACHING_ENABLED: 'true'
RE_TRACING_INTERFACE_CHECKOUTINTERACTION_ENABLED: 'true'
RE_TRACING_INTERNAL_RPTRETRIEVING_ENABLED: 'true'
RE_TRACING_INTERNAL_RPTEXTRACTION_ENABLED: 'true'
RE_TRACING_INTERNA_PAYMENTPOSITIONANALYSIS_ENABLED: 'true'
RE_TRACING_INTERNAL_DECOUPLERCACHING_ENABLED: 'true'
RE_TRACING_INTERNAL_CHECKOUTINTERACTION_ENABLED: 'true'
SPRING_PROFILES_ACTIVE: "default,jsonLog"
secretProvider:
create: true
Expand Down
4 changes: 2 additions & 2 deletions openapi/openapi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<groupId>it.gov.pagopa</groupId>
<artifactId>wisp-converter</artifactId>
<version>0.0.21</version>
<version>0.0.21-1-PAGOPA-1834-re-refactoring</version>
<name>pagoPA WISP Converter</name>
<description>A service that permits to handle nodoInviaRPT and nodoInviaCarrelloRPT request from WISP, converting them in NMU payments.</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public class CheckoutClientConfig {
@Value("${client.checkout.base-path}")
private String basePath;

@Value("${wisp-converter.re-tracing.interface.checkout-interaction.enabled}")
private Boolean isTracingOfClientOnREEnabled;

@Bean
@ConfigurationProperties(prefix = "log.client.checkout")
public RequestResponseLoggingProperties checkoutClientLoggingProperties() {
Expand All @@ -44,7 +47,7 @@ public RequestResponseLoggingProperties checkoutClientLoggingProperties() {
public it.gov.pagopa.gen.wispconverter.client.checkout.invoker.ApiClient checkoutClient() {
RequestResponseLoggingProperties clientLoggingProperties = checkoutClientLoggingProperties();

CheckoutClientLoggingInterceptor clientLogging = new CheckoutClientLoggingInterceptor(clientLoggingProperties, reService);
CheckoutClientLoggingInterceptor clientLogging = new CheckoutClientLoggingInterceptor(clientLoggingProperties, reService, isTracingOfClientOnREEnabled);

RestTemplate restTemplate = restTemplate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public class DecouplerCachingClientConfig {
@Value("${client.decoupler-caching.api-key}")
private String apiKey;

@Value("${wisp-converter.re-tracing.interface.decoupler-caching.enabled}")
private Boolean isTracingOfClientOnREEnabled;


@Bean
@ConfigurationProperties(prefix = "log.client.decoupler-caching")
Expand All @@ -49,7 +52,7 @@ public RequestResponseLoggingProperties decouplerCachingClientLoggingProperties(
public it.gov.pagopa.gen.wispconverter.client.decouplercaching.invoker.ApiClient decouplerCachingClient() {
RequestResponseLoggingProperties clientLoggingProperties = decouplerCachingClientLoggingProperties();

DecouplerCachingClientLoggingInterceptor clientLogging = new DecouplerCachingClientLoggingInterceptor(clientLoggingProperties, reService);
DecouplerCachingClientLoggingInterceptor clientLogging = new DecouplerCachingClientLoggingInterceptor(clientLoggingProperties, reService, isTracingOfClientOnREEnabled);

RestTemplate restTemplate = restTemplate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public class GpdClientConfig {
@Value("${client.gpd.api-key}")
private String apiKey;

@Value("${wisp-converter.re-tracing.interface.payment-position-analysis.enabled}")
private Boolean isTracingOfClientOnREEnabled;

@Bean
@ConfigurationProperties(prefix = "log.client.gpd")
Expand All @@ -61,7 +63,7 @@ public RequestResponseLoggingProperties gpdClientLoggingProperties() {
public it.gov.pagopa.gen.wispconverter.client.gpd.invoker.ApiClient gpdClient() {
RequestResponseLoggingProperties clientLoggingProperties = gpdClientLoggingProperties();

GpdClientLoggingInterceptor clientLogging = new GpdClientLoggingInterceptor(clientLoggingProperties, reService);
GpdClientLoggingInterceptor clientLogging = new GpdClientLoggingInterceptor(clientLoggingProperties, reService, isTracingOfClientOnREEnabled);

RestTemplate restTemplate = restTemplate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class IuvGeneratorClientConfig {
@Value("${client.iuvgenerator.api-key}")
private String apiKey;

@Value("${wisp-converter.re-tracing.interface.iuv-generator.enabled}")
private Boolean isTracingOfClientOnREEnabled;

@Bean
@ConfigurationProperties(prefix = "log.client.iuvgenerator")
Expand All @@ -50,7 +52,7 @@ public RequestResponseLoggingProperties iuvGeneratorClientLoggingProperties() {
public it.gov.pagopa.gen.wispconverter.client.iuvgenerator.invoker.ApiClient iuvGeneratorClient() {
RequestResponseLoggingProperties clientLoggingProperties = iuvGeneratorClientLoggingProperties();

IuvGeneratorClientLoggingInterceptor clientLogging = new IuvGeneratorClientLoggingInterceptor(clientLoggingProperties, reService);
IuvGeneratorClientLoggingInterceptor clientLogging = new IuvGeneratorClientLoggingInterceptor(clientLoggingProperties, reService, isTracingOfClientOnREEnabled);

RestTemplate restTemplate = restTemplate();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,16 @@ public String redirect(@Parameter(description = "", example = "identificativoInt
@RequestParam("sessionId") String sessionId,
HttpServletResponse response) {
try {
log.info("Invoking API operation redirect - args: {}", sessionId.matches("[\\w\\-]*") ? sessionId : "...");
String redirectURI = converterService.convert(sessionId);
log.info("Successful API operation redirect - result: {}", redirectURI);
return "redirect:" + redirectURI;
} catch (AppException appException) {
ErrorResponse errorResponse = errorUtil.forAppException(appException);
ProblemDetail problemDetail = errorResponse.updateAndGetBody(this.messageSource, LocaleContextHolder.getLocale());
errorUtil.finalizeError(problemDetail, errorResponse.getStatusCode().value());
response.setStatus(200);
log.error("Failed API operation redirect - error: {}", errorResponse);
return "error";
} catch (Exception ex) {
String operationId = MDC.get(Constants.MDC_OPERATION_ID);
Expand All @@ -70,6 +73,7 @@ public String redirect(@Parameter(description = "", example = "identificativoInt
ProblemDetail problemDetail = errorResponse.updateAndGetBody(this.messageSource, LocaleContextHolder.getLocale());
errorUtil.finalizeError(problemDetail, errorResponse.getStatusCode().value());
response.setStatus(200);
log.error("Failed API operation redirect - error: {}", errorResponse);
return "error";
}
}
Expand Down
Loading

0 comments on commit e20dbdb

Please sign in to comment.