mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
add historgram in program
This commit is contained in:
@@ -89,9 +89,13 @@ builder.Services.AddOpenTelemetry()
|
||||
var app = builder.Build();
|
||||
|
||||
greeterMeter.CreateObservableGauge("ThreadCount", () => new[] { new Measurement<int>(ThreadPool.ThreadCount) });
|
||||
|
||||
var histogram = greeterMeter.CreateHistogram<int>("greetings.size", "Size of greetings", "desc");
|
||||
|
||||
var countGreetings = greeterMeter.CreateCounter<int>("greetings.count", description: "Counts the number of greetings");
|
||||
|
||||
|
||||
|
||||
// Custom ActivitySource for the application
|
||||
var greeterActivitySource = new ActivitySource("OtPrGrJa.Example");
|
||||
|
||||
@@ -110,6 +114,7 @@ async Task<String> SendGreeting(ILogger<Program> logger)
|
||||
// Add a tag to the Activity
|
||||
activity?.SetTag("greeting", "Hello World!");
|
||||
|
||||
histogram.Record("Hello World!".Length);
|
||||
|
||||
return $"Hello World! OpenTelemetry Trace: {Activity.Current?.Id}";
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -15,3 +15,4 @@
|
||||
2.0
|
||||
2.0
|
||||
2.0
|
||||
2.0
|
||||
|
||||
Reference in New Issue
Block a user