Skip to content

Commit

Permalink
chore: Alert OPEX x apim V2 (#115)
Browse files Browse the repository at this point in the history
* alert OPEX x apim V2

* fix
  • Loading branch information
pasqualespica authored Jun 17, 2024
1 parent 9326c49 commit caf3ea9
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 83 deletions.
88 changes: 5 additions & 83 deletions .github/workflows/create_dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,6 @@ name: Create Dashboard
# Controls when the workflow will run
on:
workflow_dispatch:
# inputs:
# api-name:
# description: 'Api name for which create dashboards and alerts'
# required: true
# type: choice
# options:
# - pdf-engine-service
# environment:
# description: 'Environment for which create dashboards and alerts'
# required: true
# type: choice
# options:
# - uat
# - prod
# config-options:
# description: 'JSON string containing env properties that will be replaced into opex config.yaml file before dashboard generation'
# type: string
# required: false
# config-options-node:
# description: 'JSON string containing env properties that will be replaced into opex config.yaml file before dashboard generation'
# type: string
# required: false

# repository_dispatch:
# types:
# - create-dashboard

# env:
# TEMPLATE_DIR: azure-dashboard

permissions:
id-token: write
Expand All @@ -43,10 +14,12 @@ jobs:
dashboard:
# The type of runner that the job will run on
runs-on: ubuntu-22.04

strategy:
matrix:
environment: [uat, prod]
product: [pdf-engine-service, pdf-engine-service-node]
environment: [prod]
product: [pdf-engine-service, pdf-engine-service-node, pdf-engine-service-apimv2, pdf-engine-service-node-apimv2]
max-parallel: 1
environment:
name: ${{ matrix.environment }}
# Steps represent a sequence of tasks that will be executed as part of the job
Expand All @@ -59,7 +32,7 @@ jobs:
persist-credentials: false

# from https://github.com/pagopa/opex-dashboard-azure-action/
- uses: pagopa/opex-dashboard-azure-action@ece3bc2b133be74cabb50aec14cdb9b8051b886f # v1.1.2
- uses: pagopa/[email protected]
with:
environment: ${{ matrix.environment }}
api-name: ${{ matrix.product }}
Expand All @@ -69,54 +42,3 @@ jobs:
subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
# from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action
docker-version: sha256:e4245954566cd3470e1b5527d33bb58ca132ce7493eac01be9e808fd25a11c8d

# - name: Read create dashboard parameters
# id: read_parameters
# uses: actions/[email protected]
# env:
# # API_NAME: ${{ github.event.client_payload.api-name || inputs.api-name }}
# api-name: ${{ matrix.product }}
# ENVIRONMENT: ${{ github.event.client_payload.environment || inputs.environment }}
# with:
# script: |
# const { API_NAME, ENVIRONMENT } = process.env
# var apiName = API_NAME.trim();
# var environment = ENVIRONMENT.trim();
# core.info(`Api name ${apiName}, environment: ${environment}`);
# if (!apiName || !environment) {
# throw `Could not create dashboard, cannot find parameters for api name and environment...`;
# }
# core.setOutput("apiName", apiName);
# core.setOutput("environment", environment);

# - name: Replace opex config file parameters java
# id: replace_opex_file_parameters_java
# env:
# CONFIG_FILE: .opex/${{ steps.read_parameters.outputs.apiName }}/env/${{ steps.read_parameters.outputs.environment }}/config.yaml
# CONFIG_OPTIONS: ${{ github.event.client_payload.config-options || inputs.config-options }}
# run: |
# echo "📝 Replacing config yaml placeholders"
# echo "Properties to be set: $CONFIG_OPTIONS into file $CONFIG_FILE"
# for property in $(echo $CONFIG_OPTIONS | yq -o shell); do
# IFS='=' read -r -a split <<< "$property"
# key=${split[0]}
# value=$(echo ${split[1]}|sed "s/'//g")
# echo "Replacing key: [$key] with value: [$value]"
# sed -i "s/\${$key}/$value/" $CONFIG_FILE
# done
# echo "Modified config file"
# cat $CONFIG_FILE

# # this action create a folder named /azure-dashboard
# # from https://github.com/pagopa/opex-dashboard-azure-action/commits/main
# - name: create-dashboard-java
# uses: pagopa/opex-dashboard-azure-action@3ad80a5e4a2d5a8f342615637072f21b687320ce
# with:
# environment: ${{ steps.read_parameters.outputs.environment }}
# api-name: ${{ steps.read_parameters.outputs.apiName }}
# config: .opex/${{ steps.read_parameters.outputs.apiName }}/env/${{ steps.read_parameters.outputs.environment }}/config.yaml
# client-id: ${{ secrets.CLIENT_ID }}
# tenant-id: ${{ secrets.TENANT_ID }}
# subscription-id: ${{ secrets.SUBSCRIPTION_ID }}
# # from https://github.com/pagopa/opex-dashboard-azure-action/pkgs/container/opex-dashboard-azure-action
# docker-version: sha256:04d8ead53c772d23b094c2a395292dc159e6f2905e1b13b5f828f31eac6eb27f
1 change: 1 addition & 0 deletions .opex/pdf-engine-service-apimv2/env/prod/backend.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subscription=PROD-pagoPA
4 changes: 4 additions & 0 deletions .opex/pdf-engine-service-apimv2/env/prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformprod"
container_name = "azurermstate"
key = "opex.pagopa-pdf-engine-apimv2.terraform.tfstate"
23 changes: 23 additions & 0 deletions .opex/pdf-engine-service-apimv2/env/prod/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# oa3_spec: https://raw.githubusercontent.com/pagopa/pagopa-infra/main/src/domains/shared-app/api/pdf-engine/v1/_openapi.json.tpl # If start with http the file would be downloaded from the internet
oa3_spec: ./openapi/openapi.json
name: opex_pagopa-pdf-engine-apimv2
location: West Europe
timespan: 5m
# data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-vnet-rg/providers/Microsoft.Network/applicationGateways/pagopa-p-app-gw
# resource_type: app-gateway
# data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-apim
data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-weu-core-apim-v2
resource_type: api-management
action_groups:
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/PagoPA
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/SlackPagoPA
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/Opsgenie
overrides:
hosts:
- api.platform.pagopa.it
endpoints:
/shared/pdf-engine/v1/generate-pdf:
response_time_threshold: 8 # Default: 1
response_time_evaluation_frequency: 10 # Default: 10
response_time_evaluation_time_window: 30 # Default: 20
response_time_event_occurrences: 5 # Default: 1
11 changes: 11 additions & 0 deletions .opex/pdf-engine-service-apimv2/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix = "pagopa"
env_short = "p"


tags = {
CreatedBy = "Terraform"
Environment = "Prod"
Owner = "pagoPA"
Source = "https://github.com/pagopa/pagopa-pdf-engine"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}
1 change: 1 addition & 0 deletions .opex/pdf-engine-service-node-apimv2/env/prod/backend.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
subscription=PROD-pagoPA
4 changes: 4 additions & 0 deletions .opex/pdf-engine-service-node-apimv2/env/prod/backend.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource_group_name = "io-infra-rg"
storage_account_name = "pagopainfraterraformprod"
container_name = "azurermstate"
key = "opex.pagopa-pdf-engine-node-apimv2.terraform.tfstate"
23 changes: 23 additions & 0 deletions .opex/pdf-engine-service-node-apimv2/env/prod/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# oa3_spec: https://raw.githubusercontent.com/pagopa/pagopa-infra/main/src/domains/shared-app/api/pdf-engine-node/v1/_openapi.json.tpl # If start with http the file would be downloaded from the internet
oa3_spec: ./openapi/openapi_node.json
name: opex_pagopa-pdf-engine-node-apimv2
location: West Europe
timespan: 5m
# data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-vnet-rg/providers/Microsoft.Network/applicationGateways/pagopa-p-app-gw
# resource_type: app-gateway
# data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-apim
data_source: /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-api-rg/providers/Microsoft.ApiManagement/service/pagopa-p-weu-core-apim-v2
resource_type: api-management
action_groups:
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/PagoPA
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/SlackPagoPA
- /subscriptions/b9fc9419-6097-45fe-9f74-ba0641c91912/resourceGroups/pagopa-p-monitor-rg/providers/microsoft.insights/actionGroups/Opsgenie
overrides:
hosts:
- api.platform.pagopa.it
endpoints:
/shared/pdf-engine-node/v1/generate-pdf:
response_time_threshold: 8 # Default: 1
response_time_evaluation_frequency: 10 # Default: 10
response_time_evaluation_time_window: 30 # Default: 20
response_time_event_occurrences: 5 # Default: 1
11 changes: 11 additions & 0 deletions .opex/pdf-engine-service-node-apimv2/env/prod/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
prefix = "pagopa"
env_short = "p"


tags = {
CreatedBy = "Terraform"
Environment = "Prod"
Owner = "pagoPA"
Source = "https://github.com/pagopa/pagopa-pdf-engine"
CostCenter = "TS310 - PAGAMENTI & SERVIZI"
}

0 comments on commit caf3ea9

Please sign in to comment.