Skip to content

Component Diagrams

aryehcitron@gmail.com edited this page Nov 7, 2026 · 35 revisions

Component Diagrams (C4-style)

Kronikol can aggregate all tracked interactions across your entire test suite to auto-generate a C4-style component diagram. This diagram shows every discovered participant (services, event brokers, databases) and their relationships — giving you a high-level architecture overview derived directly from real test traffic.

This feature is enabled by default (GenerateComponentDiagram = true).


Table of Contents


Quick Start

Add GenerateComponentDiagram = true to your ReportConfigurationOptions (this is the default):

var options = new ReportConfigurationOptions
{
    GenerateComponentDiagram = true  // already the default
};

That's it. When your test run completes and reports are generated, a ComponentDiagram.puml and ComponentDiagram.html file will appear in the Reports/ directory alongside your existing report files.


How It Works

RequestResponseLogger.RequestAndResponseLogs  (all tests, already in memory)
        │
        ▼
ComponentDiagramGenerator.ExtractRelationships()
        │  Filters: ignores responses, override markers, action markers, TrackingIgnore
        │  Groups by: (CallerName, ServiceName, Protocol)
        │  Counts: total calls, distinct test IDs, distinct HTTP methods
        ▼
ComponentDiagramGenerator.GeneratePlantUml()
        │  Classifies participants as Person() or System()
        │  Generates C4 Component PlantUML syntax
        ▼
ComponentDiagramReportGenerator
        │  Writes ComponentDiagram.puml  (raw PlantUML)
        │  Writes ComponentDiagram.html  (HTML wrapper)
        ▼
Reports/ directory
  1. Extract — All RequestResponseLog entries accumulated during the test run are filtered to only include meaningful request logs (excluding responses, override markers, action start markers, and ignored logs). They are then grouped by the unique combination of (CallerName, ServiceName, Protocol) to discover relationships. When a log has a DependencyCategory set (e.g. "CosmosDB" from the CosmosDB extension), it is used as the Protocol instead of "HTTP".

  2. Aggregate — For each relationship, the generator counts total calls, distinct test IDs (how many tests exercised this path), and the distinct HTTP methods or event types used. The DependencyCategory from the first matching log is preserved on the relationship for shape and color determination.

  3. Generate — The aggregated relationships are converted into PlantUML C4 Component diagram syntax. Participants are classified as Person() (pure callers), System() (HTTP APIs), SystemDb() (databases/storage), or SystemQueue() (message queues) based on their DependencyCategory. Arrows are coloured by dependency type by default.

  4. Write: the PlantUML source is written to a .puml file, wrapped in an HTML page for standalone viewing, and optionally embedded in the TestRunReport, where from 5.0.0 it is the report's Components tab (before 5.0.0, a panel hidden by default behind a toolbar toggle button).


Configuration

Enabling Component Diagrams

GenerateComponentDiagram defaults to true. To disable:

var options = new ReportConfigurationOptions
{
    GenerateComponentDiagram = false  // opt out
};

To customise the diagram:

var options = new ReportConfigurationOptions
{
    ComponentDiagramOptions = new ComponentDiagramOptions
    {
        Title = "My Service Architecture"
    }
};

When GenerateComponentDiagram is false, no component diagram files are generated and there is zero overhead.

ComponentDiagramOptions

