Docs
ATC Logo

Overview

Active Traffic Control (ATC) is a routing orchestration daemon for multi-datacenter Consul Connect service meshes. It bridges the gap between active routing (with health-aware failover) and offline routing (with automated fallback redirects).

Automated Resiliency

Ensure client requests are dynamically rerouted to alternative datacenters or fallback systems if local service instances experience outages or fail connection timeouts.

Fallback Redirections

Automatically redirect all service mesh consumers to a static fallback service or custom disaster recovery landing page the moment a service goes completely offline.

Deep Observability

ATC is built with native OpenTelemetry integrations, exposing detailed application metrics, structured logs, and distributed traces to Prometheus, Tempo, and Loki.

Why ATC?

In standard microservice architectures built on top of Consul Connect, failing services or services scheduled for deletion require complex manual configuration updates. Client applications usually run into connection timeouts or 503 service unavailable errors before traffic switches over. ATC automates this process by dynamically maintaining Service Resolver configuration entries in Consul based on active catalog changes and predefined policies.

Project Resources

For detailed design records and project roadmap progress, check the following resources:

  • Architecture Decision Records (ADRs): Read our design choices and architectural consequences in the ADR.MD file.
  • Project Roadmap & Todo List: Check the MoSCoW priorities and active backlog in the TODO.md file.
System

Architecture

ATC operates as a lightweight stateless daemon that coordinates traffic routing policies directly through the Consul Config Entries API. It splits responsibility into two main operational loops: the Forwarder and the Redirector.

🛡️

Active Service

Registered in Consul

➔
⚙️

ATC Daemon

Forwarder & Redirector

Active Failover
Consul

Service Resolver

Failover Targets: DC2, DC3

Meta: failover-strategy
Offline / Deleted
Consul

Service Resolver

Redirect: fallback (DC3)

Meta: redirect-strategy

Operational Modes

1. Active State (Failover Routing)

When instances of a service exist in the local catalog, ATC's Forwarder ensures a service-resolver config entry exists. If a failover strategy is specified via tags, the forwarder configures Consul to forward requests to backup datacenters or standby services if local instances fail healthchecks or connection timeouts are reached.

2. Offline State (Redirect Routing)

When a service goes completely offline (all instances deregistered from Consul), catalog tags disappear. The Redirector detects this deletion. It retrieves the service's redirect policy from its in-memory cache (or falls back to metadata on the existing config entry) and rewrites the Consul service-resolver entry to a Redirect type, gracefully routing traffic to the backup target.

Deployment

Installation & Quickstart

ATC is written in Go and compiles to a single static binary. It can be run on VM-based environments alongside Consul agents or deployed to Kubernetes containers.

1. Build from Source

Building ATC requires Go 1.22+ and Node.js (for compiling the embedded live dashboard frontend).

# Clone the repository
git clone https://github.com/atcprojectio/atc.git
cd atc

# Compile the frontend and Go binary
make build

This generates the static binary under dist/atc.

2. Install using Homebrew

On macOS, ATC can be installed with Homebrew from the official tap:

# Tap the repository
brew tap atcprojectio/tap

# Install ATC (a cask)
brew install --cask atc

On Linux, install the .deb or .rpm package or the archive from the GitHub releases, or run the container image ghcr.io/atcprojectio/atc.

3. Running the Daemon

Launch the server command by passing the path to the predefined strategies configuration file:

atc server --config deploy/strategies.yaml

Available CLI Flags

