Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4538e37

Browse filesBrowse files
committed
Sample app tidy
1 parent d92cce1 commit 4538e37
Copy full SHA for 4538e37

File tree

Expand file treeCollapse file tree

4 files changed

+6
-2
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+6
-2
lines changed

‎Sample.Console.DotNetMeters/CustomDotNetMeters.cs

Copy file name to clipboardExpand all lines: Sample.Console.DotNetMeters/CustomDotNetMeters.cs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ int MeasureSandLevel()
7575
highCardinalityCounter1.Add(Random.Shared.Next(10_000_000), new KeyValuePair<string, object?>("connection-id", connection));
7676

7777
// Maybe some connection went away, maybe some was added.
78+
// Timeseries that stop receiving updates will disappear from prometheus-net output after a short delay (up to 10 minutes by default).
7879
if (Random.Shared.Next(100) == 0)
7980
{
8081
activeConnections.RemoveAt(Random.Shared.Next(activeConnections.Count));

‎Sample.Console.DotNetMeters/Program.cs

Copy file name to clipboardExpand all lines: Sample.Console.DotNetMeters/Program.cs
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
Metrics.SuppressDefaultMetrics(new SuppressDefaultMetricOptions
1010
{
1111
SuppressProcessMetrics = true,
12-
SuppressEventCounters = true
12+
SuppressEventCounters = true,
13+
SuppressDebugMetrics = true
1314
});
1415

1516
// Example of static labels that conflict with .NET Meters API labels ("Bytes considered" histogram).
@@ -23,7 +24,7 @@
2324
using var server = new KestrelMetricServer(port: 1234);
2425
server.Start();
2526

26-
// Start publishing sample data via .NET Meters API. Data from this API is published by default by prometheus-net.
27+
// Start publishing sample data via .NET Meters API. All data from the .NET Meters API is published by default.
2728
CustomDotNetMeters.PublishSampleData();
2829

2930
// Metrics published in this sample:

‎Sample.Console/Program.cs

Copy file name to clipboardExpand all lines: Sample.Console/Program.cs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
// * built-in process metrics giving basic information about the .NET runtime (enabled by default)
2828
// * metrics from .NET Event Counters (enabled by default, updated every 10 seconds)
2929
// * metrics from .NET Meters (enabled by default)
30+
// * prometheus-net self-inspection metrics that indicate number of registered metrics/timeseries (enabled by default)
3031
// * the custom sample counter defined above
3132
Console.WriteLine("Open http://localhost:1234/metrics in a web browser.");
3233
Console.WriteLine("Press enter to exit.");

‎Sample.Grpc/Program.cs

Copy file name to clipboardExpand all lines: Sample.Grpc/Program.cs
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
// * built-in process metrics giving basic information about the .NET runtime (enabled by default)
3131
// * metrics from .NET Event Counters (enabled by default, updated every 10 seconds)
3232
// * metrics from .NET Meters (enabled by default)
33+
// * prometheus-net self-inspection metrics that indicate number of registered metrics/timeseries (enabled by default)
3334
// * metrics about HTTP requests handled by the web app (configured above)
3435
// * metrics about gRPC requests handled by the web app (configured above)
3536
app.MapMetrics();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.