Tag ClickHouse User-Agent with lib identity - #47
Merged
Conversation
ClickHouse.Driver 1.3.0 adds ClickHouseClientSettings.ApplicationInfo, a set of free-form tags appended to the HTTP User-Agent for per-application query attribution. Set the "lib" tag to "ClickHouse.EntityFrameworkCore" on the connections/data sources the provider constructs so queries issued through EF Core are attributable server-side. Only the connection-string path is tagged; when the caller supplies their own DbConnection or DbDataSource the provider does not construct the client and leaves it alone. - Bump ClickHouse.Driver 1.1.0 -> 1.3.0. - Add ClickHouseClientIdentity.CreateSettings helper. - Build the pooled ClickHouseDataSource from tagged settings (ClickHouseDataSourceManager) and apply the tag to the fallback ClickHouseConnection in CreateDbConnection. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The functional and unit test projects referenced ClickHouse.Driver 1.1.0 directly, which downgrades below the provider's 1.3.0 reference (NU1605 as error) after the bump. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Runs a query through an EF Core DbContext, flushes system.query_log, and verifies http_user_agent carries lib:ClickHouse.EntityFrameworkCore. Verification uses a separate untagged connection so the tag can only originate from the provider. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR upgrades the ClickHouse ADO.NET driver and tags provider-created ClickHouse clients with a lib:ClickHouse.EntityFrameworkCore token via ClickHouseClientSettings.ApplicationInfo, enabling server-side attribution of EF Core-originated queries.
Changes:
- Bump
ClickHouse.Driverfrom 1.1.0 to 1.3.0 across src + test projects. - Introduce
ClickHouseClientIdentity.CreateSettings()to apply thelibUser-Agent tag. - Construct pooled
ClickHouseDataSourceand fallbackClickHouseConnectionusing tagged settings, plus add an end-to-end functional test validating the tag viasystem.query_log.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/EFCore.ClickHouse.Tests/EFCore.ClickHouse.Tests.csproj | Updates test project dependency to ClickHouse.Driver 1.3.0. |
| test/EFCore.ClickHouse.FunctionalTests/EFCore.ClickHouse.FunctionalTests.csproj | Updates functional test project dependency to ClickHouse.Driver 1.3.0. |
| test/EFCore.ClickHouse.FunctionalTests/UserAgentClickHouseTest.cs | Adds functional coverage asserting the lib User-Agent token is present in system.query_log. |
| src/EFCore.ClickHouse/Storage/Internal/ClickHouseRelationalConnection.cs | Applies tagged client settings when creating fallback ClickHouseConnection. |
| src/EFCore.ClickHouse/Storage/Internal/ClickHouseDataSourceManager.cs | Builds pooled ClickHouseDataSource from tagged client settings. |
| src/EFCore.ClickHouse/Storage/Internal/ClickHouseClientIdentity.cs | Adds internal helper for creating settings with ApplicationInfo["lib"]. |
| src/EFCore.ClickHouse/EFCore.ClickHouse.csproj | Updates provider dependency to ClickHouse.Driver 1.3.0. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
What
ClickHouse.Driver 1.3.0 adds
ClickHouseClientSettings.ApplicationInfo— free-form tags appended to the HTTPUser-Agentheader for per-application query attribution. This sets thelibtag toClickHouse.EntityFrameworkCoreon the connections/data sources the provider constructs, so queries issued through EF Core are attributable server-side.Changes
ClickHouse.Driver1.1.0 → 1.3.0.ClickHouseClientIdentity.CreateSettingshelper.ClickHouseDataSourcefrom tagged settings (ClickHouseDataSourceManager) and apply the tag to the fallbackClickHouseConnectioninCreateDbConnection.Only the connection-string path is tagged; when the caller supplies their own
DbConnectionorDbDataSource, the provider does not construct the client and leaves it alone.Testing
dotnet build -c Releasesucceeds with 0 errors (pre-existing analyzer warnings only, none from the changed files).🤖 Generated with Claude Code