Open Telemetry Example
Writes Telemetry Tracing information to the endpoint provided using the OLTP JSON over HTTP specification
Example Usage
Use the code block widget to start and end spans.
Spans can be nested to form a stack, with the parent span being the most recent active span added to the stack. You can have multiple spans using the same name, and ending a span by name will always end the most recent span.
Spans will only be written to the opentelemetry endpoint once the endSpan method is called.
Visualization
For example, using Jaeger UI:
Code Snippets
Start Span
(async () => {
opentelemetry.startSpan("Global Flow");
})()
.catch((error) => {
console.error(error.message);
recognizedObject.answers.push("");
recognizedObject.errorInfo = {
...recognizedObject.errorInfo,
label: {
data: error.toJSON ? error.toJSON() : {},
message: error.message,
},
};
})
.finally(() => {
next();
});
End Span
(async () => {
opentelemetry.endSpan("Global Flow");
})()
.catch((error) => {
console.error(error.message);
recognizedObject.answers.push("");
recognizedObject.errorInfo = {
...recognizedObject.errorInfo,
label: {
data: error.toJSON ? error.toJSON() : {},
message: error.message,
},
};
})
.finally(() => {
next();
});