Property Type Default Description
FileName string "ComponentDiagram" Base filename for the generated .puml and .html files
EmbedInTestRunReport bool true When true, the component diagram is embedded in the TestRunReport. From 5.0.0 it is the report's Components tab, headed by Title, which the tab's drawing leaves out (the standalone page keeps it); ReportToggleDefaults.ComponentDiagramVisible opens the page on it, and a run whose calls give the diagram no connection has no Components tab. Where the page draws the diagram (BrowserJs), the tab's controls are Show, Direction and Call summaries: Show Filtered, the start, draws the components and connections used by the scenarios the filters leave showing, where the report knows which scenarios made each connection's calls. Before 5.0.0 the embedded diagram was hidden by default behind a "Component Diagram" toggle button in the toolbar. The standalone file is always generated. The embedded diagram is exempt from the report's display toggles (Headers, Assertions, Steps, Databases, and from 5.0.0 Events and Setup), which act on sequence diagrams only: in particular, hiding databases never removes the overview's database/collections dependency nodes (3.0.82+).
Title string "Component Diagram" The title displayed in the PlantUML diagram and HTML page
PlantUmlTheme string? null Optional PlantUML theme name (e.g. "cerulean", "superhero"). Applied under PlantUmlRendering.Server and Local only; see PlantUML Theme
ParticipantFilter Func<string, bool>? null Predicate to include/exclude participants by name
RelationshipLabelFormatter Func<ComponentRelationship, string>? null Custom function to format relationship labels
ShowRelationshipFlows bool true Has no effect: nothing reads it. The relationship list and its flow popups it switched left in 2.0.92-beta. Kept so that code which sets it still compiles; its removal waits for v6.
RelationshipFlowStyle InternalFlowDiagramStyle ActivityDiagram Has no effect: nothing reads it. It chose the style of the relationship flow popups, which left in 2.0.92-beta.
ShowSystemFlameChart bool true Has no effect: nothing reads it. The system-level flow section it switched left in 2.0.92-beta.
LowCoverageThreshold int 3 Has no effect: nothing reads it. See Low-Coverage Warnings for where the dashed arrows come from.
ArrowColorMode ArrowColorMode DependencyType Controls arrow coloring. DependencyType colors arrows by target service type (blue=HTTP, red=Database, etc.). Performance colours by P95 latency (green/orange/red) in a diagram drawn with relationship stats; a generated report passes none, so it draws its arrows uncoloured in this mode (see Performance-Based Arrow Colouring).
DependencyColors Dictionary<string, string>? null Per-category color overrides (key = category string like "CosmosDB", value = hex color like "#FF0000"). Also inheritable from ReportConfigurationOptions.DependencyColors.
MaxFlameChartTests int 50 Has no effect: nothing reads it. Kept so that code which sets it still compiles.

Output Files

When enabled, two files are generated in the Reports/ directory:

File Description
ComponentDiagram.html A standalone HTML page containing the PlantUML source in a collapsible <details> element. Can be opened directly in a browser.

The filenames can be customised via ComponentDiagramOptions.FileName.


Participant Classification

Participants are automatically classified based on their role in the tracked interactions and their dependency type:

Classification C4 Element Plain PlantUML Shape Rule
Person Person(alias, "Name") rectangle <<person>> The participant only appears as a CallerName and never as a ServiceName in any tracked log. This is typically your test client / SUT caller.
HTTP API System(alias, "Name") rectangle <<system>> Default for services with no DependencyCategory or HTTP-based dependencies.
Database SystemDb(alias, "Name") database Services with DependencyCategory of "CosmosDB", "SQL", "BigQuery", "MongoDB", "DynamoDB", "Elasticsearch", "Spanner", "Bigtable", or "Database".
Cache System(alias, "Name") collections Services with DependencyCategory of "Redis".
Message Queue SystemQueue(alias, "Name") queue Services with DependencyCategory of "ServiceBus".
Storage SystemDb(alias, "Name") database Services with DependencyCategory of "BlobStorage".

The DependencyCategory is automatically set by each extension package. For example, CosmosTrackingMessageHandler sets DependencyCategory: "CosmosDB" on every tracked log, which causes the CosmosDB service to render as a database shape with a red color.


Relationship Labels

By default, each relationship label contains:

<Protocol>: <Methods> - <CallCount> calls across <TestCount> tests

Examples:

  • HTTP: GET, POST - 14 calls across 8 tests
  • Publish: Publish - 3 calls across 2 tests
  • CosmosDB: Query, Upsert - 5 calls across 3 tests

