feat: add support for edge ingestion and query - #176
Merged
Conversation
Adds support for Axiom's regional edge deployments for data ingestion, matching the functionality implemented in Vector (vectordotdev/vector#24037). ## New Configuration Options - `region`: Regional edge domain (e.g., 'eu-central-1.aws.edge.axiom.co') When set, data is sent to `https://{region}/v1/ingest/{dataset}` - `url`: Smart path handling for backwards compatibility - URLs with custom paths are used as-is - URLs without paths append legacy format `/v1/datasets/{dataset}/ingest` ## Environment Variables - `AXIOM_REGION`: New env var for regional edge configuration - `AXIOM_URL`: Existing env var (unchanged behavior) ## Configuration Priority url > region > default cloud endpoint ## Breaking Changes - Parameter renamed from `url_base` to `url` (positional args still work) ## Validation - `EdgeConfigError` raised when both `url` and `region` are specified ## Architecture - Dual session design: API session for management operations, edge session for ingest/query operations - Only ingest and query operations use edge endpoints - All other API operations (datasets, annotations, users, tokens) continue to use api.axiom.co Amp-Thread-ID: https://ampcode.com/threads/T-019bc691-bc45-718d-8f52-a4b5d139440c Co-authored-by: Amp <amp@ampcode.com>
Edge endpoints use a different path format (/v1/ingest/{dataset}) than
the legacy API (/v1/datasets/{dataset}/ingest). For backwards compatibility,
the default should use api.axiom.co with the legacy path format.
Edge path format is only used when `region` is explicitly configured.
The CI environment has AXIOM_URL set, which was causing EdgeConfigError when tests tried to use the region parameter.
Matches Vector's behavior where url takes precedence if both are set, rather than raising an error.
Add comprehensive integration tests for edge-based ingest and query: - TestEdgeIntegration with ingest, query, and roundtrip tests - Tests skip if AXIOM_EDGE_URL or AXIOM_EDGE_REGION not set - Supports AXIOM_EDGE_TOKEN for separate edge authentication - TestEdgeURLConfiguration for URL precedence unit test Update CI workflow with edge secrets matching axiom-go: - AXIOM_EDGE_URL, AXIOM_EDGE_REGION, AXIOM_EDGE_TOKEN - AXIOM_EDGE_DATASET_REGION for dataset region config
Add AXIOM_EDGE_URL support to match axiom-go:
- edge_url parameter uses edge path format /v1/ingest/{dataset}
- url parameter uses legacy format /v1/datasets/{dataset}/ingest
- Priority: edge_url > region > url (for edge operations)
Update tests to clear AXIOM_EDGE_URL env var and add new test cases.
Edge endpoints require an API token (not personal token). Add: - edge_token parameter to Client (falls back to AXIOM_EDGE_TOKEN env var) - Edge session uses edge_token for Authorization header - Falls back to main token if edge_token not provided This matches axiom-go's approach where edge operations use a dedicated token separate from the main API token.
- Rename 'region' param to 'edge', AXIOM_EDGE_REGION to AXIOM_EDGE - Remove edge_token param and AXIOM_EDGE_TOKEN (use single token) - Add PersonalTokenNotSupportedForEdgeError for edge ingest validation - Simplify to single session (remove dual session architecture) - Fix edge query path to /v1/query/_apl - Add region param to DatasetCreateRequest for dataset locality - Update CI to use vars instead of secrets for edge config - Add edge documentation to README Amp-Thread-ID: https://ampcode.com/threads/T-019bfc15-cc0b-7248-843c-a5e234a18301 Co-authored-by: Amp <amp@ampcode.com>
…upport - Use matrix with environment (development/staging) and slug (DEV/STAGING) - Use vars for EDGE_URL, EDGE, EDGE_DATASET_REGION (account-level) - Use secrets for EDGE_TOKEN (account-level) - Add AXIOM_DATASET_SUFFIX for easier test cleanup - Edge integration test uses AXIOM_EDGE_TOKEN for edge client - Update helpers.py to use AXIOM_DATASET_SUFFIX in dataset names Amp-Thread-ID: https://ampcode.com/threads/T-019bfc15-cc0b-7248-843c-a5e234a18301 Co-authored-by: Amp <amp@ampcode.com>
Edge configuration (AXIOM_EDGE_URL, AXIOM_EDGE) must be passed explicitly when creating a Client. This prevents accidentally routing all requests through edge when these env vars are set for edge-specific tests. This matches axiom-go behavior where a separate edge client is created with explicit edge options. Amp-Thread-ID: https://ampcode.com/threads/T-019bfc15-cc0b-7248-843c-a5e234a18301 Co-authored-by: Amp <amp@ampcode.com>
- Logger test now uses ['dataset-name'] syntax for APL queries - Add debug logging to edge integration test to diagnose region mismatch Amp-Thread-ID: https://ampcode.com/threads/T-019bfc15-cc0b-7248-843c-a5e234a18301 Co-authored-by: Amp <amp@ampcode.com>
- Use single token for both API and edge operations - Remove AXIOM_EDGE env var, use only edge_url parameter - Add personal token validation for edge ingest/query - Add dataset region parameter for regional dataset creation - Normalize empty string edge_url to None - Add skip logic for edge tests when server ignores region param - Add retry logic for edge query eventual consistency Amp-Thread-ID: https://ampcode.com/threads/T-019c043c-0fdd-73e2-851a-b670728fb75a Co-authored-by: Amp <amp@ampcode.com>
Handle AxiomError for 'invalid field' when schema not yet indexed. Increase retry attempts to 10 with 2s delay for eventual consistency. Amp-Thread-ID: https://ampcode.com/threads/T-019c043c-0fdd-73e2-851a-b670728fb75a Co-authored-by: Amp <amp@ampcode.com>
Conor Curran (ronoc)
approved these changes
Jan 29, 2026
Changed variable name from `time` to `t` in test_edge_ingest_events() and test_edge_ingest_and_query_roundtrip() to avoid shadowing the `time` module, which caused time.sleep(2) calls to fail. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added missing region validation to TestAsyncEdgeIntegration.setUpClass to match the sync TestEdgeIntegration behavior: - Skip tests if AXIOM_EDGE_DATASET_REGION is not set - Verify dataset was created in expected region before running tests - Skip with clear message if region mismatch detected This prevents "mismatched region" errors when the dataset is created in a different region than the edge endpoint. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for regional edge endpoints for ingest and query operations, aligned with axiom-go PR #401.
Changes
Client API
edgeparameter: Regional edge domain (e.g.,eu-central-1.aws.edge.axiom.co)edge_urlparameter: Explicit edge URL (takes precedence overedge)AXIOM_EDGE,AXIOM_EDGE_URLEdge Routing
https://{edge}/v1/ingest/{dataset}https://{edge}/v1/query/_aplValidation
xaat-), not personal tokens (xapt-)PersonalTokenNotSupportedForEdgeErrorraised on edge ingest with personal tokenDataset Region
DatasetsClient.create()accepts optionalregionparameter for dataset localityExample Usage
Breaking Changes
None - edge configuration is optional and existing behavior is preserved.