4b6817381b
Benchmark image — build + push to ECR (any adapter) / build + push (push) Waiting to run
CI / quality (ubuntu-latest) (push) Waiting to run
CI / test (tools-runtime) (push) Waiting to run
CI / test (e2e-general) (push) Waiting to run
CI / test (cli-runtime) (push) Waiting to run
CI / test (e2e-provider-and-openclaw) (push) Waiting to run
CI / test (integrations-and-misc) (push) Waiting to run
CI / coverage-report (push) Blocked by required conditions
CI / test-kubernetes (push) Waiting to run
CI / should-run-thorough (push) Waiting to run
CI / test-thorough (cloudwatch-demo) (push) Blocked by required conditions
CI / test-thorough (flink-ecs) (push) Blocked by required conditions
CI / test-thorough (upstream-lambda) (push) Blocked by required conditions
CI / test-thorough (prefect-ecs-fargate) (push) Blocked by required conditions
CodeQL / Analyze (python) (push) Waiting to run
Release / build-binaries (zip, opensre.exe, onefile, windows-latest, windows-x64) (push) Blocked by required conditions
Release / publish-release (push) Blocked by required conditions
Release / publish-main-release (push) Blocked by required conditions
Release / prepare (push) Waiting to run
Release / verify (push) Blocked by required conditions
Release / build-python-dist (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-15-intel, darwin-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, macos-latest, darwin-arm64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04, linux-x64) (push) Blocked by required conditions
Release / build-binaries (tar.gz, opensre, onedir, ubuntu-22.04-arm, linux-arm64) (push) Blocked by required conditions
Synthetic Deterministic Tests / Synthetic offline (deterministic) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-checks (no-LLM) (push) Waiting to run
Interactive Shell Live (PR + post-merge) / turn-live shard ${{ matrix.shard_index }} (push) Waiting to run
CI (OpenClaw E2E) / openclaw test (push) Has been cancelled
87 lines
2.7 KiB
Python
87 lines
2.7 KiB
Python
"""Upstream-evidence provider registry.
|
|
|
|
The investigation pipeline uses an :class:`UpstreamEvidenceProvider` (currently
|
|
Datadog-only) to enrich reports with correlated upstream signals. Historically
|
|
``tools/investigation/reporting/upstream_correlation/registry.py`` imported
|
|
``integrations.datadog.correlation.build_datadog_provider`` directly, which is
|
|
a ``tools -> integrations`` edge (T-4 layering audit, issue #3352, item 25).
|
|
|
|
This module inverts the dependency: each integration that wants to plug in an
|
|
upstream provider registers a builder here (a callable that consumes the
|
|
already-resolved integration config and the alert-derived knobs). The
|
|
investigation pipeline iterates over registered builders in insertion order
|
|
and returns the first non-``None`` provider.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from collections.abc import Callable, Iterable, Mapping
|
|
from typing import Any
|
|
|
|
from core.domain.types.upstream import UpstreamEvidenceProvider
|
|
|
|
|
|
class UpstreamProviderBuilder:
|
|
"""A vendor-registered factory + the resolved-integrations key it consumes."""
|
|
|
|
__slots__ = ("integration_key", "name", "builder")
|
|
|
|
def __init__(
|
|
self,
|
|
*,
|
|
name: str,
|
|
integration_key: str,
|
|
builder: Callable[..., UpstreamEvidenceProvider | None],
|
|
) -> None:
|
|
self.name = name
|
|
self.integration_key = integration_key
|
|
self.builder = builder
|
|
|
|
def build(
|
|
self,
|
|
integration_config: Mapping[str, Any] | None,
|
|
*,
|
|
target_resource: str,
|
|
candidate_services: tuple[str, ...],
|
|
) -> UpstreamEvidenceProvider | None:
|
|
return self.builder(
|
|
integration_config=integration_config,
|
|
target_resource=target_resource,
|
|
candidate_services=candidate_services,
|
|
)
|
|
|
|
|
|
_builders: dict[str, UpstreamProviderBuilder] = {}
|
|
|
|
|
|
def register_upstream_provider_builder(
|
|
name: str,
|
|
*,
|
|
integration_key: str,
|
|
builder: Callable[..., UpstreamEvidenceProvider | None],
|
|
) -> None:
|
|
"""Register (or replace) an upstream provider builder under ``name``."""
|
|
_builders[name] = UpstreamProviderBuilder(
|
|
name=name,
|
|
integration_key=integration_key,
|
|
builder=builder,
|
|
)
|
|
|
|
|
|
def iter_upstream_provider_builders() -> Iterable[UpstreamProviderBuilder]:
|
|
"""Return every registered builder in insertion order."""
|
|
return tuple(_builders.values())
|
|
|
|
|
|
def clear_upstream_provider_builders() -> None:
|
|
"""Drop every registered builder (test isolation helper)."""
|
|
_builders.clear()
|
|
|
|
|
|
__all__ = [
|
|
"UpstreamProviderBuilder",
|
|
"clear_upstream_provider_builders",
|
|
"iter_upstream_provider_builders",
|
|
"register_upstream_provider_builder",
|
|
]
|