Open
Conversation
This was referenced Oct 26, 2024
src/FirebirdSql.Data.FirebirdClient.Benchmarks/CommandBenchmark.cs
Outdated
Show resolved
Hide resolved
bd2e3a0 to
e5e4075
Compare
Member
Author
|
Rebase with |
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.
2a8789b to
1ec795d
Compare
Member
Author
|
Following up on the initial refactoring, these additional changes were made on the branch: Infrastructure
Configuration
Benchmark methods
New benchmarks
Script
Documentation
|
Member
Author
|
Future improvements:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.