Many of you have asked similar questions:
- How do I obtain the rendered prompt that Semantic Kernel sends to the AI service?
- How do I monitor the token usage of my application?
- How do I gain insights into Semantic Kernel’s operations during runtime?
These are all excellent questions! They fundamentally belong to the same class of questions: How do I observe Semantic Kernel and, ultimately, my application?
Introducing: Observability in Semantic Kernel
Semantic Kernel is designed to be observable. It emits logs, metrics, and traces that are compatible to the OpenTelemetry standard. You can use your favorite observability tools to monitor and analyze the behavior of your services built on Semantic Kernel.
Logging
Semantic Kernel logs meaningful events and errors from the kernel, kernel plugins and functions, as well as the AI connectors.
Metrics
Semantic Kernel emits metrics from kernel functions and AI connectors. You will be able to monitor metrics such as the kernel function execution time, the token consumption of AI connectors, etc.
Traces
Semantic Kernel supports distributed tracing. You can track activities across different services and within Semantic Kernel.
OpenTelemetry Semantic Convention
Semantic Kernel follows the OpenTelemetry Semantic Convention for Observability. This means that the logs, metrics, and traces emitted by Semantic Kernel are structured and follow a common schema. This ensures that you can more effectively analyze the telemetry data emitted by Semantic Kernel.
Please note that the Semantic Conventions for Generative AI are in experimental status. Semantic Kernel strives to follow the OpenTelemetry Semantic Convention as closely as possible, and provide a consistent and meaningful observability experience for AI solutions.
Code samples
For more details and code samples, please head over to the Semantic Kernel learn site.
The Semantic Kernel team is dedicated to empowering developers by providing access to the latest advancements in the industry. We encourage you to leverage your creativity and build remarkable solutions with SK! Please reach out if you have any questions or feedback through our Semantic Kernel GitHub Discussion Channel. We look forward to hearing from you! We would also love your support, if you’ve enjoyed using Semantic Kernel, give us a star on GitHub.
Very informative, thank you!