mirror of
https://github.com/openmhz/trunk-server.git
synced 2026-11-20 20:55:54 -05:00
remove spans
This commit is contained in:
@@ -70,16 +70,15 @@ exports.upload = async function (req, res, next) {
|
||||
}
|
||||
|
||||
let item = null;
|
||||
const ctx = propagation.setBaggage(
|
||||
context.active(),
|
||||
propagation.createBaggage({
|
||||
for_the_children: { shortName: shortName, talkgroupNum: talkgroupNum, startTime: startTime },
|
||||
}),
|
||||
);
|
||||
const span = opentelemetry.trace.getActiveSpan();
|
||||
span.setAttribute('call.shortName', shortName);
|
||||
span.setAttribute('call.talkgroupNum', talkgroupNum);
|
||||
span.setAttribute('call.startTime', startTime);
|
||||
|
||||
|
||||
|
||||
// Validate that the system exists and the API key is correct
|
||||
context.with(ctx, () => {
|
||||
tracer.startActiveSpan('validate-system', async (span) => {
|
||||
|
||||
try {
|
||||
item = await System.findOne({ 'shortName': shortName }, ["key", "ignoreUnknownTalkgroup"]);
|
||||
} catch (err) {
|
||||
@@ -90,7 +89,6 @@ exports.upload = async function (req, res, next) {
|
||||
console.warn("[" + req.params.shortName + "] Error /:shortName/upload - Error: " + err);
|
||||
res.status(500);
|
||||
res.send("Error, invalid shortName:\n" + err);
|
||||
span.end();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,7 +100,6 @@ exports.upload = async function (req, res, next) {
|
||||
console.info("[" + req.params.shortName + "] Error /:shortName/upload ShortName does not exist");
|
||||
res.status(500);
|
||||
res.send("ShortName does not exist: " + shortName + "\n");
|
||||
span.end();
|
||||
return;
|
||||
}
|
||||
if (apiKey != item.key) {
|
||||
@@ -113,7 +110,6 @@ exports.upload = async function (req, res, next) {
|
||||
console.warn("[" + req.params.shortName + "] Error /:shortName/upload API Key Mismatch - Provided key: " + apiKey);
|
||||
res.status(500);
|
||||
res.send("API Keys do not match!\n");
|
||||
span.end();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -124,7 +120,6 @@ exports.upload = async function (req, res, next) {
|
||||
message: "Sensitive Talkgroup",
|
||||
});
|
||||
res.status(200).end();
|
||||
span.end();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -148,7 +143,7 @@ exports.upload = async function (req, res, next) {
|
||||
code: opentelemetry.SpanStatusCode.ERROR,
|
||||
message: "Ignore Unknown Talkgroup Set - Talkgroup does not exist: " + talkgroupNum + " ShortName: " + shortName,
|
||||
});
|
||||
span.end();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -157,9 +152,7 @@ exports.upload = async function (req, res, next) {
|
||||
|
||||
|
||||
res.status(200).end();
|
||||
span.end();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var local_path = "/" + shortName + "/" + time.getFullYear() + "/" + (time.getMonth() + 1) + "/" + time.getDate() + "/";
|
||||
var object_key = "media/" + shortName + "-" + talkgroupNum + "-" + startTime + path.extname(req.file.originalname);
|
||||
@@ -186,9 +179,7 @@ exports.upload = async function (req, res, next) {
|
||||
len: -1
|
||||
});
|
||||
|
||||
// Upload the file to S3
|
||||
context.with(ctx, () => {
|
||||
tracer.startActiveSpan('upload-call', async (span) => {
|
||||
|
||||
try {
|
||||
if (req.body.call_length) {
|
||||
call.len = parseFloat(req.body.call_length);
|
||||
@@ -207,7 +198,6 @@ exports.upload = async function (req, res, next) {
|
||||
code: opentelemetry.SpanStatusCode.ERROR,
|
||||
message: "Unable to open file: " + req.file.path + " Error: " + err,
|
||||
});
|
||||
span.end();
|
||||
console.error("[" + call.shortName + "] Unable to open file: " + req.file.path + " Error: " + err);
|
||||
return;
|
||||
}
|
||||
@@ -236,13 +226,7 @@ exports.upload = async function (req, res, next) {
|
||||
error: "File Upload"
|
||||
}));*/
|
||||
}
|
||||
span.end();
|
||||
});
|
||||
});
|
||||
|
||||
// Save Call to the database
|
||||
context.with(ctx, () => {
|
||||
tracer.startActiveSpan('save-call', async (span) => {
|
||||
try {
|
||||
await call.save();
|
||||
sysStats.addCall(call.toObject());
|
||||
@@ -272,12 +256,5 @@ exports.upload = async function (req, res, next) {
|
||||
} catch (err) {
|
||||
console.warn("There was an Error uploading an deleting: " + req.file.path);
|
||||
};
|
||||
|
||||
span.end();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -33,6 +33,10 @@ services:
|
||||
- ${PWD}/data/certbot/www/:/var/www/certbot/:rw
|
||||
- ${PWD}/data/certbot/conf/:/etc/letsencrypt/:rw
|
||||
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
|
||||
logging:
|
||||
driver: syslog
|
||||
options:
|
||||
tag: "mongo"
|
||||
|
||||
mongo:
|
||||
build:
|
||||
|
||||
Reference in New Issue
Block a user