Files
iva-studio-workspace/open-telemetry/README.md
Peter.Morton 7371260442 Updated readme to match latest changes.
Not writes process/resource and additional attribute information
2026-01-10 13:53:53 -06:00

68 lines
1.6 KiB
Markdown

# Open Telemetry Example
Writes Telemetry Tracing information to the endpoint provided using the [OLTP JSON over HTTP specification](https://github.com/open-telemetry/opentelemetry-proto/blob/main/docs/specification.md#json-protobuf-encoding)
## 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:
![Tracing Screenshot](screenshots/IVA%20Tracing.png)
## Code Snippets
### Start Span
```javascript
(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
```javascript
(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();
});
```