Class Argon2idDiagnostics
- Namespace
- Argon2id.PasswordHasher
- Assembly
- Argon2id.PasswordHasher.dll
Public names of the System.Diagnostics.Metrics meter and instruments emitted by this library. Subscribe to these from your observability stack (OpenTelemetry, Prometheus exporter, etc.) to get hash/verify counts, durations, and rehash signals without any code changes inside the hasher.
public static class Argon2idDiagnostics
- Inheritance
-
objectArgon2idDiagnostics
Remarks
All instruments live on a single meter named MeterName. Subscribing to that meter is the recommended way to enable everything:
// OpenTelemetry:
builder.Services.AddOpenTelemetry()
.WithMetrics(m => m.AddMeter(Argon2idDiagnostics.MeterName));
// Or with a raw MeterListener:
var listener = new MeterListener();
listener.InstrumentPublished = (inst, l) =>
{
if (inst.Meter.Name == Argon2idDiagnostics.MeterName)
l.EnableMeasurementEvents(inst);
};
listener.Start();
Recording is essentially free when nothing is listening. There is no per-call allocation. The instruments are created lazily by the BCL.
Fields
HashCountName
Counter incremented each time a new hash is produced.
public const string HashCountName = "argon2id.hash.count"
Field Value
- string
HashDurationName
Histogram of wall-clock hash duration, in milliseconds.
public const string HashDurationName = "argon2id.hash.duration"
Field Value
- string
MeterName
The name of the System.Diagnostics.Metrics.Meter that
emits every instrument below. Use this with
AddMeter(Argon2idDiagnostics.MeterName) on any OpenTelemetry
or other metrics provider.
public const string MeterName = "Argon2id.PasswordHasher"
Field Value
- string
ParseFailureCountName
Counter incremented each time a stored value could not be parsed as a PHC-encoded Argon2id hash during a verify call. Spikes here usually indicate corrupted data or an unexpected hash format in the store.
public const string ParseFailureCountName = "argon2id.parse.failure.count"
Field Value
- string
RehashNeededCountName
Counter incremented each time a successful verify also indicated NeedsRehash. Use this to track migration progress and the rate of work-factor upgrades.
public const string RehashNeededCountName = "argon2id.rehash.needed.count"
Field Value
- string
VerifyCountName
Counter incremented each time a verification is attempted, regardless of outcome.
public const string VerifyCountName = "argon2id.verify.count"
Field Value
- string
VerifyDurationName
Histogram of wall-clock verify duration, in milliseconds.
public const string VerifyDurationName = "argon2id.verify.duration"
Field Value
- string
VerifySuccessCountName
Counter incremented each time a verification succeeds (tag matched). Subtract from VerifyCountName to get the failure count.
public const string VerifySuccessCountName = "argon2id.verify.success.count"
Field Value
- string