-
Notifications
You must be signed in to change notification settings - Fork 1
Integration ClickHouse Extension
The Kronikol.Extensions.ClickHouse package adds ClickHouse operation tracking to your test diagrams using a DbConnection wrapping decorator pattern.
Works with both clients. ClickHouse on .NET is typically accessed through one of two ADO.NET providers —
ClickHouse.Client(ClickHouse.Client.ADO.ClickHouseConnection) orOctonica.ClickHouseClient(Octonica.ClickHouseClient.ClickHouseConnection). Both derive fromDbConnection, so this extension supports either one and takes no hard dependency on a specific client package.
Why wrapping? Neither ClickHouse client emits
DiagnosticSourceevents. This extension wraps the connection withTrackingClickHouseConnection, which intercepts all command executions (and transactions, where supported).
TrackingClickHouseConnection wraps a real ClickHouse DbConnection and returns TrackingClickHouseCommand instances that intercept all 6 execution methods (ExecuteReader/NonQuery/Scalar × sync/async). All intercepted operations are classified by UnifiedSqlClassifier and logged to RequestResponseLogger.
The classifier understands ClickHouse-specific SQL in addition to standard DML/DDL:
| ClickHouse statement | Classified as | Detailed label |
|---|---|---|
ALTER TABLE t UPDATE col = … WHERE … |
Update |
UPDATE t |
ALTER TABLE t DELETE WHERE … |
Delete |
DELETE FROM t |
ALTER TABLE t ADD COLUMN … |
AlterTable |
ALTER TABLE t |
OPTIMIZE TABLE t FINAL |
Optimize |
OPTIMIZE t |
RENAME TABLE a TO b |
Rename |
RENAME a |
ATTACH TABLE t / DETACH TABLE t
|
Attach / Detach
|
ATTACH t / DETACH t
|
INSERT INTO t FORMAT … |
Insert |
INSERT INTO t |
CREATE TABLE t (…) ENGINE = MergeTree() |
CreateTable |
CREATE TABLE t |
ON CLUSTER clauses are handled transparently when detecting mutations.
dotnet add package Kronikol.Extensions.ClickHouse
# plus whichever ClickHouse client you already use:
dotnet add package ClickHouse.Client # or
dotnet add package Octonica.ClickHouseClientservices.AddClickHouseTestTracking(options =>
{
options.Verbosity = SqlTrackingVerbosityLevel.Detailed;
});This decorates all DbConnection registrations with a type-check guard — only ClickHouse connections (from either supported client) are wrapped; others pass through unchanged.
using Kronikol.Extensions.ClickHouse;
// ClickHouse.Client
var inner = new ClickHouse.Client.ADO.ClickHouseConnection("Host=localhost;Port=8123;Database=analytics");
// — or — Octonica.ClickHouseClient
// var inner = new Octonica.ClickHouseClient.ClickHouseConnection("Host=localhost;Port=9000;Database=analytics");
var tracked = inner.WithClickHouseTestTracking(new ClickHouseTrackingOptions
{
Verbosity = SqlTrackingVerbosityLevel.Detailed
});
await tracked.OpenAsync();
// Use `tracked` as your DbConnection (also works as the connection for Dapper)...Note:
WithClickHouseTestTrackingreturns aTrackingClickHouseConnection(aDbConnection), not the concrete client type. Client-specific APIs that require the concrete connection — e.g.ClickHouseBulkCopy— should be given the inner connection (tracked.InnerConnection); such bulk paths bypass tracking.
| Property | Default | Description |
|---|---|---|
ServiceName |
"ClickHouse" |
Participant name in diagrams |
CallerName |
"Caller" |
The caller participant name |
Verbosity |
Detailed |
Raw, Detailed, or Summarised
|
CurrentTestInfoFetcher |
null |
Returns the current test's name and ID. Required for the wrapping approach |
HttpContextAccessor |
null |
Optional — enables dual-resolution of test identity from HTTP headers |
LogSqlText |
true |
Include full SQL text in Detailed mode |
LogParameters |
false |
Include parameter values |
DependencyCategory |
"ClickHouse" |
Controls participant shape/colour |
UriScheme |
"clickhouse" |
URI scheme in diagram URIs |
ExcludedOperations |
[] |
Operations to exclude from tracking |
SetupVerbosity |
null |
Verbosity override for the Setup phase. See Phase-Aware Tracking |
ActionVerbosity |
null |
Verbosity override for the Action phase. See Phase-Aware Tracking |
TrackDuringSetup |
true |
When false, tracking is suppressed during Setup |
TrackDuringAction |
true |
When false, tracking is suppressed during Action |
LogResponseContent |
true |
Include response data in diagram arrows at all verbosity levels |
MaxResponseRows |
10 |
Maximum rows to capture in response content |
MaxValueDisplayLength |
500 |
Truncate individual cell values beyond this length |
ResponseDetail |
RowCountAndColumns |
RowCountOnly, RowCountAndColumns, or FullRows
|
All options inherit from SqlTrackingOptionsBase.
| Level | Arrow label | URI |
|---|---|---|
| Raw | Full SQL text | clickhouse://host/database |
| Detailed | SELECT FROM events |
clickhouse://host/database/events |
| Summarised | SELECT |
clickhouse:///database/events |
TrackingClickHouseCommand captures response data from ExecuteReader and ExecuteScalar calls. The ResponseDetail option controls the level of detail:
ResponseDetail |
Example output |
|---|---|
RowCountOnly |
3 rows |
RowCountAndColumns (default)
|
3 rows [name, ts, value] |
FullRows |
JSON row preview (up to MaxResponseRows) |
Set LogResponseContent = false to restore empty-arrow behaviour.
If you access ClickHouse through EF Core (e.g. a community ClickHouse provider), use Integration EF Core Relational Extension — it intercepts commands from any relational provider. If you use Dapper over a ClickHouse connection, you can also use Integration Dapper Extension by wrapping the connection. The dedicated Kronikol.Extensions.ClickHouse package is the best choice for raw ADO.NET usage and gives a first-class ClickHouse participant in diagrams.
Getting Started
Common Tasks
Integration Guides
- Integration xUnit3
- Integration xUnit2
- Integration NUnit
- Integration MSTest
- Integration TUnit
- Integration BDDfy xUnit3
- Integration LightBDD xUnit2
- Integration LightBDD xUnit3
- Integration LightBDD TUnit
- Integration ReqNRoll xUnit2
- Integration ReqNRoll xUnit3
- Integration ReqNRoll TUnit
Extensions
- Integration AtlasDataApi Extension
- Integration BigQuery Extension
- Integration Bigtable Extension
- Integration BlobStorage Extension
- Integration ClickHouse Extension
- Integration CloudStorage Extension
- Integration CosmosDB Extension
- Integration Dapper Extension
- Integration DynamoDB Extension
- Integration EF Core Relational Extension
- Integration Elasticsearch Extension
- Integration EventBridge Extension
- Integration EventHubs Extension
- Integration Grpc Extension
- Integration Kafka Extension
- Integration MassTransit Extension
- Integration MongoDB Extension
- Integration MySqlConnector Extension
- Integration Npgsql Extension
- Integration Oracle Extension
- Integration PubSub Extension
- Integration Redis Extension
- Integration S3 Extension
- Integration ServiceBus Extension
- Integration SNS Extension
- Integration Spanner Extension
- Integration SqlClient Extension
- Integration Sqlite Extension
- Integration SQS Extension
- Integration StorageQueues Extension
- Integration OpenTelemetry Extension
- Integration DispatchProxy Extension
- Integration MediatR Extension
- Integration PlantUML IKVM
Configuration
- Tracking Dependencies
- Tracking Custom Dependencies
- HTTP Tracking Setup
- Report Configuration
- Diagram Customisation
- Phase-Aware Tracking
- Content Formatting
- PlantUML Server Configuration
Features
- Generated Reports
- Search Syntax
- Component Diagrams
- PlantUML Browser Rendering
- Inline SVG Rendering
- Internal Flow Tracking
- Tags and Attributes
- Excluding Requests
- Excluded Headers
- Multi-Host Test Architectures
- Event-Driven Architecture Testing
- Service Bus Tracking Patterns
- Background Thread Correlation
- Parallel-Safe Background Correlation
- Event & Message Tracking
- Assertion Tracking
- Step Tracking
- Tabular Attributes
- Large Response and Diagram Handling
- Diagnostics and Debugging
- CI Summary Integration
- CI Artifact Upload
- Merging Parallel Reports
Reference