Skip to content

Commit

Permalink
Merge pull request #109 from pagopa/PAGOPA-2178-gpd-debito-tecnico-ot…
Browse files Browse the repository at this point in the history
…timizzazione-dei-log

chore(logging): sampling and improvements for logging [PAGOPA-2178]
  • Loading branch information
jacopocarlini authored Oct 4, 2024
2 parents 9667ab1 + 3621a9a commit 1ab1440
Show file tree
Hide file tree
Showing 30 changed files with 1,799 additions and 1,570 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/release_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ on:
type: choice
description: Select the version
options:
- ''
- skip
- promote
- patch
- skip_or_promote
- new_release
- breaking_change

Expand Down Expand Up @@ -73,7 +72,7 @@ jobs:
- if: ${{ github.ref_name != 'main' }}
run: echo "SEMVER=buildNumber" >> $GITHUB_ENV

- if: ${{ inputs.version == 'skip' || inputs.version == 'promote' }}
- if: ${{ inputs.version == 'skip_or_promote' }}
run: echo "SEMVER=skip" >> $GITHUB_ENV

- id: get_semver
Expand Down
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,17 @@ RUN java -Djarmode=layertools -jar application.jar extract


FROM ghcr.io/pagopa/docker-base-springboot-openjdk17:v1.1.0@sha256:6fa320d452fa22066441f1ef292d15eb06f944bc8bca293e1a91ea460d30a613
#ADD --chown=spring:spring https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.25.1/opentelemetry-javaagent.jar .

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

# 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/ ./

EXPOSE 8080

#ENTRYPOINT ["java","-javaagent:opentelemetry-javaagent.jar","--enable-preview","org.springframework.boot.loader.JarLauncher"]
19 changes: 19 additions & 0 deletions docker/applicationinsights.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"selfDiagnostics": {
"destination": "console",
"level": "INFO"
},
"sampling": {
"requestsPerSecond": 5
},
"preview": {
"sampling": {
"overrides": [
{
"telemetryKind": "exception",
"percentage": 100
}
]
}
}
}
13 changes: 8 additions & 5 deletions docker/run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,27 @@ if test -f "$FILE"; then
rm .env
fi
config=$(yq -r '."microservice-chart".envConfig' ../helm/values-$ENV.yaml)
for line in $(echo $config | jq -r '. | to_entries[] | select(.key) | "\(.key)=\(.value)"'); do
echo $line >> .env
IFS=$'\n'
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


stack_name=$(cd .. && basename "$PWD")
docker compose -p "${stack_name}" up -d --remove-orphans --force-recreate --build


