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