Skip to main content

Crate sentry_options_validation

Crate sentry_options_validation 

Source
Expand description

Schema validation library for sentry-options.

Schemas are loaded once into a SchemaRegistry and shared via Arc. Values are validated against schemas as complete objects.

Values refresh lazily on read on the same thread. A read past the staleness window re-reads the values directory on the calling thread and publishes the new snapshot via ArcSwap (last-writer-wins). The full scheme is in docs/architecture.md; the memory-ordering invariants are documented inline in the refresh method below.

Structs§

NamespaceSchema
Schema for a namespace, containing validator and option metadata
OptionMetadata
Metadata for a single option in a namespace schema
SchemaRegistry
Registry for loading and storing schemas
ValuesStore
Validates and serves option values, reloading them lazily on read and serving the current snapshot lock-free via ArcSwap. See refresh for the staleness window and memory-ordering details.
ValuesStoreBuilder
Builder for constructing a ValuesStore.

Enums§

ValidationError
Errors that can occur during schema and value validation

Constants§

DEFAULT_REFRESH_THRESHOLD
Default minimum age of a cached values snapshot before a read triggers a refresh. A per-thread jitter of up to 1 s is added on top to spread the reload across threads.
DNS1123_LABEL_MAX_LEN
Maximum length of a K8s DNS-1123 label (RFC 1123).
LOCAL_OPTIONS_DIR
Local fallback path for development
OPTIONS_DIR_ENV
Environment variable to override options directory
OPTIONS_SUPPRESS_MISSING_DIR_ENV
Environment variable to suppress missing directory errors
PRODUCTION_OPTIONS_DIR
Production path where options are deployed via config map

Functions§

feature_property
The value a namespace schema pairs with each feature.<name> key, i.e. {"$ref": "#/definitions/Feature"}. Splice this in when assembling a schema in memory rather than hand-rolling the ref the meta-schema requires.
resolve_options_dir
Resolve options directory using fallback chain:
validate_k8s_name_component
Validate a name component is a valid K8s DNS-1123 label: lowercase alphanumeric and ‘-’, starts and ends alphanumeric, at most 63 chars.

Type Aliases§

PropagationCallback
Callback invoked when a namespace’s values are updated. Receives (namespace, delay_secs) — the propagation delay from ConfigMap generation to the app reading the new values.
ValidationResult
Result type for validation operations
ValuesByNamespace
A map of option values keyed by their namespace