Refactor benchmarks#1203
Conversation
bd2e3a0 to
e5e4075
Compare
|
Rebase with |
2a8789b to
1ec795d
Compare
|
Following up on the initial refactoring, these additional changes were made on the branch: Infrastructure
Configuration
Benchmark methods
New benchmarks
Script
Documentation
|
|
Future improvements:
|
StartActivity() returns null when no listeners are interested in the
activity. The code accessed activity.IsAllDataRequested without a null
check, causing a NullReferenceException. Use the Npgsql-style pattern
'activity is not { IsAllDataRequested: true }' for early return.
Stopwatch ticks are not TimeSpan ticks when Stopwatch.IsHighResolution is true (most systems). TimeSpan.FromTicks(stopwatchTicks) produces incorrect durations. Use Stopwatch.GetElapsedTime() which correctly handles the frequency conversion.
The semantic conventions renamed db.system to db.system.name. The well-known value for Firebird is 'firebirdsql', not 'firebird'. Updated in both FbActivitySource (spans) and FbConnection (metrics).
The semantic conventions mark db.namespace as Conditionally Required when available. The connection's Database property is used as the value.
The semantic conventions mark error.type as Conditionally Required on failure. For FbException, use the SQLSTATE code; for other exceptions, use the full exception type name.
Per OTel semantic conventions, db.query.text and db.query.parameter.* are Opt-In level attributes that may expose sensitive data. They should not be collected by default. Added IsQueryTextTracingEnabled flag and reuse IsParameterLoggingEnabled for parameter tracing.
Replace hardcoded '1.0.0' version with the assembly's informational version, keeping the telemetry version in sync with the NuGet package.
…ecording TraceCommandException now records metrics immediately and resets _startedAtTicks so the later TraceCommandStop (called during Release) does not record a second, inflated duration that includes cleanup time.
- Remove db.transaction_id custom tag (not in OTel spec, causes server round-trip per traced command) - Remove commented-out db.snapshot_id code - Remove deprecated exception.escaped attribute - Remove NormalizeDbNull helper, inline DBNull check
- Set server.port on spans when using a non-default port - Set db.stored_procedure.name for StoredProcedure command types - Fix server.address in MetricsConnectionAttributes to not concatenate the port (server.port is now a separate attribute) - Clean up leftover placeholder comments
Set db.query.summary as the low-cardinality activity name on all spans. For Text commands, extract the first SQL verb (SELECT, INSERT, etc.) and use it as db.operation.name and in the activity name.
Debug.Assert checks that TraceCommandStart was called before the stop or exception path, helping catch lifecycle bugs during development.
Prevents potential NullReferenceException if metrics are recorded before the connection string is set.
Change GetMetrics() to return IEnumerable of tuples via Select instead of allocating a Dictionary via ToDictionary on every collection cycle. Also simplify GetConnectionMax to use Select instead of SelectMany.
Suggest default histogram bucket boundaries for operation duration and connection create time histograms, improving out-of-the-box resolution. Guarded by NET9_0_OR_GREATER since InstrumentAdvice is a .NET 9 API.
Expose the telemetry source names as public constants so consumers can easily subscribe: builder.AddSource(FbTelemetry.ActivitySourceName) and builder.AddMeter(FbTelemetry.MeterName). Internal code updated to use the constants.
Document the ActivitySource and Meter names, available span attributes, opt-in sensitive attributes, and available metrics with their types and semantic convention references.
- Rename project 'Perf' to 'FirebirdSql.Data.FirebirdClient.Benchmarks'. - Update project to use .net8. - Upgrade BenchmarkDotNet to version 0.14.0. - Update baseline nuget package to v10.3.1. - Add /BenchmarkDotNet.Artifacts to .gitignore. - Pass command-line arguments to BenchmarkDotNet engine. - Apply SQL Formatting. Use raw strings. - Add script run-benchmark.ps1.
533d57c to
9d42b35
Compare
|
Rebased onto latest |
…tection CommandBenchmark (the default suite) only covered BIGINT and VARCHAR UTF8, so the fixed-length CHAR(n) UTF8 rune path was untested -- the exact path where issue FirebirdSQL#1272 (~11.7x allocation regression) lives. That regression surfaced only via the opt-in LargeFetchBenchmark. - CommandBenchmark: add "CHAR(100) CHARACTER SET UTF8" param; add SampleValue() so Execute sends a column-sized string (exercising the write/validate rune count path) instead of a bare int. - docs/benchmark.md: correct the NuGet baseline description (pinned version plus a bump-per-release note), add an "Interpreting results" section noting that Alloc Ratio is the primary regression signal (with FirebirdSQL#1272 as a worked example), and list the third data type. Verified locally against the released baseline: CHAR UTF8 Fetch Alloc Ratio ~9.6x and Execute ~1.9x, while BIGINT and VARCHAR stay ~1.0.
|
Added a couple of benchmark improvements prompted by #1272 (the UTF8 What changed (commit 46db5a1)
Effect — the default benchmark now catches #1272Running
Only the CI is green across FB30/FB40/FB50. |
Based on #1200 for now. I will rebase it with latest
masterin the future.PerftoFirebirdSql.Data.FirebirdClient.Benchmarks.0.14.0.v10.3.1./BenchmarkDotNet.Artifactsfolder to.gitignore.run-benchmark.ps1.