Skip to content

Commit ca24318

Browse files
authored
Update README.md
1 parent a56d206 commit ca24318

File tree

1 file changed

+261
-0
lines changed

1 file changed

+261
-0
lines changed

terraform/README.md

Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,267 @@ specify below config in the tfvars file
4141
6. [optional] aoc_image_repo, if you have an aoc image you just built with the new component, then set its repo name here
4242
7. [optional] aoc_version, if you have an aoc image you just built with the new component, then set it as its tag name.
4343

44+
### 1.4 you can use placeholders in your config files.
45+
46+
#### 1.4.1 otconfig
47+
48+
Below are the placeholders you can use in the otconfig
49+
50+
* region
51+
* otel_service_namespace
52+
* otel_service_name
53+
* testing_id
54+
55+
an example:
56+
57+
```yaml
58+
receivers:
59+
awsecscontainermetrics:
60+
exporters:
61+
logging:
62+
loglevel: debug
63+
awsemf:
64+
namespace: '${otel_service_namespace}/${otel_service_name}'
65+
region: '${region}'
66+
67+
service:
68+
pipelines:
69+
metrics:
70+
receivers: [awsecscontainermetrics]
71+
exporters: [logging, awsemf]
72+
```
73+
74+
#### 1.4.2 ecs task definition
75+
76+
Below are the placeholders you can use in the ecs task def.
77+
78+
* region
79+
* aoc_image
80+
* data_emitter_image
81+
* testing_id
82+
* otel_service_namespace
83+
* otel_service_name
84+
* ssm_parameter_arn
85+
* sample_app_container_name
86+
* sample_app_listen_address
87+
88+
an example:
89+
90+
```json
91+
[
92+
{
93+
"name": "${sample_app_container_name}",
94+
"image": "${data_emitter_image}",
95+
"cpu": 10,
96+
"memory": 256,
97+
"portMappings": [
98+
{
99+
"containerPort": 4567,
100+
"hostPort": 4567,
101+
"protocol": "tcp"
102+
}
103+
],
104+
"command": [],
105+
"environment": [
106+
{
107+
"name": "OTEL_EXPORTER_OTLP_ENDPOINT",
108+
"value": "127.0.0.1:55680"
109+
},
110+
{
111+
"name": "INSTANCE_ID",
112+
"value": "${testing_id}"
113+
},
114+
{
115+
"name": "OTEL_RESOURCE_ATTRIBUTES",
116+
"value": "service.namespace=${otel_service_namespace},service.name=${otel_service_name}"
117+
},
118+
{
119+
"name": "S3_REGION",
120+
"value": "${region}"
121+
},
122+
{
123+
"name": "TRACE_DATA_BUCKET",
124+
"value": "trace-expected-data"
125+
},
126+
{
127+
"name": "TRACE_DATA_S3_KEY",
128+
"value": "${testing_id}"
129+
},
130+
{
131+
"name": "LISTEN_ADDRESS",
132+
"value": "${sample_app_listen_address}"
133+
}
134+
],
135+
"dependsOn": [
136+
{
137+
"containerName": "aoc-collector",
138+
"condition": "START"
139+
}
140+
],
141+
"logConfiguration": {
142+
"logDriver": "awslogs",
143+
"options": {
144+
"awslogs-group": "/ecs/ecs-cwagent-sidecar-emitter",
145+
"awslogs-region": "${region}",
146+
"awslogs-stream-prefix": "ecs",
147+
"awslogs-create-group": "True"
148+
}
149+
}
150+
},
151+
{
152+
"name": "aoc-collector",
153+
"image": "${aoc_image}",
154+
"cpu": 10,
155+
"memory": 256,
156+
"portMappings": [
157+
{
158+
"containerPort": 55680,
159+
"hostPort": 55680,
160+
"protocol": "tcp"
161+
}
162+
],
163+
"secrets": [
164+
{
165+
"name": "AOT_CONFIG_CONTENT",
166+
"valueFrom": "${ssm_parameter_arn}"
167+
}
168+
],
169+
"essential": true,
170+
"entryPoint": [],
171+
"command": [],
172+
"environment": [],
173+
"environmentFiles": [],
174+
"dependsOn": [],
175+
"logConfiguration": {
176+
"logDriver": "awslogs",
177+
"options": {
178+
"awslogs-group": "/ecs/ecs-cwagent-sidecar-collector",
179+
"awslogs-region": "${region}",
180+
"awslogs-stream-prefix": "ecs",
181+
"awslogs-create-group": "True"
182+
}
183+
}
184+
}
185+
]
186+
```
187+
188+
#### 1.4.3 Docker compose file
189+
190+
Below are the placeholders you can use in the docker compose file
191+
192+
* data_emitter_image
193+
* sample_app_listen_address_port
194+
* listen_address
195+
* testing_id
196+
* otel_resource_attributes
197+
* otel_endpoint
198+
199+
an example:
200+
201+
```yaml
202+
version: "3.8"
203+
services:
204+
sample_app:
205+
image: ${data_emitter_image}
206+
ports:
207+
- "80:${sample_app_listen_address_port}"
208+
environment:
209+
LISTEN_ADDRESS: ${listen_address}
210+
OTEL_RESOURCE_ATTRIBUTES: ${otel_resource_attributes}
211+
INSTANCE_ID: ${testing_id}
212+
OTEL_EXPORTER_OTLP_ENDPOINT: ${otel_endpoint}
213+
healthcheck:
214+
test: ["CMD", "curl", "-f", "http://127.0.0.1:${sample_app_listen_address_port}/"]
215+
interval: 5s
216+
timeout: 10s
217+
retries: 3
218+
start_period: 10s
219+
```
220+
221+
#### 1.4.4 Eks Config
222+
223+
Below are the placeholders you can use in the EKS config.
224+
225+
* data_emitter_image
226+
* testing_id
227+
228+
an example:
229+
230+
```yaml
231+
sample_app:
232+
image: ${data_emitter_image}
233+
command:
234+
- "/bin/sh"
235+
- "-c"
236+
- "while true; do echo 'testCounter.metric_${testing_id}:1.7|c|@0.1|#key:val,key1:val1' | socat -v -t 0 - UDP:127.0.0.1:8125; sleep 1; echo 'testGauge.metric_${testing_id}:1.8|c|@0.1|#keyg:valg,keyg1:valg1' | socat -v -t 0 - UDP:127.0.0.1:8125; sleep 1; done"
237+
args: []
238+
```
239+
240+
#### 1.4.5 expected data pattern in the Validation config
241+
242+
Below are the placeholders you can use in the expected data pattern.
243+
244+
* metricNamespace
245+
* testingId
246+
247+
an example:
248+
249+
```yaml
250+
-
251+
metricName: latency_{{testingId}}
252+
namespace: {{metricNamespace}}
253+
dimensions:
254+
-
255+
name: OTLib
256+
value: cloudwatch-otel
257+
-
258+
name: apiName
259+
value: /span0
260+
-
261+
name: statusCode
262+
value: 200
263+
-
264+
metricName: latency_{{testingId}}
265+
namespace: {{metricNamespace}}
266+
dimensions:
267+
-
268+
name: OTLib
269+
value: cloudwatch-otel
270+
-
271+
name: apiName
272+
value: /span1
273+
-
274+
name: statusCode
275+
value: 200
276+
-
277+
metricName: latency_{{testingId}}
278+
namespace: {{metricNamespace}}
279+
dimensions:
280+
-
281+
name: OTLib
282+
value: cloudwatch-otel
283+
-
284+
name: apiName
285+
value: /span2
286+
-
287+
name: statusCode
288+
value: 200
289+
-
290+
metricName: latency_{{testingId}}
291+
namespace: {{metricNamespace}}
292+
dimensions:
293+
-
294+
name: OTLib
295+
value: cloudwatch-otel
296+
-
297+
name: apiName
298+
value: /
299+
-
300+
name: statusCode
301+
value: 200
302+
```
303+
304+
44305
## 2. Build Sample App
45306
46307
For any testing suite related with sdk, you are required to build a sample app.

0 commit comments

Comments
 (0)