The protocol is determined automatically:

  • A dependency category — A call with a DependencyCategory takes it as its protocol, whatever its kind (e.g. "CosmosDB", "SQL", "ServiceBus").
  • Event — With no category, a call with MetaType == Event takes the string value of the Method property on RequestResponseLog (e.g. "Publish").
  • HTTP — With no category, any other call is "HTTP". The distinct HTTP method names (GET, POST, PUT, etc.) are listed.

Stats-Driven Labels

A diagram generated with relationship stats, computed from request/response timestamp pairs, gives each relationship label latency percentiles. A generated report passes no stats and draws the default labels above; the paragraph after the examples says how to get these:

HTTP: GET, POST
P50: 45ms | P95: 120ms | P99: 250ms
14 calls across 8 tests

If a relationship has a non-zero error rate, it is also shown:

P50: 45ms | P95: 120ms | P99: 250ms | 15% errors

A failed call counts toward it whatever form its status takes: from 5.34.3 a call that threw (!HttpRequestException), a SQL Error, a MassTransit Fault and an answer that carries a reason in error count, where only a numeric code of 400 or more did (#232). The endpoint breakdown and the errors that occur together read failures the same way.

A stats label puts its method list inside a [[#iflow-rel-...]] PlantUML link. A generated report never passes stats, so it never draws one; you get it by calling ComponentDiagramGenerator.GeneratePlantUml with the stats from ComponentFlowSegmentBuilder.ComputeRelationshipStats and handing the result to ReportGenerator.GenerateHtmlReport as componentDiagramPlantUml. The link rests in the ink of the label's own stats line and turns blue when hovered; before 3.31.2 the first edge's rested in the colour of the component name drawn before it, white on the default palette. The method list inside the link is cut at 350 characters (3.30.4), and since 4.14.5 by whole entries, ending …, +N more, with the whole label held to the edge's 375: in a BrowserJs report a longer link can overflow the stack of the browser worker the diagram renders in and lose the diagram, and before 3.30.4 an edge with enough methods was cut inside its link by the statement limit, losing its stats line.

Dependency-Type Arrow Colouring (Default)

By default, arrows are coloured by the target service's dependency type using the following palette:

Dependency Type Colour Hex
HTTP API Blue #438DD5
Database (CosmosDB, SQL, BigQuery) Red #E74C3C
Cache (Redis) Orange #F39C12
Message Queue (ServiceBus) Purple #9B59B6
Storage (BlobStorage) Green #2ECC71
Unknown Grey #95A5A6

This provides an instant visual indicator of what type of dependency each arrow represents. The same colors are applied to both sequence diagrams and component diagrams.

To override specific colors:

var options = new ReportConfigurationOptions
{
    DependencyColors = new Dictionary<string, string>
    {
        ["CosmosDB"] = "#FF0000",   // custom red for CosmosDB
        ["Redis"] = "#00FF00"       // custom green for Redis
    }
};

Performance-Based Arrow Colouring (Opt-in)

To switch to P95 latency-based arrow colouring (the previous default), set ArrowColorMode.Performance:

var options = new ReportConfigurationOptions
{
    ComponentDiagramOptions = new ComponentDiagramOptions
    {
        ArrowColorMode = ArrowColorMode.Performance
    }
};
P95 Latency Colour Meaning
< 50ms Green Fast
50ms – 200ms Orange Moderate
> 200ms Red Slow (hotspot)

This provides an instant visual indicator of which service dependencies are performance bottlenecks.

The colours come from relationship stats (ComponentFlowSegmentBuilder.ComputeRelationshipStats, handed to ComponentDiagramGenerator.GeneratePlantUml), as the Stats-Driven Labels do. A generated report passes none, and none has since 2.0.92-beta, so in TestRunReport.html and ComponentDiagram.html this mode draws the arrows uncoloured. ArrowColorMode.Performance's doc says so since 4.5.1.

Low-Coverage Warnings

In a diagram drawn with relationship stats, a relationship with fewer calls than the threshold ComputeRelationshipStats is given (its lowCoverageThreshold argument, default 3) is rendered with dashed arrows (..>) instead of solid arrows. This highlights service paths that may not have sufficient test coverage to produce reliable statistics. A generated report passes no stats, so it draws no dashed arrows, and ComponentDiagramOptions.LowCoverageThreshold has no effect: nothing reads it.


Customisation

Custom Title

var options = new ComponentDiagramOptions
{
    Title = "Order Service Architecture"
};

PlantUML Theme

Apply any built-in PlantUML theme:

var options = new ComponentDiagramOptions
{
    PlantUmlTheme = "cerulean"
};

This inserts !theme cerulean into the generated PlantUML. It applies under PlantUmlRendering.Server and Local, where the component diagram is drawn with the C4 library: the directive follows its !include <C4/C4_Context>, and the generator's own skinparam palette (the dependency-type colours) is not written there, only under BrowserJs and NodeJs. Under BrowserJs (the default) and NodeJs the component diagram goes through the same in-page engine as the sequence diagrams, which runs without its theme bundle, so the diagram is drawn unthemed, and from 3.30.0 the run records an OptionNotApplied diagnostic (see Diagram Customisation › PlantUML Themes).

Participant Filter

Exclude specific participants from the component diagram:

var options = new ComponentDiagramOptions
{
    // Exclude internal helper services and health check endpoints
    ParticipantFilter = name => name != "InternalHelper" && name != "HealthCheck"
};

The filter is a Func<string, bool> that receives the participant name. Return true to include, false to exclude. When a participant is excluded, all relationships involving that participant (as either caller or service) are removed.

Custom Relationship Labels

Override the default label format with a custom formatter:

var options = new ComponentDiagramOptions
{
    RelationshipLabelFormatter = rel =>
        $"{rel.Protocol} ({rel.CallCount} calls)"
};

The ComponentRelationship record passed to the formatter contains:

Property Type Description
Caller string The calling participant name
Service string The receiving participant name
Protocol string "HTTP" or the event/custom protocol name
Methods HashSet<string> Distinct method names (e.g. GET, POST, Publish)
CallCount int Total number of calls across all tests
TestCount int Number of distinct tests that exercised this relationship

Label length cap (4.14.5): an edge's label is capped at 375 characters as written. The engine's JavaScript build walks the whole label on its stack, and in the browser worker BrowserJs renders in, with V8's optimizing compilers off, a label failed from 550 characters, replacing the whole diagram with the engine's stack-overflow picture (before 4.14.5 the edge borrowed the sequence diagram's 2,000-character message limit, which was never measured for this statement). A longer method list keeps its first entries in ordinal order (since 4.14.10; before it, in the order of the machine's culture, so two machines could keep different entries), ends …, +N more, and keeps its call and test counts; a RelationshipLabelFormatter's label is cut at its end with a trailing …. A service name is cut at 200 characters, and two names that share their first 200 keep a component each; so, since 4.14.10, do two names written in a script other than Latin, whose letters an alias cannot keep. See Large Response and Diagram Handling › Statement-Length Limits (3.0.48+).

Label line wrapping (3.0.83+): an edge label longer than 100 characters is broken onto several display lines with \n escapes, between comma-separated operations wherever it can be. The emitted statement is still one physical line — only the drawn label is multi-line.

The breaks are in the source because the engines disagree about who wraps: the JavaScript build Kronikol embeds for BrowserJs/NodeJs honours skinparam wrapWidth on an arrow label, and real Java PlantUML does not wrap arrow labels at all. A relationship listing thirty SQL operations therefore drew 840×863 inside a report and 6697×586 through real PlantUML — past the 4096-pixel PLANTUML_LIMIT_SIZE that plantuml.com and every default install crop at, which silently cut every dependency node off the canvas. That made the diagram look broken as soon as its source left the report, which is exactly what the context menu's Copy/Open PlantUML source invites you to do.

Labels at or under 100 characters — which is nearly all of them — keep their exact bytes. Inside the browser report the diagram is unchanged either way, because that engine re-wraps each line to wrapWidth regardless.

Participant name wrapping (3.0.83+): a participant's name is the same width axis, and the narrower one — skinparam wrapWidth does apply to entity boxes, but it only breaks at whitespace, and the names that get long (hosts, fully-qualified type names, connection descriptors) have none. Measured against real PlantUML a <<system>> rectangle grows at about 7.3 pixels per character and crops at around 528; the hexagon an AI dependency draws as grows at about 14 and crops at around 284. Names over 80 characters are therefore broken the same way. For the two rectangle forms the creole bold markers are closed and reopened on every line, because **a\nb** is not bold across the break — it loses the weight and draws a literal **. The plain shapes (database, collections, queue, hexagon) and the C4 macros take the breaks alone. Aliases are derived from the name, not the wrapped label, so edges are unaffected.


Example Output

Given a test suite that exercises an Order Service with downstream dependencies:

Generated PlantUML (ComponentDiagram.puml)

@startuml
!include <C4/C4_Component>

title Order Service Architecture

Person(webApp, "WebApp")
System(orderService, "OrderService")
System(paymentService, "PaymentService")
System(kafka, "Kafka")
System(cosmosDb, "CosmosDB")

Rel(webApp, orderService, "[[#iflow-rel-WebApp-OrderService HTTP: GET, POST]]\nP50: 42ms | P95: 120ms | P99: 250ms\n14 calls across 8 tests", $tags="#Orange")
Rel(orderService, paymentService, "[[#iflow-rel-OrderService-PaymentService HTTP: POST]]\nP50: 150ms | P95: 400ms | P99: 500ms | 2% errors\n6 calls across 4 tests", $tags="#Red")
Rel(orderService, kafka, "[[#iflow-rel-OrderService-Kafka Publish: Publish]]\nP50: 5ms | P95: 15ms | P99: 25ms\n3 calls across 2 tests", $tags="#Green")
orderService ..> cosmosDb : "[[#iflow-rel-OrderService-CosmosDB CosmosDB: Query, Upsert]]\nP50: 8ms | P95: 20ms | P99: 40ms\n2 calls across 1 tests"

@enduml

In this example:

  • The Kafka arrow is green (P95 < 50ms)
  • The OrderService → WebApp arrow is orange (P95 50–200ms)
  • The PaymentService arrow is red (P95 > 200ms) with error rate shown
  • The CosmosDB arrow is dashed (only 2 calls, below the low-coverage threshold of 3)
  • All labels are clickable and open relationship flow popups

Relationship statistics

ComponentFlowSegmentBuilder.ComputeRelationshipStats(relationships, logs) returns a RelationshipStats for every relationship: its calls, mean and percentile latencies, error rate (status codes of 400 and up), outliers, payload sizes and concurrency, and EndpointBreakdown, the same figures for each method and path the relationship carried. Passed to the component diagram's generator, they label each arrow with its percentiles (P50: 12ms | P95: 40ms | P99: 95ms, and the error rate when there are errors) and drive the arrow colours and the dashing of a low-coverage arrow. The component diagram page draws the diagram alone: the sortable summary table this section used to describe is not in the report.

Since 5.17.0 an endpoint in EndpointBreakdown is read as history reads a call: ids and numbers folded as history folds them (/api/orders/{n}, and {id} for a GUID), where only GUIDs were folded; a GraphQL request by its operation (/graphql query GetUser); and an entity a tracker writes where a host would go as the path's first segment (/orders-queue/).


Latency Distribution Bar Chart

Below the performance table, a horizontal bar chart visualises latency across all relationships. Toggle buttons let you switch between Mean, P50, P95 (default), and P99 views. Bar width is proportional to the maximum value across all relationships.


Latency Variance (CV)

The Coefficient of Variation (CV = stdDev ÷ mean) measures how consistent a relationship's latency is across calls:

CV Range Colour Interpretation
< 0.3 Green Consistent — latency is predictable
0.3 – 0.7 Orange Moderate variability
> 0.7 Red Highly variable — investigate potential issues

A high CV often indicates intermittent performance problems such as cold starts, resource contention, or retry storms. The CV is RelationshipStats.CoefficientOfVariation, for code that reads the statistics; the report colours nothing by it.


Outlier Detection

For relationships with ≥ 5 calls, the system automatically detects outlier tests where the latency exceeds mean + 2σ (two standard deviations above the mean).

When outliers are detected:

  • A 🔺 N badge appears in the Relationship column of the performance table
  • A dedicated Outlier Detection section appears below the main analytics, showing:
    • The threshold used (mean + 2σ in milliseconds)
    • Number of outlier tests
    • Top 5 outlier tests with their duration and deviation from mean (e.g. "3.2σ")

Relationships with fewer than 5 calls skip outlier detection (insufficient data for meaningful statistics).


Latency Contribution

When the test suite exercises multiple dependencies, the Latency Contribution section shows a stacked bar chart visualising what percentage of total test time each dependency consumes, averaged across all tests.

For example, if OrderService consistently takes 200ms and PaymentService takes 50ms, the chart shows OrderService at ~80% and PaymentService at ~20%. This helps identify which dependencies dominate your test execution time.

Only shown when there are 2+ relationships with latency data.


Request Method Distribution

When a relationship uses multiple HTTP methods (e.g. GET and POST), the Request Methods section shows a colour-coded stacked bar per relationship:

Method Colour
GET Blue
POST Green
PUT Orange
DELETE Red
PATCH Purple

Each segment shows the method name and is sized proportionally to its call count. This section is hidden when all calls to a relationship use the same method (no useful information to display).


Status Codes & Payload Sizes

The report includes additional insight sections when data is available:

  • Status Codes — Per-relationship breakdown showing the distribution of HTTP status codes (e.g. 200: 45, 500: 3), colour-coded by status class (2xx green, 4xx orange, 5xx red)
  • Payload Sizes — Request and response mean/P95 payload sizes per relationship, formatted as B/KB/MB

Concurrent Call Detection

When the system detects overlapping in-flight calls from the same caller within the same test (e.g. parallel HTTP requests), a Concurrent Calls section appears showing:

Column Description
Relationship The relationship where concurrency was detected
Concurrent Tests Number of tests with overlapping calls
Percentage % of tests that exhibited concurrency
With Which other services had overlapping calls

Error Correlation

The Error Correlations section performs pairwise co-occurrence analysis across tests. When relationship A errors, how often does relationship B also error in the same test?

Column Description
When this errors... The relationship that errors
This also errors The co-occurring erroring relationship
Co-occurrence Percentage of the time both error together
Count co-occurrences / total error tests

Only shown when co-occurrence is ≥ 50% with ≥ 2 error tests. This helps identify cascading failure patterns (e.g. "when the auth service fails, the order service always fails too").


Call Ordering Patterns

The Call Ordering section aggregates the sequence of dependency calls across all tests to identify dominant patterns. For each pair of services that appear in the same test, it reports what percentage of tests call one before the other.

For example: "100% of tests call OrderService before PaymentService" or "70% of tests call AuthService before OrderService".

Only patterns with ≥ 3 samples and ≥ 60% dominance are shown, filtering out noise from low-sample or evenly-split orderings.


Interactive Focus Mode

When using PlantUmlRendering.BrowserJs (the default), clicking a service node in the component diagram dims all unrelated nodes and relationships, letting you focus on a single service's connections. Click the same node again (or click the background) to restore the full view.


Diff Mode

Compare component diagrams between test runs to detect architectural changes:

var diff = ComponentDiagramDiffer.Compare(
    baselineRelationships, currentRelationships,
    baselineStats, currentStats);

var diffPuml = ComponentDiagramDiffer.GenerateDiffPlantUml(diff);

The DiffResult includes added/removed relationships, new/removed services, and performance regressions/improvements based on P95 latency changes.

Visual Rendering

The diff PlantUML diagram uses colour coding to highlight changes:

Element Rendering
New relationships Green (#LimeGreen) solid arrow labelled NEW
Removed relationships Red (#Red) dashed arrow labelled REMOVED
Unchanged relationships Default arrow labelled unchanged
New services Green background participant
Removed services Red background participant

Pass useC4: false to GenerateDiffPlantUml to use custom skinparam styling instead of C4 includes:

var diffPuml = ComponentDiagramDiffer.GenerateDiffPlantUml(diff, title: "My Diff", useC4: false);

Performance Regression/Improvement Detection

When you pass RelationshipStats dictionaries for both baseline and current runs, the differ detects performance changes on unchanged relationships:

  • Regression: P95 latency increased by more than 20% compared to baseline
  • Improvement: P95 latency decreased by more than 20% compared to baseline

The threshold is currently hardcoded at 20%. Each StatsChange entry includes the relationship, both stats snapshots, and the absolute P95 delta in milliseconds.

Integration with PlantUML IKVM

The component diagram feature works with the standard PlantUML server rendering. If you're using PlantUML IKVM for local rendering, the .puml file can still be rendered locally using the IKVM renderer, but the component diagram report itself currently outputs raw PlantUML source in the HTML file rather than a rendered image.

Future versions may add support for rendering the component diagram as an image via the local renderer.


Performance

The component diagram feature has negligible performance impact:

Aspect Impact
Data source Reads the same RequestResponseLogger.RequestAndResponseLogs that are already in memory — no additional data collection
Processing Single O(n) pass over log entries with GroupBy — microseconds for typical test suites (100–10,000 logs)
Memory Aggregated relationships are O(unique participant pairs), typically < 50 entries
File I/O Two small files (.puml + .html) written in parallel with existing report generation
When disabled Zero cost — a single if guard at the entry point

Limitations & Known Behaviours

  1. Request-only aggregation — Only request logs are counted. Response logs are excluded to avoid double-counting (a request and its response represent a single interaction).

  2. Protocol detection — A call's DependencyCategory is its protocol. With none, a call with MetaType == Event uses the Method value as the protocol name, and any other is grouped under the "HTTP" protocol. If multiple event types share the same method name but different service names, they are tracked as separate relationships.

  3. Override and action markers — IsOverrideStart, IsOverrideEnd, and IsActionStart log entries are excluded from aggregation, consistent with how they're handled in sequence diagrams.

  4. Static data — The component diagram is generated from RequestResponseLogger.RequestAndResponseLogs, which is a static concurrent queue. In test runs where the queue is shared across frameworks or assemblies, all interactions are included.

  5. Browser SVG rendering — When PlantUmlRendering.BrowserJs is used (the default), the component diagram is rendered as an interactive SVG with clickable links and focus mode. When using PlantUmlRendering.Server, the diagram is rendered as a static <img> tag.

  6. Deprecated Gantt — InternalFlowRenderer.RenderGantt() and ComponentFlowSegmentBuilder.BuildSystemSegment() are marked [Obsolete]. They have been replaced by the latency bar chart and performance analytics sections.


API Reference

ComponentDiagramGenerator (static class)

// Extract unique relationships from tracked logs
public static ComponentRelationship[] ExtractRelationships(
    IEnumerable<RequestResponseLog> logs,
    Func<string, bool>? participantFilter = null);

// Generate C4 PlantUML from relationships (with optional stats)
public static string GeneratePlantUml(
    ComponentRelationship[] relationships,
    ComponentDiagramOptions? options = null,
    Dictionary<string, RelationshipStats>? stats = null,
    bool useC4 = true);

ComponentDiagramReportGenerator (static class)

// Generate the .puml and .html report files
public static ComponentDiagramResult GenerateComponentDiagramReport(
    IEnumerable<RequestResponseLog> logs,
    ReportConfigurationOptions reportOptions,
    Dictionary<string, InternalFlowSegment>? perBoundarySegments = null,
    Dictionary<string, InternalFlowSegment>? wholeTestSegments = null);

ComponentDiagramDiffer (static class)

// Compare two sets of relationships to detect changes
public static DiffResult Compare(
    ComponentRelationship[] baseline,
    ComponentRelationship[] current,
    Dictionary<string, RelationshipStats>? baselineStats = null,
    Dictionary<string, RelationshipStats>? currentStats = null);

// Generate a PlantUML diagram highlighting the diff
public static string GenerateDiffPlantUml(DiffResult diff, string title = "Component Diagram Diff", bool useC4 = true);

DiffResult (record)

public record DiffResult(
    ComponentRelationship[] Added,
    ComponentRelationship[] Removed,
    ComponentRelationship[] Unchanged,
    string[] NewServices,
    string[] RemovedServices,
    StatsChange[] Regressions,
    StatsChange[] Improvements);

StatsChange (record)

public record StatsChange(
    ComponentRelationship Relationship,  // The affected relationship
    RelationshipStats Baseline,          // Stats from the baseline run
    RelationshipStats Current,           // Stats from the current run
    double P95DeltaMs);                  // Absolute P95 change in milliseconds

ComponentDiagramResult (record)

public record ComponentDiagramResult(
    string HtmlFilePath,    // Absolute path to the generated .html file
    string PlantUml);       // The raw PlantUML string

ComponentRelationship (record)

public record ComponentRelationship(
    string Caller,              // Calling participant name
    string Service,             // Receiving participant name
    string Protocol,            // "HTTP" or custom protocol name
    HashSet<string> Methods,    // Distinct method names
    int CallCount,              // Total calls across all tests
    int TestCount,              // Distinct test count
    string? DependencyCategory = null);

ComponentDiagramOptions (record)

public record ComponentDiagramOptions
{
    public string FileName { get; set; } = "ComponentDiagram";
    public bool EmbedInTestRunReport { get; set; } = true;
    public string Title { get; set; } = "Component Diagram";
    public string? PlantUmlTheme { get; set; }   // applied under PlantUmlRendering.Server and Local only; elsewhere the run records OptionNotApplied (3.30.0)
    public Func<string, bool>? ParticipantFilter { get; set; }
    public Func<ComponentRelationship, string>? RelationshipLabelFormatter { get; set; }
    public bool ShowRelationshipFlows { get; set; } = true;   // no effect: nothing reads it
    public InternalFlowDiagramStyle RelationshipFlowStyle { get; set; } = InternalFlowDiagramStyle.ActivityDiagram;   // no effect
    public bool ShowSystemFlameChart { get; set; } = true;   // no effect
    public int LowCoverageThreshold { get; set; } = 3;   // no effect
    public int MaxFlameChartTests { get; set; } = 50;   // no effect
    public ArrowColorMode ArrowColorMode { get; set; } = ArrowColorMode.DependencyType;
    public Dictionary<string, string>? DependencyColors { get; set; }
}

ReportConfigurationOptions (new properties)

public bool GenerateComponentDiagram { get; set; } = true;           // Default: true
public ComponentDiagramOptions? ComponentDiagramOptions { get; set; }  // Default: null

Home · 🔍 Search this wiki Full-text search across every page. The “Pages” list above matches page and heading names, not page content.


Demo


Getting Started

Common Tasks

Integration Guides

Uninstrumentable / polyglot backends

Extensions

Configuration

Features

Reference

Clone this wiki locally