Repository navigation
175 lines (164 loc) · 6.4 KB
/
Copy pathsingle-existing-project.yml
File metadata and controls
175 lines (164 loc) · 6.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Load Single Existing Project
on:
workflow_call:
inputs:
duration:
description: 'Duration ("s" for seconds (the default), "m" for minutes, "h" for hours) for each collector process to run'
required: true
default: '1h'
type: string
delay_start:
description: 'Maximum delay in seconds before starting each collector'
required: true
default: '10'
type: string
numprocs:
description: 'Number of collector processes to run'
required: true
default: '5'
type: string
numparallel:
description: 'Number of parallel github actions jobs to run'
required: true
default: '20'
type: string
numpipelines:
description: 'Number of collector pipelines per configuration (otlp/1, otlp/2, etc.)'
required: true
default: '10'
type: string
collector_version:
description: 'Version of the collector to use'
required: false
type: string
output_type:
description: 'Output type for the collector (otlp or elasticsearch)'
required: true
default: 'otlp'
type: string
secrets:
ENCRYPTION_KEY:
required: true
description: 'Encryption key for GPG decryption'
single_existing_project_es_api_key:
required: false
description: 'API key for the existing Elastic Cloud observability project'
single_existing_project_es_endpoint:
required: false
description: 'Elasticsearch endpoint URL for the existing project'
single_existing_project_ingest_endpoint:
required: false
description: 'OTLP endpoint URL for the existing project'
single_existing_project_otlp_api_key:
required: false
description: 'API key for the existing project'
global_monitoring_otlp_endpoint:
required: true
description: 'OTLP endpoint URL for monitoring telemetry from the OpenTelemetry collectors'
global_monitoring_api_key:
required: true
description: 'API key for the monitoring OTLP endpoint'
jobs:
determine-collector-version:
name: Determine Collector Version
runs-on: ubuntu-latest
outputs:
collector_version: ${{ steps.determine-collector-version.outputs.collector_version }}
steps:
- name: Determine Collector Version
id: determine-collector-version
run: |
COLLECTOR_VERSION="${{ inputs.collector_version || vars.DEFAULT_COLLECTOR_VERSION }}"
echo "collector_version=$COLLECTOR_VERSION" >> $GITHUB_OUTPUT
echo "Determined collector version: $COLLECTOR_VERSION"
plan:
name: Summarize Plan
runs-on: ubuntu-latest
needs:
- determine-collector-version
steps:
- name: Summarize Plan
run: |
echo "Collector Version: ${{ needs.determine-collector-version.outputs.collector_version }}"
echo "Output Type: ${{ inputs.output_type }}"
echo "Duration: ${{ inputs.duration }}"
echo "Delay Start: ${{ inputs.delay_start }}"
echo "Collector Procs: ${{ inputs.numprocs }}"
echo "Pipelines per Collector: ${{ inputs.numpipelines }}"
echo "Parallel Jobs: ${{ inputs.numparallel }}"
echo "Total Collector Count: $(( ${{ inputs.numpipelines }} * ${{ inputs.numprocs }} * ${{ inputs.numparallel }} ))"
determine-numparallel:
name: Determine numparallel
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.determine-numparallel.outputs.matrix }}
steps:
- uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Define matrix
id: determine-numparallel
run: |
echo "matrix=$(python -c 'import json; print(json.dumps(list(range(int(${{ inputs.numparallel }})))))')" >> $GITHUB_OUTPUT
configure-collector:
name: Configure Collector
runs-on: ubuntu-latest
outputs:
matrix: ${{ needs.determine-numparallel.outputs.matrix }}
needs:
- determine-numparallel
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
fetch-depth: 1
- name: Install GPG
run: |
sudo apt update
sudo apt install -y gpg
- uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip'
- name: Install Supervisor
run: |
python -m venv .venv
source .venv/bin/activate
pip install -r confgen/requirements.txt
- name: Generate Config
id: generate-config
env:
OTLP_API_KEY: ${{ inputs.output_type == 'otlp' && secrets.single_existing_project_otlp_api_key || '' }}
OTLP_ENDPOINT: ${{ inputs.output_type == 'otlp' && secrets.single_existing_project_ingest_endpoint || '' }}
ELASTICSEARCH_API_KEY: ${{ inputs.output_type == 'elasticsearch' && secrets.single_existing_project_es_api_key || '' }}
ELASTICSEARCH_ENDPOINT: ${{ inputs.output_type == 'elasticsearch' && secrets.single_existing_project_es_endpoint || '' }}
MONITORING_OTLP_ENDPOINT: ${{ secrets.global_monitoring_otlp_endpoint }}
MONITORING_API_KEY: ${{ secrets.global_monitoring_api_key }}
numpipelines: ${{ inputs.numpipelines }}
run: |
source .venv/bin/activate
./confgen/generate-collector-config.py > config.yaml
echo ${{ secrets.ENCRYPTION_KEY }} | gpg --pinentry-mode loopback --passphrase-fd 0 -c -o config.yaml.gpg config.yaml
- name: Upload Collector Config
uses: actions/upload-artifact@v4
with:
name: collector-config
path: config.yaml.gpg
load-project:
name: Run Collectors
needs:
- configure-collector
- determine-numparallel
- determine-collector-version
uses: graphaelli/loadtel/.github/workflows/load.yml@main
with:
collector_config_artifact: collector-config
collector_version: ${{ needs.determine-collector-version.outputs.collector_version }}
delay_start: ${{ inputs.delay_start }}
duration: ${{ inputs.duration }}
matrix: ${{ needs.determine-numparallel.outputs.matrix }}
numprocs: ${{ inputs.numprocs }}
secrets:
ENCRYPTION_KEY: ${{ secrets.ENCRYPTION_KEY }}
global_monitoring_otlp_endpoint: ${{ secrets.global_monitoring_otlp_endpoint }}
global_monitoring_api_key: ${{ secrets.global_monitoring_api_key }}