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

chore: editing logs configuration [PAGOPA-2221] #130

Draft
wants to merge 33 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3c20e2a
PAGOPA-2221 changing logs to debug level
FedericoRuzzier Oct 2, 2024
b506b7d
PAGOPA-2221 adding logs config
FedericoRuzzier Oct 2, 2024
e367aa5
PAGOPA-2221 mergin main
FedericoRuzzier Oct 2, 2024
e83cc43
PAGOPA-2221 sanitize input
FedericoRuzzier Oct 2, 2024
ad51483
PAGOPA-2221 update dockerfile
FedericoRuzzier Oct 3, 2024
736431e
Merge branch 'main' into PAGOPA-2221
FedericoRuzzier Oct 3, 2024
0a3a615
[PAGOPA-2221] opt log conf
FedericoRuzzier Oct 3, 2024
c31f6f0
Merge branch 'PAGOPA-2221' of https://github.com/pagopa/pagopa-wisp-c…
Oct 15, 2024
3613ef6
[PAGOPA-2221] service bus opt log
Oct 15, 2024
b774439
[PAGOPA-2221] logging aspect
Oct 15, 2024
3bd8df8
Merge branch 'PAGOPA-2221' of https://github.com/pagopa/pagopa-wisp-c…
Oct 16, 2024
86a7cf7
Merge branch 'main' into PAGOPA-2221
Oct 16, 2024
0655e05
Delete .classpath
jacopocarlini Oct 16, 2024
b1d6afc
[PAGOPA-2221] typo
Oct 16, 2024
1b53e4d
Merge branch 'PAGOPA-2221' of https://github.com/pagopa/pagopa-wisp-c…
Oct 16, 2024
3e09e58
[PAGOPA-2221] removed useless property
Oct 16, 2024
b7d6cb0
[PAGOPA-2221] removed sanitization from some data
Oct 16, 2024
47de307
Merge branch 'PAGOPA-2221' of https://github.com/pagopa/pagopa-wisp-c…
Oct 16, 2024
6e2acfd
Merge branch 'main' into PAGOPA-2221
alessio-acitelli Oct 17, 2024
34b88a5
[PAGOPA-2221] chore(sampling): custom sampling
jacopocarlini Oct 17, 2024
061749c
Bump to version 0.4.11-1-PAGOPA-2221 [skip ci]
pagopa-github-bot Oct 17, 2024
67990d2
Bump to version 0.4.11-2-PAGOPA-2221 [skip ci]
pagopa-github-bot Oct 17, 2024
338656d
[PAGOPA-2221] fix
jacopocarlini Oct 17, 2024
9ea8d71
[PAGOPA-2221] Merge branch 'PAGOPA-2221' of https://github.com/pagopa…
jacopocarlini Oct 17, 2024
c54c6b2
Bump to version 0.4.11-3-PAGOPA-2221 [skip ci]
pagopa-github-bot Oct 17, 2024
73cc92b
[PAGOPA-2221] fix
jacopocarlini Oct 17, 2024
6e35556
[PAGOPA-2221] Merge branch 'PAGOPA-2221' of https://github.com/pagopa…
jacopocarlini Oct 17, 2024
1a47493
Bump to version 0.4.11-4-PAGOPA-2221 [skip ci]
pagopa-github-bot Oct 17, 2024
faa91d3
[PAGOPA-2221] fix
jacopocarlini Oct 17, 2024
cfe5681
Bump to version 0.4.11-5-PAGOPA-2221 [skip ci]
pagopa-github-bot Oct 17, 2024
1d2d651
[PAGOPA-2221] fix
jacopocarlini Oct 17, 2024
1584560
[PAGOPA-2221] Merge branch 'PAGOPA-2221' of https://github.com/pagopa…
jacopocarlini Oct 17, 2024
813e689
Bump to version 0.4.11-6-PAGOPA-2221 [skip ci]
pagopa-github-bot Oct 17, 2024
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
23 changes: 9 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
#
# Build
#
FROM maven:3.9.6-amazoncorretto-17-al2023@sha256:4c8bd9ec72b372f587f7b9d92564a307e4f5180b7ec08455fb346617bae1757e as buildtime
FROM maven:3.9.3-amazoncorretto-17@sha256:4ab7db7bd5f95e58b0ba1346ff29d6abdd9b73e5fd89c5140edead8b037386ff AS buildtime
WORKDIR /build
COPY . .
RUN mvn clean package -Dmaven.test.skip=true

