-
Notifications
You must be signed in to change notification settings - Fork 497
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Restore disabled counter This was missed in #648 Addresses #645 * Add view to Npgsql's histograms because they are in seconds and not ms. Fix #641
- Loading branch information
Showing
4 changed files
with
33 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using OpenTelemetry.Metrics; | ||
|
||
internal static class NpgsqlCommon | ||
{ | ||
public static void AddNpgsqlMetrics(MeterProviderBuilder meterProviderBuilder) | ||
{ | ||
double[] secondsBuckets = [0, 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]; | ||
|
||
// https://github.com/npgsql/npgsql/blob/4c9921de2dfb48fb5a488787fc7422add3553f50/src/Npgsql/MetricsReporter.cs#L48 | ||
meterProviderBuilder | ||
.AddMeter("Npgsql") | ||
// Npgsql's histograms are in seconds, not milliseconds. | ||
.AddView("db.client.commands.duration", | ||
new ExplicitBucketHistogramConfiguration | ||
{ | ||
Boundaries = secondsBuckets | ||
}) | ||
.AddView("db.client.connections.create_time", | ||
new ExplicitBucketHistogramConfiguration | ||
{ | ||
Boundaries = secondsBuckets | ||
}); | ||
} | ||
} |