-
Notifications
You must be signed in to change notification settings - Fork 68
Conversation
const payloads = []; | ||
|
||
app.post('/intake/v2/events', (req, res) => { | ||
console.log('Endpoint: /intake/v2/events'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console.log
statements should be removed during testing. This is only needed for debugging purposes during development
|
||
const payloads = []; | ||
|
||
app.post('/intake/v2/events', (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of listening on a single endpoint we can also listen for all endpoints:
app.post('*', ...)
and write that to file containing the endpoint.
"start": "node server.js" | ||
}, | ||
"dependencies": { | ||
"axios": "^0.19.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to self: axios
is no longer neeeded
An example of how events can be replayed from file: async function init() {
const content = await readFile('./shared-volume/events.json');
const items = JSON.parse(content.toString());
for await (let item of items) {
try {
await axios({
method: 'post',
url: `http://${APM_SERVER_HOST}:${APM_SERVER_PORT}/intake/v2/events`,
headers: { 'content-type': 'application/x-ndjson' },
data: item
});
} catch (e) {
console.log(e.response.data);
}
}
} |
I just pushed 953e691 to fix the lint defects which were detected in the CI:
|
Closing in favor of #567 |
This adds a service that replaces apm server for testing purposes. Any data sent to apm server will be written to file. This file can later be used to replay event duration test scenarios.
apm-server-proxied.json
overwriteapm-server
with the following and replaceapm-server
withapm-server-proxy
everywhere: