Skip to content

Commit 96865a6

Browse files
authored
Add Otlp To AMP Test (#405)
1 parent 0ab9f12 commit 96865a6

File tree

6 files changed

+70
-0
lines changed

6 files changed

+70
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
extensions:
2+
pprof:
3+
endpoint: 0.0.0.0:1777
4+
receivers:
5+
otlp:
6+
protocols:
7+
grpc:
8+
endpoint: 0.0.0.0:${grpc_port}
9+
10+
processors:
11+
batch:
12+
13+
exporters:
14+
logging:
15+
loglevel: debug
16+
awsprometheusremotewrite:
17+
endpoint: ${cortex_instance_endpoint}/api/v1/remote_write
18+
aws_auth:
19+
region: ${region}
20+
service: "aps"
21+
timeout: 10s
22+
23+
service:
24+
pipelines:
25+
metrics:
26+
receivers: [otlp]
27+
processors: [batch]
28+
exporters: [awsprometheusremotewrite,logging]
29+
extensions: [pprof]
30+
telemetry:
31+
logs:
32+
level: debug
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# this file is defined in validator/src/main/resources/validations
2+
validation_config = "otlp-prometheus-validation.yml"
3+
4+
# data type will be emitted. Possible values: metric or trace
5+
soaking_data_mode = "metric"

validator/src/main/java/com/amazon/aoc/fileconfigs/PredefinedExpectedTemplate.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public enum PredefinedExpectedTemplate implements FileConfig {
2626
* metric template, defined in resources.
2727
*/
2828
AMP_EXPECTED_METRIC("/expected-data-template/ampExpectedMetric.mustache"),
29+
OTLP_TO_AMP_EXPECTED_METRIC("/expected-data-template/otlpToAMPExpectedMetric.mustache"),
2930
DEFAULT_EXPECTED_METRIC("/expected-data-template/defaultExpectedMetric.mustache"),
3031
ENHANCED_EXPECTED_METRIC("/expected-data-template/enhancedExpectedMetric.mustache"),
3132
STATSD_EXPECTED_METRIC("/expected-data-template/statsdExpectedMetric.mustache"),

validator/src/main/java/com/amazon/aoc/validators/PrometheusStaticMetricValidator.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,15 @@ public class PrometheusStaticMetricValidator implements IValidator {
4646
private FileConfig expectedMetric;
4747
private ValidationConfig validationConfig;
4848
private CortexService cortexService;
49+
private ICaller caller;
4950

5051
@Override
5152
public void validate() throws Exception {
53+
// hit the endpoint to generate data if need be
54+
if (caller != null) {
55+
log.info("Calling : {}", caller.getCallingPath());
56+
caller.callSampleApp();
57+
}
5258
log.info("Start prometheus metric validating");
5359
log.info("allow lambda function to finish running and propagate");
5460
TimeUnit.SECONDS.sleep(60);
@@ -152,5 +158,6 @@ public void init(
152158
this.cortexService = new CortexService(context);
153159
this.validationConfig = validationConfig;
154160
this.expectedMetric = expectedMetricTemplate;
161+
this.caller = caller;
155162
}
156163
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
[
2+
{
3+
"metric": {
4+
"__name__":"latency_{{testingId}}",
5+
"apiName":"/outgoing-http-call",
6+
"quantile":"0",
7+
"statusCode":"200"
8+
}
9+
},
10+
{
11+
"metric": {
12+
"__name__":"latency_{{testingId}}",
13+
"apiName":"/outgoing-http-call",
14+
"quantile":"1",
15+
"statusCode":"200"
16+
}
17+
}
18+
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
-
2+
validationType: "prom-static-metric"
3+
httpPath: "/outgoing-http-call"
4+
httpMethod: "get"
5+
callingType: "http"
6+
shouldValidateMetricValue: false
7+
expectedMetricTemplate: "OTLP_TO_AMP_EXPECTED_METRIC"

0 commit comments

Comments
 (0)