# waiting the containers
printf 'Waiting for the service'
attempt_counter=0
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-gpd-payments
description: Microservice that exposes API for payment receipts retrieving and other operations
type: application
version: 0.102.0
appVersion: 0.12.28
version: 0.112.0
appVersion: 0.12.28-10-PAGOPA-2178-gpd-debito-tecnico-ottimizzazione-dei-log
dependencies:
- name: microservice-chart
version: 2.4.0
Expand Down
9 changes: 8 additions & 1 deletion 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-gpd-payments
tag: "0.12.28"
tag: "0.12.28-10-PAGOPA-2178-gpd-debito-tecnico-ottimizzazione-dei-log"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -62,6 +62,7 @@ microservice-chart:
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
ENV: 'dev'
WEBSITE_SITE_NAME: 'pagopa-d-gpd-payments-service'
PAA_ID_INTERMEDIARIO: "15376371009"
PAA_STAZIONE_INT: "15376371009_01"
Expand All @@ -83,6 +84,11 @@ microservice-chart:
QUEUE_RECEIVE_INVISIBILITY_TIME: "300"
CRON_JOB_SCHEDULE_RETRY_ENABLED: "true"
CRON_JOB_SCHEDULE_RETRY_TRIGGER: "0 0 0,6,12,18 * * *"
OTEL_SERVICE_NAME: "pagopa-gpd-payments"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=dev"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
envSecret:
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'ai-d-connection-string'
Expand All @@ -91,6 +97,7 @@ microservice-chart:
GPS_SUBSCRIPTION_KEY: "gpd-d-gps-subscription-key"
AZURE_TABLES_CONNECTION_STRING: "gpd-payments-d-cosmos-connection-string"
QUEUE_CONNECTION_STRING: "gpd-payments-d-queue-connection-string"
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
keyvault:
name: "pagopa-d-gps-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
Expand Down
9 changes: 8 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-gpd-payments
tag: "0.12.28"
tag: "0.12.28-10-PAGOPA-2178-gpd-debito-tecnico-ottimizzazione-dei-log"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -62,6 +62,7 @@ microservice-chart:
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
ENV: 'prod'
WEBSITE_SITE_NAME: 'pagopa-p-gpd-payments-service'
PAA_ID_INTERMEDIARIO: "15376371009"
PAA_STAZIONE_INT: "15376371009_01"
Expand All @@ -83,6 +84,11 @@ microservice-chart:
QUEUE_RECEIVE_INVISIBILITY_TIME: "300"
CRON_JOB_SCHEDULE_RETRY_ENABLED: "true"
CRON_JOB_SCHEDULE_RETRY_TRIGGER: "0 0 0,6,12,18 * * *"
OTEL_SERVICE_NAME: "pagopa-gpd-payments"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=uat"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
envSecret:
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'ai-p-connection-string'
Expand All @@ -91,6 +97,7 @@ microservice-chart:
GPS_SUBSCRIPTION_KEY: "gpd-p-gps-subscription-key"
AZURE_TABLES_CONNECTION_STRING: "gpd-payments-p-cosmos-connection-string"
QUEUE_CONNECTION_STRING: "gpd-payments-p-queue-connection-string"
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
keyvault:
name: "pagopa-p-gps-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
Expand Down
9 changes: 8 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-gpd-payments
tag: "0.12.28"
tag: "0.12.28-10-PAGOPA-2178-gpd-debito-tecnico-ottimizzazione-dei-log"
pullPolicy: Always
livenessProbe:
httpGet:
Expand Down Expand Up @@ -62,6 +62,7 @@ microservice-chart:
type: Utilization # Allowed types are 'Utilization' or 'AverageValue'
value: "75"
envConfig:
ENV: 'uat'
WEBSITE_SITE_NAME: 'pagopa-u-gpd-payments-service'
PAA_ID_INTERMEDIARIO: "15376371009"
PAA_STAZIONE_INT: "15376371009_01"
Expand All @@ -83,6 +84,11 @@ microservice-chart:
QUEUE_RECEIVE_INVISIBILITY_TIME: "300"
CRON_JOB_SCHEDULE_RETRY_ENABLED: "true"
CRON_JOB_SCHEDULE_RETRY_TRIGGER: "0 0 0,6,12,18 * * *"
OTEL_SERVICE_NAME: "pagopa-gpd-payments"
OTEL_RESOURCE_ATTRIBUTES: "deployment.environment=prod"
OTEL_EXPORTER_OTLP_ENDPOINT: "http://otel-collector.elastic-system.svc:4317"
OTEL_LOGS_EXPORTER: none
OTEL_TRACES_SAMPLER: "always_on"
envSecret:
# required
APPLICATIONINSIGHTS_CONNECTION_STRING: 'ai-u-connection-string'
Expand All @@ -91,6 +97,7 @@ microservice-chart:
GPS_SUBSCRIPTION_KEY: "gpd-u-gps-subscription-key"
AZURE_TABLES_CONNECTION_STRING: "gpd-payments-u-cosmos-connection-string"
QUEUE_CONNECTION_STRING: "gpd-payments-u-queue-connection-string"
OTEL_EXPORTER_OTLP_HEADERS: elastic-apm-secret-token
keyvault:
name: "pagopa-u-gps-kv"
tenantId: "7788edaf-0346-4068-9d79-c868aed15b3d"
Expand Down
Loading

0 comments on commit 1ab1440

Please sign in to comment.