Flag Environment Variable Default Description
--config ATC_CONFIG "" Path to the YAML configuration file.
--consul_addr ATC_CONSUL_ADDR "" Consul HTTP address (e.g. http://localhost:8500). Shared by all commands.
--consul_token ATC_CONSUL_TOKEN "" ATC's own Consul ACL token. Prefer the environment variable or a mounted secret over the command line.
--consul_dc ATC_CONSUL_DC "" Consul datacenter. Empty means the local agent's datacenter.
--consul-namespace ATC_CONSUL_NAMESPACE "" Consul Enterprise namespace to scope watches and configuration writes to.
--node-name ATC_NODE_NAME "" Unique node identity for HA leader election. Defaults to a hostname-based identity.
--port ATC_PORT 8088 Port for the dashboard UI and REST API.
--metrics_port ATC_METRICS_PORT 8089 Port for the Prometheus /metrics endpoint.
--mcp-port ATC_MCP_PORT 8092 Port for the Model Context Protocol (MCP) server. 0 disables it.
--target ATC_TARGET all Comma-separated modules to run (all, consul, forwarder, redirector). Run atc modules to list them.
--log_level ATC_LOG_LEVEL info Minimum log severity (debug, info, warn, error).
--ui-enabled ATC_UI_ENABLED true Serve the embedded web UI. If disabled, UI routes return 404 while the API and MCP stay available.
--mcp-enabled ATC_MCP_ENABLED true Serve the MCP server. If disabled, the MCP listener is not started.
--listen-address ATC_LISTEN_ADDRESS "" Interface the API/UI and MCP listeners bind to (server.listen_address). Empty means all interfaces. The metrics listener always binds to all interfaces.
--tls-cert-file ATC_TLS_CERT_FILE "" Serve the API/UI and MCP over HTTPS with this certificate (server.tls_cert_file, requires --tls-key-file). The files are re-read when they change, so rotated certificates are picked up without a restart. The metrics listener stays HTTP.
--tls-key-file ATC_TLS_KEY_FILE "" Private key for --tls-cert-file (server.tls_key_file).
--allow-unauthenticated ATC_ALLOW_UNAUTHENTICATED false Explicitly allow auth to be disabled while listening on a non-loopback address (auth.allow_unauthenticated). Without it, ATC refuses to start in that configuration.
--dry-run ATC_DRY_RUN false Log the Consul changes ATC would make without writing them.
--write-rate-limit ATC_WRITE_RATE_LIMIT "1s" Coalescing window: catalog events within this duration are combined into one reconciliation. Must be a Go duration such as 1s or 500ms.

Settings are resolved in this order: command-line flags, then ATC_* environment variables, then the configuration file. The connection flags (--consul_*, --node-name) also apply to atc leader and atc validate. Settings without a flag, such as resync_interval, are set in the configuration file.

4. Deploying to Kubernetes (Helm)

An official versioned Helm chart is published directly to GitHub Container Registry (GHCR) as an OCI artifact. You can install it on your Kubernetes cluster using the following command:

helm install atc oci://ghcr.io/atcprojectio/charts/atc --version <version>

Alternatively, you can install it using the local templates provided under deploy/helm/atc:

helm install atc ./deploy/helm/atc --values ./deploy/helm/atc/values.yaml

Configuration settings like Consul addresses, predefined strategies, and resources are configurable in the values.yaml file (or using the --set flag with OCI installs).

5. Deploying to Nomad

A Nomad job definition is available at deploy/nomad/atc.nomad.hcl. To run ATC in an active-passive HA mode with two instances, run:

nomad job run ./deploy/nomad/atc.nomad.hcl
Releases

Versioning

ATC uses Semantic Versioning. A version is written X.Y.Z everywhere, with one exception: git tags and GitHub releases are named vX.Y.Z, because Go modules require the v on tags.

WhereExample for release v0.5.0
Git tag and GitHub releasev0.5.0
Binaries, archives, .deb / .rpm, Homebrew0.5.0 (e.g. atc_0.5.0_linux_amd64.zip)
atc version and the atc_build_info metric0.5.0
Container imageghcr.io/atcprojectio/atc:0.5.0
Helm chart version and appVersion0.5.0 (oci://ghcr.io/atcprojectio/charts/atc)
Go modulego install github.com/atcprojectio/atc@v0.5.0

Image tags

  • X.Y.Z (e.g. 0.5.0): one release. It never changes. Use this in production.
  • X.Y (e.g. 0.5): the latest patch release of that minor version.
  • X (e.g. 0): the latest release of that major version. Before 1.0 this includes minor releases with breaking changes, so do not use it for anything you cannot afford to break.
  • latest: the newest full release.

Pre-releases (tags like v0.5.0-rc.1) are published only under their exact version (0.5.0-rc.1). They never move X.Y, X or latest, are marked as pre-release on GitHub, are not published to Homebrew, and need helm install --devel or an explicit --version.

Images up to 0.4.0 were also tagged v0. That tag is no longer updated and stays at 0.4.0; use 0 instead.

Before 1.0

ATC is in initial development (0.y.z). Semantic Versioning allows anything to change before 1.0; ATC uses these rules:

  • Patch releases (0.5.1) contain fixes only. Upgrading needs no configuration change.
  • Minor releases (0.6.0) contain new features and may contain breaking changes. Each one is listed under Breaking changes in the release notes, with what changes and what to do.
  • Security fixes may change behaviour (for example a safer default) when that is the only safe fix. They are also listed under Breaking changes.
  • Where practical, a behaviour that is going away first logs a deprecation warning for one minor release. Before 1.0 this is not guaranteed.
  • Fixes are released for the latest minor version only.

A change counts as breaking when an existing setup may stop working or behave differently after upgrading without changes. That covers: configuration keys, their meaning and defaults; CLI flags and ATC_* environment variables; service tags (atc.*); REST API paths, payloads and status codes; MCP tool names and arguments; metric names and labels; the metadata ATC writes on service-resolver entries; Helm values; and startup checks that reject a configuration that used to start.

To stay safe before 1.0: pin an exact version (X.Y.Z) or the minor line (X.Y), and read the Breaking changes section before moving to a new minor version.

From 1.0

From 1.0 on, breaking changes are made only in major releases (2.0.0), and minor and patch releases are backwards compatible.

For maintainers

  • Pull requests are squash-merged, so the PR title becomes the commit message. Use Conventional Commits titles and mark breaking changes with ! (e.g. feat(auth)!: require auth on network addresses). The release changelog groups them under Breaking changes.
  • make tag creates the next tag with svu next --v0, which keeps the major version at 0 when a breaking change is merged. Moving to 1.0 is a deliberate, manual tag.
Demo

Consul 2.0.1 Demo Project

The ATC ecosystem includes a fully automated, multi-datacenter federated Consul 2.0.1 demo environment hosted in the atc-demo repository. It showcases how ATC dynamically generates and updates service-resolver configuration entries during service failovers and redirects.

Demo Features

  • Consul 2.0.1 WAN Federation: Runs two Consul servers (dc1 and dc2) federated over WAN.
  • HTTP Echo Servers: Mock payment services running in both datacenters to simulate actual routing targets.
  • Smart Traffic Client: A lightweight Python traffic client that queries Consul and fetches the active routing output, verifying routing decisions in real-time.
  • Automated CLI Walkthrough: A single command (make run-demo) runs a complete failover, redirect, recovery, and purge lifecycle.

Running the Demo

Ensure you have Docker and Python 3 installed, then clone the repository and execute the following tasks:

# Clone the demo repository
git clone https://github.com/atcprojectio/atc-demo.git
cd atc-demo

# Pull the ATC and Consul Docker images
make pull

# Start the Consul 2.0.1 cluster and Mock backends
make up

# Run the interactive routing walkthrough
make run-demo

Demo Lifecycle Output

When running the walkthrough, you will see output demonstrating dynamic failover:

  1. Local DC1 Healthy: Traffic resolves locally and prints:
    [Traffic Router] Local DC1 healthy -> Routing to payment-service in DC1... [DC1 Instance] Payment processed successfully!
  2. Simulated Outage (DC1 offline): ATC immediately rewrites the resolver to a Redirect to dc2. Traffic client prints:
    [Traffic Router] Redirect Rule Active -> Target DC: dc2, Service: payment-service [DC2 Instance] Payment processed successfully!
  3. Recovery (DC1 restored): ATC restores the Failover rule and traffic client resumes local routing.
Policies

Strategies Configuration

ATC admins define predefined routing strategies in a YAML configuration file. This file separates policies into failover strategies (for active services) and redirect strategies (for deleted/offline services).

YAML Schema

# Consul connection overrides
consul_namespace: "finance" # Scopes all config/watcher actions to this namespace
write_rate_limit: "1s"      # Coalesce events to prevent API write thrashing

strategies:
  failover:
    # A standard failover strategy routing to another datacenter
    standard-failover:
      connect_timeout: "10s"
      targets:
        - datacenter: "dc2"
          namespace: "finance" # Optional target namespace scope

    # Multi-datacenter targets with fallback services
    multi-region-failover:
      connect_timeout: "5s"
      targets:
        - datacenter: "dc2"
        - datacenter: "dc3"
          service: "fallback-service"

  redirect:
    # Redirect traffic to the same service name in dc2
    standard-redirect:
      datacenter: "dc2"
      namespace: "marketing" # Optional target namespace redirect

    # Redirect to a disaster recovery web service in dc3
    geo-redirect:
      service: "geo-fallback"
      datacenter: "dc3"

Strategy Fields

Failover Strategy

  • connect_timeout: The connect timeout duration (e.g. 5s, 10s) applied to the resolver.
  • targets: A list of targets to failover to. If service is omitted, it defaults to the active service's name. If datacenter is omitted, ATC picks the nearest other datacenter and keeps that choice while it stays available. When no other datacenter exists, a target that names a different service, namespace or service_subset uses the local datacenter, and a target that would point the service at itself is skipped. If namespace is specified, it scopes the target resolver to that namespace.

Redirect Strategy

  • service: The target service to redirect traffic to. Defaults to the offline service's name.
  • datacenter: The target datacenter for redirection.
  • namespace: The target namespace for redirection.

Configuration Validation & Linting (GitOps)

ATC provides a configuration validation tool to verify strategy configuration syntax and semantic rules before deploying changes to production. This is highly recommended for GitOps workflows to prevent loading invalid configurations at runtime.

To validate a configuration file, run the validate subcommand:

atc validate --config deploy/strategies.yaml

If the configuration is valid, it prints a success message and exits with status 0. If any validation rules fail, it prints detailed error messages to standard error and exits with status 1.

Validation Rules

  • Dampening Periods: dampening_period and min_dampening_period must be valid Go duration strings (e.g. 5s, 1m). Dampening period cannot be less than the min dampening period.
  • HA Leader Election: If HA is enabled, session_ttl must be a valid Go duration string between 10s and 24h (which corresponds to Consul's session limits).
  • Failover Strategies: Each strategy's connect_timeout (if specified) must be a valid Go duration string.
  • Redirect Strategies: Each strategy must define at least one target selector field (such as service, datacenter, namespace, or service_subset).

CI/CD Integration Example

Add a validation check to your GitHub Actions pre-commit or deployment workflow to lint strategies configuration files:

name: Lint ATC Config
on: [pull_request]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Validate ATC Configuration
        run: |
          go run main.go validate --config deploy/strategies.yaml
Consul

Consul Service Integration

Service teams opt-in to ATC automation and associate failover/redirect strategies using tags in their Consul service registration.

Opt-in Tags

  • atc.enabled=true: Enrolls the service in ATC reconciliation. Without this tag, ATC will not touch the service.
  • atc.failover=<strategy-name>: Binds the service to a predefined failover strategy defined in the config. If omitted, and a strategy named default is defined under strategies.failover, ATC automatically falls back to that default strategy.
  • atc.redirect=<strategy-name>: Binds the service to a predefined redirect strategy defined in the config. If omitted, and a strategy named default is defined under strategies.redirect, ATC automatically falls back to that default strategy.
  • atc.adopt=true: Lets ATC take over a service-resolver that already exists and was not created by ATC. See Existing resolvers below.

Existing resolvers

ATC writes whole service-resolver entries. If an atc.enabled service already has a resolver that ATC did not create (for example one with hand-written subsets or load-balancing settings), ATC leaves it untouched: it logs a warning once, counts it in the atc_foreign_resolvers metric, and the dashboard shows the service as Not managed by ATC. Automatic failover and redirects are then not applied to that service.

To let ATC manage it, add the tag atc.adopt=true. ATC then replaces the existing entry with its own on the next reconciliation, which drops any fields ATC does not manage.

Manual overrides refuse to replace such a resolver unless force is set, because clearing the override later deletes the entry and the original configuration would be lost.

Reconciliation and resync

ATC reconciles when the Consul catalog changes, when the configuration is reloaded, and after a resolver is purged (for example when an override is cleared or expires). In addition, the leader runs a full resync every resync_interval (default 60s, "0s" disables it). The resync retries writes that failed, for example during a Consul hiccup, and repairs resolvers that were changed or deleted outside ATC.

ATC also records each service's redirect intent in its resolver's metadata (atc-redirect-on-removal and atc-dampening-on-removal), so the configured redirect is applied even when a different node has become leader by the time the service disappears.

Default Strategies Fallback: If a strategy named default is configured in the ATC configuration file (e.g., under strategies.failover.default or strategies.redirect.default), service teams can register their services in Consul using only the atc.enabled=true tag. ATC will automatically resolve and apply the default strategy for failover or redirect if the respective specific tag is not provided.

YAML Registration Example

service:
  name: "payments-service"
  port: 8443
  tags:
    - "atc.enabled=true"
    - "atc.failover=multi-region-failover"
    - "atc.redirect=geo-redirect"

Consul Metadata Management

ATC ensures that Consul config entry metadata conforms strictly to the strategy currently in effect in the service resolver:

  • When Active: The resolver is configured for failover. The metadata reports failover-strategy and removes redirect-strategy.
  • When Offline: The resolver is configured for redirect. The metadata reports redirect-strategy and removes failover-strategy.

Consul ACL policy

ATC's own Consul token (consul_token, ATC_CONSUL_TOKEN, or consulToken.existingSecret in the Helm chart) needs the policy below, shipped as deploy/consul/atc-policy.hcl. An integration test runs ATC with exactly this policy against a default-deny Consul, and removing any rule breaks at least one ATC function.

consul acl policy create -name atc -rules @deploy/consul/atc-policy.hcl
consul acl token create -description "ATC" -policy-name atc
# Read and write service-resolver config entries. Consul requires service:write on a service
# to change its resolver. This also allows registering services under those names; if your
# ATC-managed services share a naming convention, narrow the prefix accordingly.
service_prefix "" {
  policy = "write"
}

# Read the service catalog (without node:read Consul hides services from ATC instead of
# failing) and datacenter membership for /api/federation.
node_prefix "" {
  policy = "read"
}

# Detect the local datacenter and check delegated tokens (agent/self).
agent_prefix "" {
  policy = "read"
}

# HA leader election: the lock keys under ha.lock_key (default "atc/leader/").
key_prefix "atc/leader/" {
  policy = "write"
}

# Sessions that hold the leader locks; also needed by "atc leader force-unlock".
session_prefix "" {
  policy = "write"
}

service:write is needed because Consul only lets a token change a service's resolver when it may write that service. It also allows registering services with those names; if the services ATC manages share a naming convention, narrow service_prefix to it. If the token cannot read every service, Consul hides them instead of failing; ATC then logs Consul filtered the service catalog by ACLs once.

Stability

Oscillation Dampening (Hysteresis)

ATC includes built-in oscillation dampening (hysteresis) to prevent configuration churn in Consul. If a service's health flaps or catalog state oscillates rapidly, ATC debounces the writes to protect the Consul leader from excessive write operations.

How Hysteresis Works

When a state change occurs (e.g. service goes offline or recovers), ATC schedules the configuration write after a dampening period. If a new state change arrives before the dampening timer fires (e.g. the service recovers during the dampening window), the pending write is canceled, and the transition is debounced.

Dampening Settings

  • Global Default: Set via dampening_period in the main config (e.g. 5s).
  • Service Tag Override: Bypassed or customized on a per-service basis using the tag atc.dampening=<duration> (e.g. atc.dampening=10s or atc.dampening=0s).
  • Immediate Updates: A tag value of 0s or 0 disables dampening, triggering immediate failover or redirects.
  • Safety Boundary: Set via min_dampening_period in the main config. All custom tags are clamped to this minimum limit to prevent users from bypassing operator safety settings.
Cluster

Active-Passive High Availability

To run ATC in a high-availability production environment, multiple ATC daemons can be deployed in active-passive mode. Leadership is coordinated dynamically through Consul KV Session locks.

HA Architecture

  • Target-Scoped Locks: Leadership is scope-isolated per reconciler component (e.g., atc/leader/lock/forwarder and atc/leader/lock/redirector). Node instances running a single component compete only for that component's lock. Node instances running multiple components compete for and acquire locks for each workload independently, preventing split-workload deadlocks and workload starvation.
  • Active Workload: Reconcilers for a component run only when the local node acquires the leadership lock for that component.
  • Standby Nodes: Passive standby instances keep their HTTP/metrics servers active to serve read-only APIs and dashboards, but suspend reconciler watches for any modules where they do not hold the lock.
  • Failover: If the active instance for a workload fails or experiences network partitions, the Consul session lock expires (governed by the session TTL). A standby instance instantly acquires leadership for that component and resumes reconciliation with zero data loss.

HA Configuration

ha:
  enabled: true
  lock_key: "atc/leader/lock"
  session_ttl: "15s"

HA Leadership CLI Commands

ATC provides dedicated administrative subcommands under the leader namespace to query status and force stand-down lock owners:

1. Query Leadership Status

Prints module-level leadership states, active lock keys, current leader nodes, and session IDs:

atc leader status

2. Force Unlock Module Locks

Forces the stand-down of the active leader of a component by destroying its associated Consul session:

atc leader force-unlock --module=<forwarder|redirector>

WAN Federation Indicators

ATC queries the local Consul agent's WAN coordinate/member list (via the `/api/federation` endpoint) to verify that configured target datacenters are WAN-federated and reachable. Status badges are rendered directly in the failover visualization path on the dashboard:

  • ● Green Indicator: Datacenter is healthy and WAN-federated (status is alive).
  • ▲ Red Indicator: Gossip connection to the datacenter has failed (status is failed).
  • ⚠️ Yellow Warning: Datacenter is completely missing from WAN members list (status is unfederated).
Advanced

Advanced Features

ATC includes advanced configuration capabilities for enterprise workloads, including dry-run simulation, dynamic hot-reloading, write rate limiting, and override expiration TTLs.

1. Dry-Run Mode

In dry-run mode, ATC runs the watcher and reconciler engines normally but bypasses writing or deleting configuration entries in the Consul KV registry. All actions that would be taken are written to the logs with a [DRY RUN] prefix. Enable dry-run via configuration or CLI flags:

dry_run: true
atc server --config deploy/strategies.yaml --dry-run

2. Dynamic Configuration Hot-Reloading

ATC supports watching its central configuration files for changes. If strategies, namespaces, or rate limits are updated in the configuration file, the changes are applied automatically without restarting the process. This is governed by the fsnotify watch loops. Alternatively, operators can trigger hot-reloading by:

  • Sending an authenticated POST request to the /api/reload endpoint.
  • Calling the reload_config Model Context Protocol (MCP) tool.

3. Manual Override Expiration (TTL)

When applying a manual failover override or redirect via the UI dashboard, REST API, or MCP tools, a Time-To-Live (TTL) duration (e.g. 5m, 1h, 24h) can be specified. ATC records the expiration timestamp in the configuration entry's metadata as atc-override-expires-at. A background sweeper task checks active overrides and automatically purges them once expired, restoring default routing policies.

4. Write Rate Limiting

To avoid write thrashing when many catalog events arrive at once, ATC coalesces them: events within the write_rate_limit window are combined into a single reconciliation. It is a debounce window, not a requests-per-second limit, and must be a Go duration such as "1s" or "500ms" ("0s" reconciles on every event). Values such as "10/s" are rejected at startup.

# Combine catalog events that arrive within 1 second into one reconciliation
write_rate_limit: "1s"
atc server --config deploy/strategies.yaml --write-rate-limit=500ms
Reconciler

Forwarder Module

The Forwarder manages the active state of enrolled services in the Consul registry. It ensures that the mesh routing layers are prepared to divert failing traffic instantly.

Behavior Loop

  1. Listens to Consul catalog updates from the watcher.
  2. Identifies active services tagged with atc.enabled=true.
  3. Caches configured strategy tags (failover & redirect) in-memory for downstream recovery.
  4. Evaluates the designated atc.failover strategy. If the strategy contains no custom targets, it defaults to routing to the primary remote datacenter.
  5. Checks if the existing service-resolver entry in Consul matches the strategy. If it does not, or does not exist, the forwarder updates/creates it.
  6. Sets metadata to only include failover-strategy, ensuring the inactive redirect policy is not reported in Consul.
Reconciler

Redirector Module

The Redirector handles the lifecycle transition when a service goes completely offline. It switches the service-resolver from load-balancing mode to direct redirection.

Behavior Loop

  1. Listens to catalog updates and identifies services that have been deleted/deregistered from the catalog.
  2. Filters deleted services that possess a resolver entry created by atc.
  3. Determines the redirect strategy:
    • Reads the strategy name from the in-memory cache populated while the service was active.
    • If the cache is empty (e.g. following a daemon restart), it falls back to the last known redirect-strategy in the resolver entry metadata.
  4. Updates the Consul service-resolver entry to a Redirect resolver block.
  5. Sets the metadata map on the entry to only report redirect-strategy, removing failover-strategy.
Telemetry

OpenTelemetry Instrumentation

ATC is built with native cloud-observability support. It uses the OpenTelemetry SDK to emit structured logs, standard runtime and application metrics, and distributed trace spans.

Enabling OTLP export

Prometheus metrics are always served on the metrics port. OTLP export of traces, metrics and logs (over HTTP) is enabled only when an endpoint is configured with OTEL_EXPORTER_OTLP_ENDPOINT, or per signal with OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_METRICS_ENDPOINT or OTEL_EXPORTER_OTLP_LOGS_ENDPOINT. OTEL_SDK_DISABLED=true turns it off entirely. In the Helm chart, set these through extraEnv.

OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318 atc server --config deploy/strategies.yaml

Trace Spans

All reconciliation runs, watchers, and API handlers generate tracing spans. They propagate context using standard headers, allowing developers to trace reconciliation latency and Consul client overhead.

Metrics Exposed

Metric Name Type Description
atc_build_info Gauge Build information (version, revision, Go version) from the Prometheus version collector; always 1.
atc_config_reloads_total Counter Configuration reloads, labeled status (success, failure).
atc_config_last_reload_timestamp_seconds Gauge Unix time of the last successful configuration reload.
atc_consul_requests_total Counter Consul API requests made by the forwarder and redirector, labeled operation and status.
atc_consul_request_duration_seconds Histogram Duration of those Consul API requests, labeled operation and status.
atc_dampening_pending_writes Gauge Resolver writes currently waiting out their dampening period.
atc_dampening_writes_triggered_total Counter Resolver writes scheduled with dampening.
atc_dampening_writes_cancelled_total Counter Dampened writes cancelled before firing, labeled reason (cancelled, superseded, shutdown).
atc_foreign_resolvers Gauge atc.enabled services whose existing service-resolver was not created by ATC and is left untouched (tag atc.adopt=true to manage it).
atc_forwarder_reconcile_runs_total Counter Forwarder reconciliation runs, labeled status (success, failure). A run with failed writes counts as a failure.
atc_forwarder_reconcile_duration_seconds Histogram Duration of forwarder reconciliation runs, labeled status.
atc_redirector_reconcile_runs_total Counter Redirector reconciliation runs, labeled status.
atc_redirector_reconcile_duration_seconds Histogram Duration of redirector reconciliation runs, labeled status.
atc_reconcile_coalesced_events_total Counter Catalog events combined into a single reconciliation by the write_rate_limit window.
atc_ha_is_leader Gauge 1 if this node holds the leader lock, else 0, labeled module (forwarder, redirector, or core when neither runs).
atc_ha_leader_transitions_total Counter Leadership changes on this node, labeled module and transition (acquired, lost, released).
atc_overrides_active Gauge Active manual overrides in Consul (cached for 30 seconds).
atc_overrides_purged_total Counter Expired manual overrides purged by the sweeper.
atc_strategies_configured Gauge Configured strategies, labeled strategy_type (failover, redirect).
atc_watcher_events_total Counter Catalog change events received from Consul, labeled event_type.
atc_watcher_errors_total Counter Errors or terminations of the Consul catalog watch.

Metrics emitted by both the forwarder and the redirector (Consul requests, dampening, coalescing) carry the otel_scope_name label (atc/forwarder or atc/redirector) on the Prometheus endpoint.

Docker

Local Observability Stack

The ATC developer Docker Compose environment is maintained in the atc-demo repository. It spins up a fully integrated sandbox containing Consul, ATC, and the LGTM (Loki, Grafana, Tempo, Mimir/Prometheus) observability stack.

Starting the Stack

To run the developer environment, clone the demo repository and bring up the services:

# Clone the demo repository
git clone https://github.com/atcprojectio/atc-demo.git
cd atc-demo

# Spin up Consul infrastructure and mock services
make up-infra

# Spin up the LGTM observability stack
make up-obs

# (Optional) Spin up the containerized ATC daemons
make up-atc

This launches the following endpoints locally:

  • Grafana: http://localhost:3000 (preconfigured with Loki, Prometheus, and Tempo datasources)
  • Consul UI: http://localhost:8500
  • ATC Dashboard: http://localhost:8088
  • Prometheus: http://localhost:9090

Docker Architecture

The ATC binary sends OTLP metrics, traces, and logs directly to the OpenTelemetry Collector container over OTLP/HTTP on port 4318 (set through OTEL_EXPORTER_OTLP_ENDPOINT in the demo's Compose file). The Collector filters and distributes these signals to Prometheus, Tempo, and Loki respectively.

UI

Live Dashboard UI

The ATC Web Dashboard is a premium glassmorphic React interface embedded directly inside the Go binary. It provides ATC administrators and platform teams with a real-time visualization of service mesh routing paths.

Optional Web UI: The Web UI dashboard is enabled by default. In environments where you want to disable UI serving (e.g., for security constraints or minimal resource footprint), you can set server.ui_enabled: false in your configuration file, or pass the --ui-enabled=false command-line flag. When disabled, requests to UI static routes will return a 404 Not Found response with "Web UI is disabled", but REST API endpoints (e.g. /api/services) and MCP tools remain fully functional.
ATC Live Dashboard
orders-service FAILOVER

Failover Strategy: multi-region-failover

Local orders-service (dc2) fallback-service (dc3)
payments-service REDIRECT Offline

Redirect Strategy: geo-redirect

Local geo-fallback (dc3)

Features

  • Real-time status indicators: Instantly view if a service is actively balancing local instances, failing over, or redirecting.
  • Dynamic target path visualizers: Traces and visualizes the target paths of active failover configurations or redirect paths.
  • Orphan Purging: Allows platform administrators to clean up orphaned resolver configurations from Consul directly via the dashboard with a single click.
Reference

API Reference

ATC exposes REST API endpoints for monitoring and lifecycle actions on port 8088.

1. GET /api/services

Returns a list of all services enrolled in ATC, their current operational status, active resolver types, strategy definitions, and targets.

Response Schema

[
  {
    "name": "test-service",
    "tags": [
      "atc.enabled=true",
      "primary",
      "atc.failover=multi-region-failover",
      "atc.redirect=geo-redirect"
    ],
    "resolver_type": "failover",
    "status": "active",
    "failover_strategy": "multi-region-failover",
    "redirect_strategy": "geo-redirect",
    "failover_targets": [
      {
        "service": "test-service",
        "datacenter": "dc2"
      },
      {
        "service": "fallback-service",
        "datacenter": "dc3"
      }
    ]
  }
]

2. DELETE /api/services?name=<service-name>

Purges the service-resolver configuration entry for the specified service from Consul. Used to clean up orphaned entries or clear manual overrides.

Query Parameters

  • name (required): The name of the service to purge.

Response Codes

  • 204 No Content: Purge succeeded. ATC reconciles right away, so automatic routing for the service is restored.
  • 200 OK with {"status":"dry_run",...}: dry-run mode; the purge was only logged.
  • 400 Bad Request: Missing service name parameter.
  • 403 Forbidden: The entry was not created by ATC (cannot purge).
  • 404 Not Found: The config entry does not exist in Consul.
  • 500 Internal Server Error: Consul could not be queried or the delete failed.

3. POST /api/overrides

Manually overrides service routing behavior. Writes a Consul service-resolver configuration entry tagged with "created-by": "atc-override", causing ATC automated reconcilers to bypass this service. To restore automated watcher reconciliation, call the DELETE /api/services?name=<service-name> endpoint.

Request Body

{
  "service": "payment-service",
  "type": "failover|redirect",
  "target_dc": "dc2",
  "duration": "1h",
  "force": false
}

Set force to true to replace a service-resolver that ATC did not create. Clearing the override later deletes that entry, so the original configuration is lost.

The optional duration parameter specifies a Time-To-Live (TTL) for the manual override (e.g. "5m", "15m", "1h", "24h"). Once expired, a background task loop automatically purges the override resolver from Consul.

Response Codes

  • 200 OK: Override applied ({"status":"applied"}), or in dry-run mode only logged ({"status":"dry_run","message":...}).
  • 400 Bad Request: Invalid body, missing fields, invalid type, or a duration that is not a positive Go duration (e.g. "-5m" or "10/s").
  • 409 Conflict: The service already has a resolver ATC did not create, and force was not set.
  • 500 Internal Server Error: Consul write failed.

4. POST /api/reload

Dynamically triggers a configuration file hot-reload, re-reading the active config file from disk, unmarshalling new settings, and dynamically propagating them to all submodules (forwarder and redirector) without restarting the daemon process.

Response Codes

  • 200 OK: Configuration successfully reloaded.
  • 500 Internal Server Error: Reload failed or file reading error.

5. GET /api/strategies

Returns the JSON representation of all predefined failover and redirect strategy templates configured in the ATC daemon.

Response Schema

{
  "failover": {
    "standard-failover": {
      "connect_timeout": "15s",
      "targets": [
        {
          "service": "payment-service",
          "datacenter": "dc2"
        }
      ]
    }
  },
  "redirect": {
    "standard-redirect": {
      "service": "payment-service",
      "datacenter": "dc2"
    }
  }
}

6. GET /api/leader

Returns the detailed JSON representation of the cluster leadership status, current active leader node names, and component-specific Consul lock keys and sessions.

Response Schema

{
  "leader": true,
  "auth_enabled": false,
  "components": {
    "forwarder": true,
    "redirector": true
  },
  "local_node": "atc-node-01",
  "modules": {
    "forwarder": {
      "is_leader": true,
      "leader_node": "atc-node-01",
      "lock_key": "atc/leader/lock/forwarder",
      "session_id": "c1a9a8be-e086-455b-b9d9-2ea11e1f76f7"
    },
    "redirector": {
      "is_leader": false,
      "leader_node": "atc-node-02",
      "lock_key": "atc/leader/lock/redirector",
      "session_id": "7f3c2d1e-5b4a-4c3d-9e8f-0a1b2c3d4e5f"
    }
  }
}

7. GET /api/modules

Returns a JSON array of all active reconciliation modules enabled on this ATC daemon instance.

Response Schema

[
  "forwarder",
  "redirector"
]

8. GET /api/federation

Returns the WAN federation status of all configured target datacenters, including local Consul agent WAN member states.

Response Schema

[
  {"datacenter": "dc1", "status": "alive"},
  {"datacenter": "dc2", "status": "failed"}
]

9. GET /ready and GET /health

Both probes return 200 OK with the plain-text body OK, or 503 Service Unavailable while a shutdown is in progress. They skip authentication and Host/Origin checks so orchestrator probes keep working.

Neither probe checks Consul, on purpose. Consul is shared by every replica, so failing readiness during a Consul outage would remove all replicas from the load balancer at once and replace the dashboard with a bare error page. Instead, the dashboard explains the outage (see GET /api/status).

10. GET /api/status

Reports whether ATC can use Consul. It needs no token, so the dashboard can explain an outage even when delegated tokens cannot be verified. It returns fixed messages only; the underlying error is logged by ATC (Consul is not usable / Consul connection restored). The check uses ATC's own token and is cached for 5 seconds.

{
  "consul": {
    "reachable": false,
    "problem": "unreachable",
    "message": "ATC cannot reach Consul.",
    "last_contact": "2026-11-17T12:44:49+01:00",
    "checked_at": "2026-11-17T12:45:08+01:00"
  }
}

problem is unreachable or no_leader, and is omitted when Consul is reachable. While Consul is unusable, the dashboard shows an outage banner and disables override and purge actions, and requests authenticated with a delegated Consul token get 503 with {"error": "consul_unavailable"} instead of 401.

11. GET /services

Returns an ASCII representation of the active services catalog and their routing configurations (intended for quick terminal debugging).

Response Headers

Content-Type: text/plain; charset=utf-8
Agent API

Model Context Protocol (MCP) Server

ATC natively exposes a Model Context Protocol (MCP) server over HTTP at /mcp on a dedicated listener port (default 8092) using Server-Sent Events (SSE). This allows AI coding assistants, autonomous agents, and CLI tools to interact with ATC dynamically, inspect routing policies, and apply manual failovers without socket starvation on the main dashboard port.

Optional MCP Server: The MCP server is enabled by default. In environments where you want to disable the MCP server (e.g., for security constraints or minimal resource footprint), you can set server.mcp_enabled: false or server.mcp_port: 0 in your configuration file, or pass the --mcp-enabled=false or --mcp-port=0 command-line flags. When disabled, the MCP listener is not started.

SSE Connection Details

The MCP server uses SSE (Server-Sent Events) for bi-directional communication. The initial SSE channel is opened at /mcp, and client tool-calls are posted back to the session-specific endpoint.

# Establish connection (SSE)
curl -N -H "Accept: application/json, text/event-stream" \
     -H "Authorization: Bearer <token>" \
     http://localhost:8092/mcp

# Call tools by posting JSON-RPC requests to the session endpoint

Available MCP Tools

ATC registers the following 10 tools on the MCP server:

Tool Name Arguments Description
check_readiness None Check if the ATC daemon is ready to receive requests.
check_leadership None Check the leader status of the current ATC process.
list_atc_enabled_services None List all services in the catalog that are ATC-enabled.
list_wan_federation_status None Get the WAN federation members status in Consul.
list_strategies None List all loaded failover and redirection strategies.
list_active_overrides None List all active manual overrides in Consul.
reload_config None Trigger a hot-reload of the configuration files.
purge_redirect_config name (string, required) Purge all ATC-created resolver configs for a service.
apply_failover_override service (string), target_dc (string), namespace (string, optional), duration (string, optional), force (bool, optional) Apply a manual failover override targeting a datacenter with optional TTL. Refuses to replace a resolver ATC did not create unless force is set.
trigger_manual_redirect service (string), redirect_dc (string), namespace (string, optional), duration (string, optional), force (bool, optional) Trigger a manual redirect of the service to a datacenter with optional TTL. Refuses to replace a resolver ATC did not create unless force is set.

Claude Desktop MCP Integration

To enable the ATC Model Context Protocol (MCP) server in Claude Desktop, bridge the Streamable HTTP SSE transport to Claude's stdio interface using the official mcp-remote bridge client.

  1. Open the Claude Desktop configuration file:
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add the atc configuration block under mcpServers pointing to the remote HTTP SSE endpoint:
{
  "mcpServers": {
    "atc": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "http://localhost:8092/mcp"
      ]
    }
  }
}
Security

Authentication & Security

ATC includes built-in authentication and authorization middleware to secure all REST API and Model Context Protocol (MCP) transport endpoints in production (except the /health and /ready telemetry checks).

1. Enabling Authentication

Authentication settings are configured under the auth section block in the YAML config file:

auth:
  enabled: true
  static_keys:
    - "<a long random key>"   # the placeholder atc-super-secret-token is rejected
  consul_token_delegation: true

Secure by default: ATC refuses to start when auth.enabled is false and the API/MCP listeners are reachable from other hosts. Either enable auth, bind to loopback with server.listen_address: "127.0.0.1", or accept the risk explicitly with auth.allow_unauthenticated: true / --allow-unauthenticated. Configuration is validated at startup and on every reload.

2. Token Passing Methods

Clients can authenticate by passing a token using one of the following methods:

  • Authorization Header: Authorization: Bearer <token>
  • Custom Headers: X-ATC-Token: <token> or X-Consul-Token: <token>

Tokens in the query string (?token=) are not accepted: URLs are recorded in access logs, traces, browser history and Referer headers.

3. Validation & Consul RBAC Delegation

When a request is received, ATC validates the token:

  1. If the token matches any string in static_keys, authorization succeeds.
  2. If consul_token_delegation is enabled, ATC forwards the token to the local Consul agent via the /v1/agent/self API. If Consul accepts the token as valid, authorization succeeds. Furthermore, for Consul read/write queries, ATC dynamically propagates this delegated token in the Consul context, enforcing user-level Consul ACLs natively.

Verification results are cached: a token Consul accepts for 30 seconds, a token it rejects for 10 seconds. Checks that are not cached are limited to 20 per second (bursts of 40); beyond that, requests with unknown tokens get 429 Too Many Requests instead of a Consul call, so unauthenticated clients cannot turn requests into load on Consul. Cached valid tokens are not affected.

MCP sessions are bound to the token that created them: a request that reuses an MCP session ID with a different token is rejected, so one caller cannot run tools with another caller's Consul permissions.

Transport security

API tokens, including users' Consul ACL tokens when token delegation is enabled, are sent with every request. Serve ATC over HTTPS: either terminate TLS in front of it (ingress, load balancer, service mesh) or let ATC serve HTTPS itself with server.tls_cert_file and server.tls_key_file (or --tls-cert-file / --tls-key-file). ATC re-reads the files when they change, so certificates rotated by cert-manager or Vault are picked up without a restart. When auth is enabled, ATC is reachable from other hosts and does not serve HTTPS itself, it logs a warning at startup.

Every response carries a strict Content-Security-Policy (only ATC's own origin may provide scripts, styles, fonts and API endpoints) and Referrer-Policy: no-referrer. With TLS enabled, responses also set Strict-Transport-Security. The dashboard keeps the API token in the browser's session storage, so it is gone when the tab is closed.

4. Browser Origins & DNS Rebinding

Requests carrying an Origin header are only accepted when they are same-origin (e.g. the embedded dashboard), listed in server.allowed_origins, or come from a localhost page to a locally bound ATC. The MCP listener echoes allowed origins in its CORS headers instead of *. When auth is disabled on loopback, requests whose Host header is not a loopback name are rejected to block DNS-rebinding attacks.

server:
  listen_address: "127.0.0.1"
  allowed_origins:
    - "https://ops.example.com"

5. High-Priority JSON Audit Logging

All state-changing actions (manual overrides and purges) write structured JSON logs directly to the process's standard output or error stream:

{"time":"2026-06-23T15:02:53+02:00","level":"INFO","msg":"audit event","module":"audit","audit":true,"client_ip":"127.0.0.1","actor":"atc-super...","action":"create_override","target_service":"payment-service","params":{"target_dc":"dc2","type":"failover"}}

Sensitive tokens are automatically masked in the actor attribute to prevent secret exposure in logs. Override and purge entries carry an outcome: applied / purged, dry_run, rejected (invalid request or a resolver ATC did not create) or failed (with the error), so refused and failed attempts are audited too.