Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/collector/test/apps/agentStub.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,16 @@ app.use(
})
);

// Use this endpoint for the "checkHost" (agentHostLookup) functionality.
app.get('/', (req, res) => {
res.json({ version: '1.1.999' });
});

// Use this endpoint to check if the instance is up or to send an exit request.
app.get('/ping', (req, res) => {
res.json({ msg: 'pong' });
});

app.put('/com.instana.plugin.nodejs.discovery', (req, res) => {
const pid = req.body.pid;

Expand Down
2 changes: 1 addition & 1 deletion packages/collector/test/apps/agentStubControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class AgentStubControls {
}

async waitUntilAgentHasStarted() {
const url = `http://127.0.0.1:${this.agentPort}`;
const url = `http://127.0.0.1:${this.agentPort}/ping`;

// eslint-disable-next-line no-console
console.log(`[AgentStubControls] starting: ${url}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const AWSAPI = {
return reject(err);
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => resolve(data))
.catch(err2 => {
log(
Expand All @@ -109,7 +109,7 @@ const AWSAPI = {
promiseData = data;
return delay(200);
})
.then(() => fetch(`http://127.0.0.1:${agentPort}`))
.then(() => fetch(`http://127.0.0.1:${agentPort}/ping`))
.then(() => {
resolve(promiseData);
})
Expand All @@ -130,7 +130,7 @@ const AWSAPI = {
log(`/${operation}/${method} got data from AWS SDK`);

await delay(200);
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);

return resolve(data);
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const DynamoDBApi = {
} else {
setTimeout(async () => {
try {
const response = await fetch(`http://127.0.0.1:${agentPort}`);
const response = await fetch(`http://127.0.0.1:${agentPort}/ping`);
const jsonData = await response.json();
resolve(jsonData);
} catch (err2) {
Expand All @@ -155,7 +155,7 @@ const DynamoDBApi = {
return delay(200);
})
.then(async () => {
const response = await fetch(`http://127.0.0.1:${agentPort}`);
const response = await fetch(`http://127.0.0.1:${agentPort}/ping`);
const jsonData = await response.json();
return jsonData;
})
Expand All @@ -179,7 +179,7 @@ const DynamoDBApi = {
}

await delay(200);
const response = await fetch(`http://127.0.0.1:${agentPort}`);
const response = await fetch(`http://127.0.0.1:${agentPort}/ping`);
const jsonData = await response.json();
resolve(jsonData);
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const DynamoDBApi = {
return reject(data);
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => resolve(data))
.catch(err2 => reject(err2));
});
Expand All @@ -153,7 +153,7 @@ const DynamoDBApi = {
promiseData = data;
return delay(200);
})
.then(() => fetch(`http://127.0.0.1:${agentPort}`))
.then(() => fetch(`http://127.0.0.1:${agentPort}/ping`))
.then(() => {
if (promiseData && promiseData.code) {
reject(promiseData);
Expand All @@ -174,7 +174,7 @@ const DynamoDBApi = {
}

await delay(200);
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);

return resolve(data);
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ operationNames.forEach(operation => {
httpError(res, err);
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => {
httpSuccess(res, data);
})
Expand All @@ -185,7 +185,7 @@ operationNames.forEach(operation => {
} else if (method === 'Promise') {
execOperation(operation, null, null, withError)
.then(data => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => {
httpSuccess(res, data);
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ operationNames.forEach(operation => {
httpError(res, err);
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => {
httpSuccess(res, data);
})
Expand All @@ -188,7 +188,7 @@ operationNames.forEach(operation => {
} else if (method === 'Promise') {
execOperation(operation, null, null, withError)
.then(data => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => {
httpSuccess(res, data);
})
Expand Down
6 changes: 3 additions & 3 deletions packages/collector/test/tracing/cloud/aws-sdk/v2/s3/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const S3Api = {
return reject(err);
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => resolve(data))
.catch(err2 => {
log(
Expand All @@ -137,7 +137,7 @@ const S3Api = {
promiseData = data;
return delay(200);
})
.then(() => fetch(`http://127.0.0.1:${agentPort}`))
.then(() => fetch(`http://127.0.0.1:${agentPort}/ping`))
.then(() => {
resolve(promiseData);
})
Expand All @@ -158,7 +158,7 @@ const S3Api = {
log(`/${operation}/${method} got data from AWS SDK`);

await delay(200);
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);

return resolve(data);
} catch (err) {
Expand Down
6 changes: 3 additions & 3 deletions packages/collector/test/tracing/cloud/aws-sdk/v2/s3/app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const S3Api = {
return reject(err);
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => resolve(data))
.catch(err2 => {
logger(
Expand All @@ -138,7 +138,7 @@ const S3Api = {
promiseData = data;
return delay(200);
})
.then(() => fetch(`http://127.0.0.1:${agentPort}`))
.then(() => fetch(`http://127.0.0.1:${agentPort}/ping`))
.then(() => {
resolve(promiseData);
})
Expand All @@ -159,7 +159,7 @@ const S3Api = {
logger(`/${operation}/${method} got data from AWS SDK`);

await delay(200);
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);

return resolve(data);
} catch (err) {
Expand Down
6 changes: 3 additions & 3 deletions packages/collector/test/tracing/cloud/aws-sdk/v2/sns/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const SNSApi = {
return reject(data);
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => resolve(data))
.catch(err2 => reject(err2));
});
Expand All @@ -96,7 +96,7 @@ const SNSApi = {
promiseData = data;
return delay(200);
})
.then(() => fetch(`http://127.0.0.1:${agentPort}`))
.then(() => fetch(`http://127.0.0.1:${agentPort}/ping`))
.then(() => {
if (promiseData && promiseData.code) {
reject(promiseData);
Expand All @@ -117,7 +117,7 @@ const SNSApi = {
}

await delay(200);
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);

return resolve(data);
} catch (err) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function receivePromise() {
})
.promise()
.then(() => delay(200))
.then(() => fetch(`http://127.0.0.1:${agentPort}`))
.then(() => fetch(`http://127.0.0.1:${agentPort}/ping`))
.then(() => delay(1000))
.then(() => {
log('The follow up request after receiving a message has happened.');
Expand Down Expand Up @@ -172,7 +172,7 @@ async function receiveAsync() {
.promise();

await delay(1000);
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);
log('The follow up request after receiving a message has happened.');
span.end();
return resolve();
Expand Down Expand Up @@ -224,7 +224,7 @@ function receiveCallback(cb) {
} else {
log('Messages deleted');
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => {
log('The follow up request after receiving a message has happened.');
span.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const consumerApp = Consumer.create({
await delay(1000);
sendToParent(message);
await delay(200);
await fetch(`http://localhost:${agentPort}?msg=${message.Body}`);
await fetch(`http://localhost:${agentPort}/ping?msg=${message.Body}`);
log(`Sent an HTTP request after receiving message of id ${message.MessageId}`);

if (withError) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ availableOperations.forEach(op => {
switch (method) {
case 'default-style':
runV3AsPromise(withError, op)
.then(data => fetch(`http://127.0.0.1:${agentPort}`).then(() => data))
.then(data => fetch(`http://127.0.0.1:${agentPort}/ping`).then(() => data))
.then(data => {
res.send({
status: 'ok',
Expand All @@ -278,7 +278,7 @@ availableOperations.forEach(op => {
break;
case 'v2-style':
runV3AsV2Style(withError, op)
.then(data => fetch(`http://127.0.0.1:${agentPort}`).then(() => data))
.then(data => fetch(`http://127.0.0.1:${agentPort}/ping`).then(() => data))
.then(data => {
res.send({
status: 'ok',
Expand All @@ -295,7 +295,7 @@ availableOperations.forEach(op => {
res.status(500).send({ error: String(err) });
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`).then(() => {
fetch(`http://127.0.0.1:${agentPort}/ping`).then(() => {
res.send({
status: 'ok',
result: data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ operationNames.forEach(operation => {
const method = req.params.method;
try {
const data = await executeOperation(operation, withError, method);
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);
httpSuccess(res, data);
} catch (err) {
httpError(res, err);
Expand Down
6 changes: 3 additions & 3 deletions packages/collector/test/tracing/cloud/aws-sdk/v3/s3/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ availableOperations.forEach(op => {
switch (method) {
case 'v3':
runV3AsPromise(withError, op)
.then(data => fetch(`http://127.0.0.1:${agentPort}`).then(() => data))
.then(data => fetch(`http://127.0.0.1:${agentPort}/ping`).then(() => data))
.then(data => {
if (op === 'getObject') {
handleGetObject(res, data);
Expand All @@ -174,7 +174,7 @@ availableOperations.forEach(op => {
break;
case 'v2':
runV3AsV2Style(withError, op)
.then(data => fetch(`http://127.0.0.1:${agentPort}`).then(() => data))
.then(data => fetch(`http://127.0.0.1:${agentPort}/ping`).then(() => data))
.then(data => {
if (op === 'getObject') {
handleGetObject(res, data);
Expand All @@ -195,7 +195,7 @@ availableOperations.forEach(op => {
res.status(500).send({ error: String(err) });
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`).then(() => {
fetch(`http://127.0.0.1:${agentPort}/ping`).then(() => {
if (op === 'getObject') {
handleGetObject(res, data);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ function httpSuccess(res, data) {
app.get('/execute', async (req, res) => {
try {
const data = await executeCommand(req.query);
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);
httpSuccess(res, data);
} catch (err) {
httpError(res, err);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ async function runAsPromise(isV2Style = false) {
return sqs
.send(deletionCommand)
.then(() => delay(200))
.then(() => fetch(`http://127.0.0.1:${agentPort}`))
.then(() => fetch(`http://127.0.0.1:${agentPort}/ping`))
.then(() => delay(1000))
.then(() => {
log('The follow up request after receiving a message has happened.');
Expand Down Expand Up @@ -218,7 +218,7 @@ async function runV3AsCallback(cb) {
sqs.send(deletionCommand, () => {
setTimeout(async () => {
try {
await fetch(`http://127.0.0.1:${agentPort}`);
await fetch(`http://127.0.0.1:${agentPort}/ping`);
setTimeout(() => {
log('The follow up request after receiving a message has happened.');
span.end();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ app.get('/send-message/:method', (req, res) => {
await delay(200);
return data;
})
.then(data => fetch(`http://127.0.0.1:${agentPort}`).then(() => data))
.then(data => fetch(`http://127.0.0.1:${agentPort}/ping`).then(() => data))
.then(data => {
res.send({
status: 'ok',
Expand All @@ -135,7 +135,7 @@ app.get('/send-message/:method', (req, res) => {
await delay(200);
return data;
})
.then(data => fetch(`http://127.0.0.1:${agentPort}`).then(() => data))
.then(data => fetch(`http://127.0.0.1:${agentPort}/ping`).then(() => data))
.then(data => {
res.send({
status: 'ok',
Expand All @@ -152,7 +152,7 @@ app.get('/send-message/:method', (req, res) => {
res.status(500).send({ error: String(err) });
} else {
setTimeout(() => {
fetch(`http://127.0.0.1:${agentPort}`)
fetch(`http://127.0.0.1:${agentPort}/ping`)
.then(() => {
res.send({
status: 'ok',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const handleMessageFn = async message => {
sendToParent(message);
await delay(200);

await fetch(`http://localhost:${agentPort}?msg=${message.Body}`);
await fetch(`http://localhost:${agentPort}/ping?msg=${message.Body}`);
log(`Sent an HTTP request after receiving message of id ${message.MessageId}`);

if (withError) {
Expand All @@ -70,7 +70,7 @@ const handleMessageBatchFn = async messages => {

messages.forEach(async function (m) {
sendToParent(m);
await fetch(`http://localhost:${agentPort}?msg=${m.Body}`);
await fetch(`http://localhost:${agentPort}/ping?msg=${m.Body}`);
log(`Sent an HTTP request after receiving message of id ${m.MessageId}`);
processed.push(m);
});
Expand Down
Loading