Open-Source Wikis

/

Consul

/

By the numbers

hashicorp/consul

By the numbers

Data collected on 2026-04-30 from main at commit 590e3861fe.

Size

xychart-beta horizontal
    title "Lines of code by file group (non-test, top-level)"
    x-axis ["Go (non-test)", "Go tests", "Generated proto Go", "Ember UI (JS/TS/HBS)"]
    y-axis "LoC" 0 --> 400000
    bar [352071, 381970, 200000, 50281]
Group Files LoC
Go non-test 1,528 352,071
Go tests 830 381,970
Markdown docs 50 n/a
UI (Ember.js + Handlebars) 100s ~50K JS/TS + 281 .hbs

Total Go files in the repo: 2,358.

Largest non-test Go files

LoC (bytes) File
349 KB proto/private/pbconfigentry/config_entry.pb.go (generated)
173 KB agent/consul/state/catalog.go
158 KB agent/agent.go
107 KB agent/config/builder.go
106 KB agent/xds/listeners.go
101 KB agent/structs/structs.go
91 KB proto/private/pbpeering/peering.pb.go (generated)
84 KB agent/xds/clusters.go
72 KB agent/config/runtime.go
72 KB agent/dns.go

The pattern is unmistakable: a small set of "god files" hold the bulk of the runtime logic. agent/agent.go and agent/consul/server.go have grown organically across many releases as new features were stitched into the central Agent and Server structs.

Module count

The repo is a Go workspace with five sub-modules in addition to the root:

Module Path
consul ./ (root)
consul/api api/
consul/sdk sdk/
consul/envoyextensions envoyextensions/
consul/proto-public proto-public/
consul/troubleshoot troubleshoot/

go.mod uses replace directives to point each one at its sibling directory.

Files per top-level Go directory

Dir Non-test Go files
agent/ 716
command/ 193
internal/ 164
proto/ 70
proto-public/ 68
api/ 55
lib/ 28
sdk/ 25
troubleshoot/ 12
connect/ 10
envoyextensions/ 9
tlsutil/ 3

Activity

Commits per year

xychart-beta horizontal
    title "Commits per year"
    x-axis ["2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026"]
    y-axis "Commits" 0 --> 3500
    bar [112, 1627, 1564, 1535, 2384, 2061, 1443, 2765, 2723, 3177, 1573, 545, 278, 98]

The codebase peaked in volume in 2022 (3,177 commits). Commit volume has dropped sharply since 2023, coinciding with the strategic refocus of mesh capabilities into the HashiCorp Consul Dataplane and the maintenance footing for v1.x while the v2 resource model matures.

Recent churn (last 90 days)

Top changed top-level paths between 2026-01-30 and 2026-04-30:

Path Commits
ui/packages/ 4,461
website/content/ 801
test/integration/ 551
agent/consul/ 422
website/public/ 395
agent/xds/ 163
agent/structs/ 136
command/acl/ 126
proto/private/ 91
agent/grpc-external/ 84
testing/deployer/ 70
internal/controller/ 61
agent/connect/ 61
agent/proxycfg/ 59
agent/config/ 52
agent/cache-types/ 51
internal/resource/ 50

The recent UI churn dominates because of a large refresh in the Ember.js admin app. On the Go side, ACL command line tools, xDS, structs, and the v2 resource framework (internal/resource, internal/controller) remain the active centers of gravity.

Bot-attributed commits

Of approximately 30,518 commits in the full history, 2,774 (~9%) carry an attribution that matches a bot pattern ([bot], dependabot, github-actions, factory-droid, or HashiCorp's hc-github-team). This is a lower bound: AI-assisted contributions made through inline tooling leave no trace in git metadata.

Most of the bot commits are dependency bumps and changelog generation.

Test-to-code ratio

The Go test suite is slightly larger than the non-test Go code (382 K vs 352 K LoC). A few packages dominate:

  • agent/consul/ test files alone account for over a million lines of testdata-laden tests (e.g., acl_test.go: 180 KB, prepared_query_endpoint_test.go: 108 KB, peering_test.go: 88 KB).
  • agent/structs/structs_test.go is 79 KB.
  • agent/xds/resources_test.go weighs in at 118 KB and is dominated by golden-file comparisons in agent/xds/testdata/.

Dependencies

The root module's go.mod declares ~100 direct dependencies. A small selection that drive the runtime:

Family Examples
Consensus github.com/hashicorp/raft, raft-boltdb, raft-wal
Membership github.com/hashicorp/serf, memberlist
RPC github.com/hashicorp/net-rpc-msgpackrpc/v2, google.golang.org/grpc, connect-rpc shims
Storage github.com/hashicorp/go-memdb
TLS / PKI github.com/hashicorp/go-rootcerts, github.com/hashicorp/cap
Service mesh github.com/envoyproxy/go-control-plane (Envoy xDS APIs)
Cloud AWS SDK v2, Azure SDK, AliCloud SDK, GCP SDK (used for cloud auto-join)
Identity github.com/coreos/go-oidc/v3, golang-jwt/jwt/v5, go-jose/v3

See reference/dependencies.md for the full inventory.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

By the numbers – Consul wiki | Factory