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

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

Closed
GalRabin opened this issue Jul 12, 2023 · 1 comment
Labels
duplicate This issue or pull request already exists triage

Comments

@GalRabin
Copy link

Hello Semantic Kernel team,

I would like to propose a feature to enhance the Semantic Kernel library. The proposal is to add support for custom Meter objects from the System.Diagnostics.Metrics namespace in .NET, which is the standard metrics API.

The use case for this feature is to allow library users to capture and analyze metrics in their preferred metrics backend (Prometheus, Jaeger, etc.) via OpenTelemetry or other telemetry libraries. This would enable users to monitor performance, identify issues early, and gain insights into how their applications are being used.

To implement this feature, I suggest that the Builder class (or whatever class is used to configure the Semantic Kernel library) includes a withMeter(Meter meter) method, where Meter is an instance of System.Diagnostics.Metrics.Meter. This will allow users to pass in a custom Meter during configuration.

The code could look something like this:

var meter = new Meter("MyApplication", "1.0.0");
var builder = new SemanticKernelBuilder()
    .withMeter(meter)
    // other configuration...
    .build();

In the Semantic Kernel library code, you would use this Meter to create and record metrics:

var counter = this.meter.CreateCounter<long>("my-counter");

// In relevant parts of the library:
counter.Add(1);

This feature would not impose any specific telemetry library or backend on Semantic Kernel users. Instead, it would provide the flexibility for users to choose how they want to capture, export, and analyze metrics.

Thank you for considering this feature request.

@dmytrostruk dmytrostruk added the duplicate This issue or pull request already exists label Jul 12, 2023
@dmytrostruk
Copy link
Member

Hi @GalRabin , thank you for your proposal.
This issue already exists and already handled using the same approach. Please check the following links.

Issue:
#1651

PR:
#1905

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 triage
Projects
None yet
Development

No branches or pull requests

3 participants