FROM amazoncorretto:17.0.10-alpine3.19@sha256:180e9c91bdbaad3599fedd2f492bf0d0335a9382835aa64669b2c2a8de7c9a22 as builder
#
# Package stage
#
FROM --platform=linux/amd64 amazoncorretto:17.0.9-alpine3.18@sha256:df48bf2e183230040890460ddb4359a10aa6c7aad24bd88899482c52053c7e17 as builder
COPY --from=buildtime /build/target/*.jar application.jar
RUN java -Djarmode=layertools -jar application.jar extract


#FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v1.1.3@sha256:a4e970ef05ecf2081424a64707e7c20856bbc40ddb3e99b32a24cd74591817c4
FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v2.0.0@sha256:629fc410b11f8514c5c1612f5a7beac85ace7e769342351b11642c1370bacd09
#ADD --chown=spring:spring https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.25.1/opentelemetry-javaagent.jar .
FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v2.2.0@sha256:b866656c31f2c6ebe6e78b9437ce930d6c94c0b4bfc8e9ecc1076a780b9dfb18
COPY --chown=spring:spring docker/applicationinsights.json ./applicationinsights.json

COPY --chown=spring:spring --from=builder dependencies/ ./
COPY --chown=spring:spring --from=builder snapshot-dependencies/ ./

# https://github.com/moby/moby/issues/37965#issuecomment-426853382
RUN true
COPY --chown=spring:spring --from=builder spring-boot-loader/ ./
COPY --chown=spring:spring --from=builder application/ ./

#ENV JAVA_OPTS="${JAVA_OPTS}"

EXPOSE 8080

# this mode is required in order to inject the JAVA_OPTS from environment
#ENTRYPOINT exec java -javaagent:/applicationinsights-agent.jar ${JAVA_OPTS} org.springframework.boot.loader.launch.JarLauncher
COPY --chown=spring:spring --from=builder application/ ./
38 changes: 38 additions & 0 deletions docker/applicationinsights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"selfDiagnostics": {
"destination": "console",
"level": "INFO"
},
"sampling": {
"percentage": 0,
"overrides": [
{
"telemetryType": "dependency",
"percentage": 5
},
{
"telemetryType": "trace",
"attributes": [
{
"key": "message",
"value": "Invoking API operation.*",
"matchType": "regexp"
}
],
"percentage": 100
},
{
"telemetryType": "trace",
"percentage": 0
},
{
"telemetryType": "exception",
"percentage": 100
},
{
"telemetryType": "request",
"percentage": 100
}
]
}
}
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: '3.8'

services:
app:
container_name: 'service' # TODO
container_name: 'wisp-converter'
image: ${image}
platform: linux/amd64
build:
Expand Down
9 changes: 6 additions & 3 deletions docker/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,19 @@ if test -f "$FILE"; then
fi
config=$(yq -r '."microservice-chart".envConfig' ../helm/values-$ENV.yaml)
IFS=$'\n'
for line in $(echo "$config" | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
for line in $(echo "$config" | yq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
echo "$line" >> .env
done

keyvault=$(yq -r '."microservice-chart".keyvault.name' ../helm/values-$ENV.yaml)
secret=$(yq -r '."microservice-chart".envSecret' ../helm/values-$ENV.yaml)
for line in $(echo "$secret" | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
for line in $(echo "$secret" | yq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
IFS='=' read -r -a array <<< "$line"
response=$(az keyvault secret show --vault-name $keyvault --name "${array[1]}")
value=$(echo "$response" | jq -r '.value')
response=$(echo "$response" | tr -d '\n')
value=$(echo "$response" | yq -r '.value')
value=$(echo "$value" | sed 's/\$/\$\$/g')
value=$(echo "$value" | tr -d '\n')
echo "${array[0]}=$value" >> .env
done

Expand Down
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.240.0
appVersion: 0.4.11
version: 0.246.0
appVersion: 0.4.11-6-PAGOPA-2221
dependencies:
- name: microservice-chart
version: 3.0.0
Expand Down
11 changes: 2 additions & 9 deletions helm/values-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart: &microservice-chart
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.11"
tag: "0.4.11-6-PAGOPA-2221"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -68,13 +68,7 @@ microservice-chart: &microservice-chart
APP_LOGGING_TRACING_LEVEL: 'ERROR'
DEFAULT_LOGGING_LEVEL: 'INFO'
CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}'
OTEL_SERVICE_NAME: "pagopa-wisp-converter"
OTEL_RESOURCE_ATTRIBUTES: "service.environment=dev"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: otlp
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
SERVICE_NAME: "pagopa-wisp-converter"
REDIS_PORT: "6380"
COSMOS_URI: "https://pagopa-d-weu-nodo-wispconv-cosmos-account.documents.azure.com:443/"
COSMOS_READ_REGION: "West Europe"
Expand Down Expand Up @@ -125,7 +119,6 @@ microservice-chart: &microservice-chart
SERVICE_BUS_PAAINVIART_QUEUE_CONNECTION_STRING: 'wisp-paainviart-queue-connection-string'
ECOMMERCE_HANG_TIMER_QUEUE_CONNECTION_STRING: 'ecommerce-hang-timer-queue-connection-string'
RPT_TIMER_QUEUE_CONNECTION_STRING: 'wisp-rpt-timeout-queue-connection-string'
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
REDIS_PASSWORD: 'redis-primary-key'
REDIS_HOST: 'redis-hostname'
COSMOS_KEY: 'cosmosdb-wisp-converter-account-key'
Expand Down
13 changes: 3 additions & 10 deletions helm/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart: &microservice-chart
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.11"
tag: "0.4.11-6-PAGOPA-2221"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -83,17 +83,11 @@ microservice-chart: &microservice-chart
JAVA_OPTS: "-XX:MaxHeapSize=1780m -XX:MinHeapSize=64m"
WEBSITE_SITE_NAME: 'pagopawispconverter' # required to show cloud role name in application insights
ENV: 'aks-prod'
APP_LOGGING_LEVEL: 'INFO'
APP_LOGGING_LEVEL: 'WARN'
APP_LOGGING_TRACING_LEVEL: 'ERROR'
DEFAULT_LOGGING_LEVEL: 'INFO'
CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}'
OTEL_SERVICE_NAME: "pagopa-wisp-converter"
OTEL_RESOURCE_ATTRIBUTES: "service.environment=prod"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: otlp
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
SERVICE_NAME: "pagopa-wisp-converter"
REDIS_PORT: "6380"
COSMOS_URI: "https://pagopa-p-weu-nodo-wispconv-cosmos-account.documents.azure.com:443/"
COSMOS_READ_REGION: "North Europe"
Expand Down Expand Up @@ -144,7 +138,6 @@ microservice-chart: &microservice-chart
SERVICE_BUS_PAAINVIART_QUEUE_CONNECTION_STRING: 'wisp-paainviart-queue-connection-string'
ECOMMERCE_HANG_TIMER_QUEUE_CONNECTION_STRING: 'ecommerce-hang-timer-queue-connection-string'
RPT_TIMER_QUEUE_CONNECTION_STRING: 'wisp-rpt-timeout-queue-connection-string'
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
REDIS_PASSWORD: 'redis-primary-key'
REDIS_HOST: 'redis-hostname'
COSMOS_KEY: 'cosmosdb-wisp-converter-account-key'
Expand Down
13 changes: 3 additions & 10 deletions helm/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ microservice-chart: &microservice-chart
fullnameOverride: ""
image:
repository: ghcr.io/pagopa/pagopa-wisp-converter
tag: "0.4.11"
tag: "0.4.11-6-PAGOPA-2221"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -64,17 +64,11 @@ microservice-chart: &microservice-chart
envConfig: &envConfig
WEBSITE_SITE_NAME: 'pagopawispconverter' # required to show cloud role name in application insights
ENV: 'aks-uat'
APP_LOGGING_LEVEL: 'INFO'
APP_LOGGING_LEVEL: 'WARN'
APP_LOGGING_TRACING_LEVEL: 'ERROR'
DEFAULT_LOGGING_LEVEL: 'INFO'
CORS_CONFIGURATION: '{"origins": ["*"], "methods": ["*"]}'
OTEL_SERVICE_NAME: "pagopa-wisp-converter"
OTEL_RESOURCE_ATTRIBUTES: "service.environment=uat"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_TRACES_EXPORTER: otlp
OTEL_METRICS_EXPORTER: otlp
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
SERVICE_NAME: "pagopa-wisp-converter"
REDIS_PORT: "6380"
COSMOS_URI: "https://pagopa-u-weu-nodo-wispconv-cosmos-account.documents.azure.com:443/"
COSMOS_READ_REGION: "West Europe"
Expand Down Expand Up @@ -125,7 +119,6 @@ microservice-chart: &microservice-chart
SERVICE_BUS_PAAINVIART_QUEUE_CONNECTION_STRING: 'wisp-paainviart-queue-connection-string'
ECOMMERCE_HANG_TIMER_QUEUE_CONNECTION_STRING: 'ecommerce-hang-timer-queue-connection-string'
RPT_TIMER_QUEUE_CONNECTION_STRING: 'wisp-rpt-timeout-queue-connection-string'
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
REDIS_PASSWORD: 'redis-primary-key'
REDIS_HOST: 'redis-hostname'
COSMOS_KEY: 'cosmosdb-wisp-converter-account-key'
Expand Down
2 changes: 1 addition & 1 deletion openapi/openapi.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion openapi/openapi_redirect.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"openapi": "3.0.1",
"info": {
"title": "WISP-Converter-redirect",
"version": "0.4.11"
"version": "0.4.11-6-PAGOPA-2221"
},
"servers": [
{
Expand Down
13 changes: 12 additions & 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.4.11</version>
<version>0.4.11-6-PAGOPA-2221</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 Expand Up @@ -75,6 +75,17 @@
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
</dependency>

<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>applicationinsights-core</artifactId>
<version>3.6.1</version>
</dependency>


<!-- Spring utils-->
<dependency>
Expand Down
Loading