Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Add Meter to Kernel #1969

Closed
wants to merge 13 commits into from
Closed

Conversation

GalRabin
Copy link

Motivation and Context

This pull request addresses the need for metrics support in the Semantic Kernel library.

  1. Why is this change required? - Metrics are essential for monitoring the performance and overall health of applications. They provide insights to understand system behavior in production, and they allow us to identify and troubleshoot issues before they impact users. However, the Semantic Kernel library currently lacks built-in metrics support.

  2. What problem does it solve? - This PR adds metrics support to the Semantic Kernel library, allowing users to monitor the library's performance and usage in their applications.

  3. What scenario does it contribute to? - This feature will be particularly useful in scenarios where users need to analyze the usage and performance of the Semantic Kernel library in their applications. This could include tracking how often certain features are used, how long operations take, or how often errors occur.

  4. Linked Issue - Related to issue Feature Request: Add Metrics Support via .NET's Built-In Meter to Semantic Kernel Library #1966 .

Description

This PR adds support for the .NET System.Diagnostics.Metrics.Meter API in the Semantic Kernel library. A new withMeter(Meter meter) method has been added to the Builder class, allowing users to pass in a custom Meter instance when configuring the Semantic Kernel library.

In the Semantic Kernel library code, this Meter is used to create and update metrics. Currently, a simple counter named "my-counter" is created as an example. Users can use a MeterListener to listen to these metrics and export them to their desired backend.

The overall design follows the common pattern of passing a Meter to the components that need to record metrics, allowing these components to remain decoupled from the specifics of metric collection and export.

Contribution Checklist

@GalRabin GalRabin requested a review from a team as a code owner July 12, 2023 14:57
@shawncal shawncal added .NET Issue or Pull requests regarding .NET code kernel.core labels Jul 12, 2023
@shawncal shawncal changed the title Add Meter to Kernel .Net: Add Meter to Kernel Jul 12, 2023
Copy link
Member

@dmytrostruk dmytrostruk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @GalRabin !
Metering is already implemented in previous PR, please take a look by following link: #1905.

@dmytrostruk dmytrostruk added the duplicate This issue or pull request already exists label Jul 12, 2023
@GalRabin GalRabin closed this Jul 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants