-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(relay): Introduce options to global config (#61024)
Setup infrastructure to add options to the global config, also update the global config endpoint to signal relay the global config is fully ready.
- Loading branch information
Showing
3 changed files
with
26 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,32 @@ | ||
from sentry.relay.config.measurements import get_measurements_config | ||
from typing import Any, Dict, List, TypedDict | ||
|
||
import sentry.options | ||
from sentry.relay.config.measurements import MeasurementsConfig, get_measurements_config | ||
from sentry.utils import metrics | ||
|
||
# List of options to include in the global config. | ||
RELAY_OPTIONS: List[str] = [] | ||
|
||
|
||
class GlobalConfig(TypedDict, total=False): | ||
measurements: MeasurementsConfig | ||
options: Dict[str, Any] | ||
|
||
|
||
@metrics.wraps("relay.globalconfig.get") | ||
def get_global_config(): | ||
"""Return the global configuration for Relay.""" | ||
return { | ||
|
||
global_config: GlobalConfig = { | ||
"measurements": get_measurements_config(), | ||
} | ||
|
||
options = dict() | ||
for option in RELAY_OPTIONS: | ||
if (value := sentry.options.get(option)) is not None: | ||
options[option] = value | ||
|
||
if options: | ||
global_config["options"] = options | ||
|
||
return global_config |
This file contains 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