Skip to content

Commit 556d997

Browse files
committed
add routestats env variables
1 parent b2f18c0 commit 556d997

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

file_catalog/config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ class Config(Dict[str, Optional[Union[bool, int, str]]]):
5454
'MONGODB_HOST': ConfigParamSpec('localhost', str, 'MongoDB host'),
5555
'MONGODB_PORT': ConfigParamSpec(27017, int, 'MongoDB port'),
5656
'MONGODB_URI': ConfigParamSpec(None, str, 'MongoDB URI'),
57+
'ROUTESTATS_OVERLOAD_LIMIT': ConfigParamSpec(
58+
240,
59+
int,
60+
'Average query time in seconds to declare overload'
61+
),
62+
'ROUTESTATS_WINDOW_SIZE': ConfigParamSpec(
63+
600,
64+
int,
65+
'Query window size in seconds to declare overload'
66+
),
5767
}
5868

5969
def __init__(self) -> None:

file_catalog/server.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ def create(config: Dict[str, Any],
125125
"config": config,
126126
"db": mongo,
127127
"debug": debug,
128+
"routestats": {
129+
"window_time": config["ROUTESTATS_WINDOW_SIZE"],
130+
"timeout": config["ROUTESTATS_OVERLOAD_LIMIT"],
131+
},
128132
}
129133
if 'CI_TEST_ENV' in os.environ:
130134
del handler_setup["auth"]

0 commit comments

Comments
 (0)