Skip to content

Integration Bigtable Extension

Aryeh Citron edited this page Apr 27, 2026 · 7 revisions

Track Google Cloud Bigtable operations in your test diagrams using the TestTrackingDiagrams.Extensions.Bigtable NuGet package. This extension wraps BigtableClient to capture row-level operations with table name extraction and configurable verbosity.

Using a shared library or abstraction layer? If your code doesn't use the Bigtable SDK directly — e.g. it goes through a shared data-access library, wrapper, or custom abstraction — this extension won't be able to intercept the underlying calls. See Tracking Custom Dependencies for alternative approaches including RequestResponseLogger.LogPair(), TrackingProxy<T>, and MessageTracker.

Installation

dotnet add package TestTrackingDiagrams.Extensions.Bigtable

How It Works

Google Cloud Bigtable uses gRPC internally, so DelegatingHandler interception is not viable. Instead, this extension uses a tracker/classifier pattern:

  • BigtableTracker implements ITrackingComponent and handles request/response logging with RequestResponseMetaType.Event and DependencyCategory: "Database"
  • BigtableOperationClassifier classifies method calls into operation types and generates diagram labels

Supported Operations

Operation Enum Value Description
Read rows BigtableOperation.ReadRows Read one or more rows with optional filters
Mutate single row BigtableOperation.MutateRow Apply mutations to a single row
Mutate multiple rows BigtableOperation.MutateRows Batch mutations across multiple rows
Check and mutate BigtableOperation.CheckAndMutateRow Conditional mutation (read-modify-write)
Read-modify-write BigtableOperation.ReadModifyWriteRow Atomic read-modify-write on a single row
Sample row keys BigtableOperation.SampleRowKeys Get a sample of row keys for splitting

Verbosity Levels

BigtableTrackingVerbosity.Summarised

  • Label: Short operation name (e.g. ReadRows, MutateRow, CheckAndMutate)
  • Content: Omitted
  • URI: bigtable:///my-table

BigtableTrackingVerbosity.Detailed

  • Label: Operation with table name (e.g. ReadRows ← my-table, MutateRow → my-table, MutateRows (×5) → my-table)
  • Content: Included
  • URI: bigtable:///my-table (short name extracted from full resource path)

BigtableTrackingVerbosity.Raw

  • Label: Full info including resource paths and row keys
  • Content: Full details
  • URI: bigtable:///projects/p/instances/i/tables/my-table

Resource Name Extraction

Bigtable uses full resource paths like projects/my-project/instances/my-instance/tables/my-table. At Detailed and Summarised verbosity, the short table name is extracted:

  • projects/my-project/instances/my-instance/tables/my-tablemy-table

Setup

Option A: Direct Tracker Usage

using TestTrackingDiagrams.Extensions.Bigtable;

var tracker = new BigtableTracker(new BigtableTrackingOptions
{
    ServiceName = "Bigtable",
    CallingServiceName = "OrdersApi",
    CurrentTestInfoFetcher = () => (TestContext.Current!.Test.TestDisplayName, TestContext.Current.Test.UniqueID)
});

// Classify and log
var op = BigtableOperationClassifier.Classify("ReadRows", tableName);
var (reqId, traceId) = tracker.LogRequest(op, "filter expression");

// ... execute Bigtable operation ...

tracker.LogResponse(op, reqId, traceId, "5 rows returned");

Option B: DI Registration

services.AddBigtableTestTracking(options =>
{
    options.ServiceName = "Bigtable";
    options.CallingServiceName = "OrdersApi";
    options.CurrentTestInfoFetcher = () => (TestContext.Current!.Test.TestDisplayName, TestContext.Current.Test.UniqueID);
});

Then inject BigtableTracker where needed.


Configuration

BigtableTrackingOptions

Property Type Default Description
ServiceName string "Bigtable" Display name in diagrams for the Bigtable service
CallingServiceName string "Caller" Calling service name in diagrams
Verbosity BigtableTrackingVerbosity Detailed Verbosity level (Raw, Detailed, Summarised)
CurrentTestInfoFetcher Func<(string Name, string Id)>? null Required: provides test context for log correlation
CurrentStepTypeFetcher Func<string?>? null Optional — returns the current BDD step type
SetupVerbosity BigtableTrackingVerbosity? null Verbosity override for the Setup phase. See Phase-Aware Tracking
ActionVerbosity BigtableTrackingVerbosity? null Verbosity override for the Action phase. See Phase-Aware Tracking
TrackDuringSetup bool true When false, tracking is suppressed during Setup
TrackDuringAction bool true When false, tracking is suppressed during Action

Diagram Label Examples

Operation Raw Detailed Summarised
Read rows ReadRows table=projects/p/instances/i/tables/users row= ReadRows ← users ReadRows
Mutate single row MutateRow table=projects/p/instances/i/tables/users row=user123 MutateRow → users MutateRow
Mutate batch (5 rows) MutateRows table=projects/p/instances/i/tables/users row= MutateRows (×5) → users MutateRow
Check and mutate CheckAndMutateRow table=.../users row=user123 CheckAndMutate → users CheckAndMutate
Read-modify-write ReadModifyWriteRow table=.../users row=user123 ReadModifyWrite → users ReadModifyWrite
Sample row keys SampleRowKeys table=.../users row= SampleRowKeys ← users SampleRowKeys

ITrackingComponent

BigtableTracker implements ITrackingComponent and auto-registers:

  • ComponentName: "BigtableTracker ({ServiceName})"
  • WasInvoked: true after first operation
  • InvocationCount: Total operations logged

See Also

Home


Demo


Getting Started

Common Tasks

Integration Guides

Extensions

Configuration

Features

Reference

Clone this wiki locally