Add initial Activity / Metric support (#183)
This commit is contained in:
parent
674cb1515c
commit
4b38d3e71b
1 changed files with 443 additions and 61 deletions
29
src/ModelContextProtocol/Diagnostics.cs
Normal file
29
src/ModelContextProtocol/Diagnostics.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics.Metrics;
|
||||
|
||||
namespace ModelContextProtocol;
|
||||
|
||||
internal static class Diagnostics
|
||||
{
|
||||
internal static ActivitySource ActivitySource { get; } = new("ModelContextProtocol");
|
||||
|
||||
/// <summary>
|
||||
/// Follows boundaries from http.server.request.duration/http.client.request.duration
|
||||
/// </summary>
|
||||
internal static InstrumentAdvice<double> ShortSecondsBucketBoundaries { get; } = new()
|
||||
{
|
||||
HistogramBucketBoundaries = [0.005, 0.01, 0.025, 0.05, 0.075, 0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10],
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Not based on a standard. Larger bucket sizes for longer lasting operations, e.g. HTTP connection duration.
|
||||
/// See https://github.com/open-telemetry/semantic-conventions/issues/336
|
||||
/// </summary>
|
||||
internal static InstrumentAdvice<double> LongSecondsBucketBoundaries { get; } = new()
|
||||
{
|
||||
HistogramBucketBoundaries = [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1, 2, 5, 10, 30, 60, 120, 300],
|
||||
};
|
||||
|
||||
internal static Meter Meter { get; } = new("ModelContextProtocol");
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue