mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
some tracing cleanup
This commit is contained in:
@@ -184,9 +184,9 @@ class TaskGather extends Task {
|
||||
this._killAudio(cs);
|
||||
this.ep.removeAllListeners('dtmf');
|
||||
clearTimeout(this.interDigitTimer);
|
||||
this._resolve('killed');
|
||||
this.playTask?.span.end();
|
||||
this.sayTask?.span.end();
|
||||
this._resolve('killed');
|
||||
}
|
||||
|
||||
updateTimeout(timeout) {
|
||||
|
||||
@@ -44,7 +44,6 @@ class TaskSay extends Task {
|
||||
|
||||
this.logger.info({vendor, language, voice}, 'TaskSay:exec');
|
||||
this.ep = ep;
|
||||
let span;
|
||||
try {
|
||||
if (!credentials) {
|
||||
writeAlerts({
|
||||
@@ -58,11 +57,12 @@ class TaskSay extends Task {
|
||||
let lastUpdated = false;
|
||||
|
||||
/* otel: trace time for tts */
|
||||
span = this.startSpan('tts-generation', {
|
||||
const {span} = this.startChildSpan('tts-generation', {
|
||||
'tts.vendor': vendor,
|
||||
'tts.language': language,
|
||||
'tts.voice': voice
|
||||
});
|
||||
this.ttsSpan = span;
|
||||
|
||||
const filepath = (await Promise.all(this.text.map(async(text) => {
|
||||
if (this.killed) return;
|
||||
@@ -91,10 +91,10 @@ class TaskSay extends Task {
|
||||
updateSpeechCredentialLastUsed(credentials.speech_credential_sid)
|
||||
.catch(() => {/*already logged error */});
|
||||
}
|
||||
span.setAttributes({'tts.cached': servedFromCache});
|
||||
this.ttsSpan.setAttributes({'tts.cached': servedFromCache});
|
||||
return filePath;
|
||||
}))).filter((fp) => fp && fp.length);
|
||||
span?.end();
|
||||
this.ttsSpan?.end();
|
||||
this.logger.debug({filepath}, 'synthesized files for tts');
|
||||
|
||||
while (!this.killed && (this.loop === 'forever' || this.loop--) && this.ep?.connected) {
|
||||
@@ -112,7 +112,7 @@ class TaskSay extends Task {
|
||||
} while (!this.killed && ++segment < filepath.length);
|
||||
}
|
||||
} catch (err) {
|
||||
span?.end();
|
||||
this.ttsSpan?.end();
|
||||
this.logger.info(err, 'TaskSay:exec error');
|
||||
}
|
||||
this.emit('playDone');
|
||||
|
||||
Reference in New Issue
Block a user