Skip to main content

Inter-region latency statistics plugin for az-scout

Project description

az-scout-plugin-latency-stats

Inter-region and inter-zone (Availability Zone) latency plugin for az-scout.

Screnshot of latency plugin

Features

  • Latency dataset — static latency matrix based on Microsoft published statistics
  • Cloud63 dataset support — optional inter-region crowd-sourced measurements via mode="cloud63"
  • Inter-zone dataset support — benchmark-based AZ latency matrix from Cloud63 benchmark API
  • API endpoints — inter-region and inter-zone endpoints for matrix and available regions
  • MCP toolsinter_region_latency(...) for inter-region RTT and inter_zone_latency(...) for inter-zone P50 RTT latency in µs
  • UI tab — interactive D3.js views with inter-region/inter-zone scope switch, map/table synchronization, and bidirectional hover highlighting
  • URL hash routing#latency-stats selects the plugin tab

Setup

pip install az-scout-plugin-latency-stats
az-scout  # plugin is auto-discovered

For development:

git clone https://github.com/az-scout/az-scout-plugin-latency-stats
cd az-scout-plugin-latency-stats
uv sync --group dev
uv pip install -e .
az-scout  # plugin is auto-discovered

Structure

az-scout-plugin-latency-stats/
├── .github/
│   ├── copilot-instructions.md  # Copilot context for this plugin
│   └── workflows/
│       ├── ci.yml               # CI pipeline (lint + test, Python 3.11–3.13)
│       └── publish.yml          # Publish to PyPI on version tags
├── pyproject.toml
├── README.md
└── src/
    └── az_scout_latency_stats/
        ├── __init__.py          # Plugin class + module-level `plugin` instance
        ├── cloud63.py           # Cloud63 data fetch/cache + inter-region matrix API
        ├── inter_zone.py        # Inter-zone benchmark fetch/cache + AZ matrix API
        ├── latency.py           # Static latency dataset + public API
        ├── metadata.py          # Shared source/disclaimer/methodology constants
        ├── routes.py            # FastAPI APIRouter (optional)
        ├── tools.py             # MCP tool functions (optional)
        └── static/
            ├── css/
            │   └── latency.css      # Plugin styles (auto-loaded via css_entry)
            ├── data/
            │   └── region-coordinates.json
            ├── html/
            │   └── latency-tab.html # HTML fragment (fetched by JS at runtime)
            └── js/
                ├── latency-tab.js           # Main tab bootstrap + inter-region UI logic
                └── latency-tab-interzone.js # Inter-zone graph/table rendering + sync

How it works

  1. The plugin loads the HTML fragment into #plugin-tab-latency-stats.
  2. The user selects a scope:
    • Inter-region: select regions and choose source mode (azuredocs or cloud63).
    • Inter-zone (AZ): uses the main app region selector (#region-select).
  3. Inter-region calls POST /plugins/latency-stats/inter-region/matrix and renders world map + matrix table.
  4. Inter-zone calls POST /plugins/latency-stats/inter-zone/matrix and renders AZ graph + pair table.
  5. Hover interactions are synchronized between graph links and table values in both directions.

API

# Pairwise matrix
curl -X POST http://localhost:8080/plugins/latency-stats/inter-region/matrix \
  -H "Content-Type: application/json" \
  -d '{"regions": ["francecentral", "westeurope", "eastus"], "mode": "azuredocs"}'

# All known pairs
curl http://localhost:8080/plugins/latency-stats/inter-region/pairs

# Cloud63 available regions
curl http://localhost:8080/plugins/latency-stats/inter-region/cloud63-regions

# Inter-zone available regions
curl http://localhost:8080/plugins/latency-stats/inter-zone/regions

# Inter-zone AZ matrix
curl -X POST http://localhost:8080/plugins/latency-stats/inter-zone/matrix \
  -H "Content-Type: application/json" \
  -d '{"region": "westeurope"}'

MCP tool

inter_region_latency(source_region="francecentral", target_region="westeurope")
inter_region_latency(source_region="francecentral", target_region="westeurope", mode="cloud63")
inter_zone_latency(region="westeurope", source_zone="az1", target_zone="az2")

Quality checks

The scaffold includes GitHub Actions workflows in .github/workflows/:

  • ci.yml — Runs lint (ruff + mypy) and tests (pytest) on Python 3.11–3.13, triggered on push/PR to main.
  • publish.yml — Builds, creates a GitHub Release, and publishes to PyPI via trusted publishing (OIDC). Triggered on version tags (v*). Requires a pypi environment configured in your repo settings with OIDC trusted publishing.

Run the same checks locally:

uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
uv run mypy src/
uv run pytest

To publish a release:

git tag v2026.2.0
git push origin v2026.2.0

Copilot support

The .github/copilot-instructions.md file provides context to GitHub Copilot about the plugin structure, conventions, and az-scout plugin API. It helps Copilot generate code that follows the project patterns.

Data sources

  • Azure Docs (inter-region): Azure Network Latency
  • Cloud63 (inter-region optional mode): Azure Latency Test
  • Cloud63 benchmark API (inter-zone AZ): https://fa-azure-network-benchmark.azurewebsites.net/api/data

Inter-zone outputs are exposed in microseconds (latencyUsP50). Always validate with in-tenant measurements.

License

MIT

Disclaimer

This tool is not affiliated with Microsoft. All capacity, pricing, and latency information are indicative and not a guarantee of deployment success. Spot placement scores are probabilistic. Quota values and pricing are dynamic and may change between planning and actual deployment. Latency values are sourced from public benchmark/documentation endpoints and must be validated with in-tenant measurements.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

az_scout_plugin_latency_stats-2026.3.5.tar.gz (150.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file az_scout_plugin_latency_stats-2026.3.5.tar.gz.

File metadata

File hashes

Hashes for az_scout_plugin_latency_stats-2026.3.5.tar.gz
Algorithm Hash digest
SHA256 0c1b6047a2b52b32ded1a4e5e21e5f0ec08f9526cd3b789ef9cb6acae7278880
MD5 b4a6ad376ae464c3feee8b17379363d9
BLAKE2b-256 febb9a146988d80106f0bd2cffb25c1d4631dc54d47b9f1d9c043e7d713d242a

See more details on using hashes here.

Provenance

The following attestation bundles were made for az_scout_plugin_latency_stats-2026.3.5.tar.gz:

Publisher: publish.yml on az-scout/az-scout-plugin-latency-stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file az_scout_plugin_latency_stats-2026.3.5-py3-none-any.whl.

File metadata

File hashes

Hashes for az_scout_plugin_latency_stats-2026.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 cc459e0f2ac6059e867374daebb08f613da203980ec8c72c1c64c36ca0193c20
MD5 3e55d50908d0bc58d32709fc89b81c0b
BLAKE2b-256 4123eca43181b9562bf0a377a82b5077a2e18cacf2b37ad6e9ed3017ce9bc35e

See more details on using hashes here.

Provenance

The following attestation bundles were made for az_scout_plugin_latency_stats-2026.3.5-py3-none-any.whl:

Publisher: publish.yml on az-scout/az-scout-plugin-latency-stats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page