Skip to content

Commit

Permalink
Modify the Soak Tests for ADOT JS Downstream
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanielRN committed Sep 22, 2021
1 parent 59b4b9a commit dc9f32d
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 49 deletions.
45 changes: 8 additions & 37 deletions .github/workflows/soak-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ on:
- cron: '0 15 * * *'
env:
# NOTE: The configuration of `APP_PROCESS_EXECUTABLE_NAME` is repo dependent
APP_PROCESS_EXECUTABLE_NAME: python3
APP_PROCESS_EXECUTABLE_NAME: node
AWS_DEFAULT_REGION: us-east-1
DEFAULT_TEST_DURATION_MINUTES: 300
HOSTMETRICS_INTERVAL_SECS: 600
CPU_LOAD_THRESHOLD: 71
TOTAL_MEMORY_THRESHOLD: 2147483648
CPU_LOAD_THRESHOLD: 65
TOTAL_MEMORY_THRESHOLD: 1610612736 # 1.5 GiB
MAX_BENCHMARKS_TO_KEEP: 100
# TODO: We might be able to adapt the "Soak Tests" to be "Overhead Tests".
# This means monitoring the Sample App's performance using high levels of TPS
Expand All @@ -42,11 +42,11 @@ jobs:
strategy:
fail-fast: false
matrix:
app-platform: [ flask ]
instrumentation-type: [ auto, manual, none ]
app-platform: [ http ]
instrumentation-type: [ manual ]
env:
# NOTE: The configuration of `APP_PATH` is repo dependent
APP_PATH: integration-test-apps/${{ matrix.instrumentation-type}}-instrumentation/${{ matrix.app-platform }}
APP_PATH: sample-apps
LOGS_NAMESPACE: ${{ github.repository }}/soak-tests-${{ matrix.app-platform }}-${{ matrix.instrumentation-type }}
steps:
# MARK: - GitHub Workflow Event Type Specific Values
Expand All @@ -71,41 +71,12 @@ jobs:

# NOTE: The configuration of `APP_PROCESS_COMMAND_LINE_DIMENSION_VALUE` is
# repo dependent
- name: Configure Auto Instrumentation-Type Specific Values
if: ${{ matrix.instrumentation-type == 'auto' }}
run: |
echo 'APP_PROCESS_COMMAND_LINE_DIMENSION_VALUE<<EOF' >> $GITHUB_ENV
echo '/usr/local/bin/python3 application.py' | tee --append $GITHUB_ENV;
echo 'EOF' >> $GITHUB_ENV
- name: Configure Manual Instrumentation-Type Specific Values
if: ${{ matrix.instrumentation-type == 'manual' ||
matrix.instrumentation-type == 'none' }}
if: ${{ matrix.instrumentation-type == 'manual' }}
run: |
echo 'APP_PROCESS_COMMAND_LINE_DIMENSION_VALUE<<EOF' >> $GITHUB_ENV
echo '/usr/local/bin/python3 /app/application.py' | tee --append $GITHUB_ENV;
echo 'node server.js' | tee --append $GITHUB_ENV;
echo 'EOF' >> $GITHUB_ENV
# FIXME: This uses the latest Commit SHA of the upstream Core repo. We
# should provide it as an input to consider the edge case where we want to
# run against a specific Core repo change. For the manual
# instrumentation app.
# FIXME: We might also consider making this configurable for the
# Auto-Instrumentation app.
- name: Clone OpenTelemetry Core Repo
uses: actions/checkout@v2
if: ${{ matrix.instrumentation-type == 'manual' }}
with:
repository: open-telemetry/opentelemetry-python
path: ${{ env.APP_PATH }}/opentelemetry-python-core
# FIXME: This uses the latest Commit SHA of the upstream Contrib repo. We
# should provide it as an input to consider the edge case where we want to
# run against a specific Contrib repo change. For the manual
# instrumentation app.
- name: Clone OpenTelemetry Contrib Repo
uses: actions/checkout@v2
if: ${{ matrix.instrumentation-type == 'manual' }}
with:
repository: open-telemetry/opentelemetry-python-contrib
path: ${{ env.APP_PATH }}/opentelemetry-python-contrib
# MARK: - Build and Push Sample App

