Configuration and errors¶
Where the SDK sends data, with which credentials, and for which project.
Configuration is scoped to an Opengrade instance (Settings, or OPENGRADE_* env vars at construction). Activate an instance for ambient helpers via current().
Settings
dataclass
¶
Settings(tracking_uri: str | None = None, api_key: str | None = None, project: str | None = None, project_id: str | None = None, project_slug: str | None = None, service_name: str | None = None, version: str | None = None, environment: str | None = None, live: bool | None = None, live_sample_rate: float | None = None, metrics_workers: int | None = None, max_capture_bytes: int | None = None, warned_plaintext_key: bool = False)
Opengrade ¶
Opengrade(settings: Settings | None = None, **kwargs: Any)
Configurable opengrade runtime (settings, client, tracing, evaluate).
Opengrade(project="my-app") is enough: the rest comes from OPENGRADE_*.
project is a name, created on the platform if missing. project_id /
project_slug point at an existing project instead. Any other Settings
field can be passed as a keyword.
configure_capture ¶
configure_capture(*, max_capture_bytes: int | None | Any = _UNSET, redact: RedactFn | None | Any = _UNSET, redact_output: RedactOutputFn | None | Any = _UNSET) -> None
OpengradeError ¶
Bases: Exception
Base error for opengrade SDK failures.
OpengradeAPIError ¶
Bases: OpengradeError
Raised when the platform API returns a non-2xx response.