Expand Down
4 changes: 0 additions & 4 deletions sample-apps/create-a-meter.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
'use strict';

// OTel JS - API
// const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api');
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR);

const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-grpc');
const { MeterProvider } = require('@opentelemetry/sdk-metrics-base');
const { Resource } = require('@opentelemetry/resources');
Expand Down
5 changes: 1 addition & 4 deletions sample-apps/create-a-tracer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@

// OTel JS - API
const { trace } = require('@opentelemetry/api');
// const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api');
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR);

// OTel JS - Core
const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { SimpleSpanProcessor, ConsoleSpanExporter } = require('@opentelemetry/sdk-trace-base');
const { SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');

// OTel JS - Core - Exporters
const { CollectorTraceExporter } = require('@opentelemetry/exporter-collector-grpc');
Expand Down Expand Up @@ -51,7 +49,6 @@ const tracerProvider = new NodeTracerProvider({
]
});

tracerProvider.addSpanProcessor(new SimpleSpanProcessor(new ConsoleSpanExporter()));
// Expects Collector at env variable `OTEL_EXPORTER_OTLP_ENDPOINT`, otherwise, http://localhost:4317
tracerProvider.addSpanProcessor(new SimpleSpanProcessor(new CollectorTraceExporter()));

Expand Down
2 changes: 0 additions & 2 deletions sample-apps/get-meter-emit-functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ module.exports = (meter) => {

//** emitsPayLoadMetrics() Binds payload Metric with number of bytes */
function emitsPayloadMetric(bytes, apiName, statusCode) {
console.log('emit metric with http request size ' + bytes + ' byte, ' + apiName);
const labels = { 'apiName': apiName, 'statusCode': statusCode };
payloadMetric.bind(labels).add(bytes);
}

//** binds request latency metric with returnTime */
function emitReturnTimeMetric(returnTime, apiName, statusCode) {
console.log('emit metric with return time ' + returnTime + ', ' + apiName + ', ' + statusCode);
const labels = { 'apiName': apiName, 'statusCode': statusCode };
requestLatency.bind(labels).record(returnTime);
}
Expand Down
2 changes: 0 additions & 2 deletions sample-apps/send-metrics-app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict';

// OTel JS - API
// const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api');
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR);

const { CollectorMetricExporter } = require('@opentelemetry/exporter-collector-grpc');
const { MeterProvider } = require('@opentelemetry/metrics');
Expand Down
17 changes: 17 additions & 0 deletions sample-apps/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@

'use strict';

const { diag, DiagConsoleLogger, DiagLogLevel } = require("@opentelemetry/api");
// diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.ERROR);

const my_meter = require('./create-a-meter');
const { emitsPayloadMetric, emitReturnTimeMetric } = require('./get-meter-emit-functions')(my_meter)

Expand All @@ -28,6 +31,8 @@ const AWS = require('aws-sdk');

const api = require('@opentelemetry/api');

const shouldSampleAppLog = (process.env.SAMPLE_APP_LOG_LEVEL || "INFO") == "INFO"

function startServer(address) {
const [hostname, port] = address.split(':');
const server = http.createServer(handleRequest);
Expand All @@ -43,18 +48,30 @@ function handleRequest(req, res) {
const requestStartTime = new Date().getMilliseconds();
try {
if (req.url === '/') {
if (shouldSampleAppLog) {
console.log("Responding to /");
}

res.end('healthcheck');
}

else if (req.url === '/aws-sdk-call') {
const s3 = new AWS.S3();
s3.listBuckets(() => {
if (shouldSampleAppLog) {
console.log("Responding to /aws-sdk-call");
}

res.end(getTraceIdJson());
});
}

else if (req.url === '/outgoing-http-call') {
http.get('http://aws.amazon.com', () => {
if (shouldSampleAppLog) {
console.log("Responding to /outgoing-http-call");
}

res.end(getTraceIdJson());
emitsPayloadMetric(res._contentLength + mimicPayLoadSize(), '/outgoing-http-call', res.statusCode);
emitReturnTimeMetric(new Date().getMilliseconds() - requestStartTime, '/outgoing-http-call', res.statusCode);
Expand Down

0 comments on commit dc9f32d

Please sign in to comment.