Skip to content

Commit

Permalink
add routestats env variables (#146)
Browse files Browse the repository at this point in the history
Add ROUTESTATS_TIMEOUT, ROUTESTATS_WINDOW_SIZE, ROUTESTATS_WINDOW_TIME env variables
  • Loading branch information
dsschult authored Dec 21, 2023
1 parent b2f18c0 commit 12017c0
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 102 deletions.
15 changes: 15 additions & 0 deletions file_catalog/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,21 @@ class Config(Dict[str, Optional[Union[bool, int, str]]]):
'MONGODB_HOST': ConfigParamSpec('localhost', str, 'MongoDB host'),
'MONGODB_PORT': ConfigParamSpec(27017, int, 'MongoDB port'),
'MONGODB_URI': ConfigParamSpec(None, str, 'MongoDB URI'),
'ROUTESTATS_WINDOW_SIZE': ConfigParamSpec(
1000,
int,
'Query window size to declare overload'
),
'ROUTESTATS_WINDOW_TIME': ConfigParamSpec(
600,
int,
'Query window time in seconds to declare overload'
),
'ROUTESTATS_TIMEOUT': ConfigParamSpec(
240,
int,
'Average query time in seconds to declare overload'
),
}

def __init__(self) -> None:
Expand Down
5 changes: 5 additions & 0 deletions file_catalog/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def create(config: Dict[str, Any],
"config": config,
"db": mongo,
"debug": debug,
"route_stats": {
"window_size": config["ROUTESTATS_WINDOW_SIZE"],
"window_time": config["ROUTESTATS_WINDOW_TIME"],
"timeout": config["ROUTESTATS_TIMEOUT"],
},
}
if 'CI_TEST_ENV' in os.environ:
del handler_setup["auth"]
Expand Down
124 changes: 63 additions & 61 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,140 +4,144 @@
#
# pip-compile --extra=dev --output-file=requirements-dev.txt
#
aiohttp==3.8.4
aiohttp==3.9.1
# via crawler
aiosignal==1.3.1
# via aiohttp
async-timeout==4.0.2
async-timeout==4.0.3
# via aiohttp
attrs==23.1.0
# via aiohttp
backoff==2.2.1
# via opentelemetry-exporter-otlp-proto-http
cachetools==5.3.1
# via
# opentelemetry-exporter-otlp-proto-common
# opentelemetry-exporter-otlp-proto-http
cachetools==5.3.2
# via wipac-rest-tools
certifi==2023.5.7
certifi==2023.11.17
# via requests
cffi==1.15.1
cffi==1.16.0
# via cryptography
charset-normalizer==3.1.0
# via
# aiohttp
# requests
charset-normalizer==3.3.2
# via requests
coloredlogs==15.0.1
# via
# wipac-file-catalog (setup.py)
# wipac-telemetry
coverage[toml]==7.2.7
# via pytest-cov
coverage[toml]==7.3.4
# via
# coverage
# pytest-cov
crawler==0.0.2
# via wipac-file-catalog (setup.py)
cryptography==40.0.2
cryptography==41.0.7
# via pyjwt
deprecated==1.2.14
# via
# opentelemetry-api
# opentelemetry-exporter-otlp-proto-http
exceptiongroup==1.1.1
exceptiongroup==1.2.0
# via pytest
flake8==6.0.0
flake8==6.1.0
# via wipac-file-catalog (setup.py)
frozenlist==1.3.3
frozenlist==1.4.1
# via
# aiohttp
# aiosignal
googleapis-common-protos==1.56.2
googleapis-common-protos==1.59.1
# via
# opentelemetry-exporter-jaeger-proto-grpc
# opentelemetry-exporter-otlp-proto-http
grpcio==1.54.2
grpcio==1.60.0
# via opentelemetry-exporter-jaeger-proto-grpc
humanfriendly==10.0
# via coloredlogs
idna==3.4
idna==3.6
# via
# requests
# yarl
importlib-metadata==6.0.1
importlib-metadata==6.11.0
# via opentelemetry-api
iniconfig==2.0.0
# via pytest
ldap3==2.9.1
# via wipac-file-catalog (setup.py)
mccabe==0.7.0
# via flake8
more-itertools==9.1.0
more-itertools==10.1.0
# via wipac-file-catalog (setup.py)
motor==2.5.1
# via wipac-file-catalog (setup.py)
multidict==6.0.4
# via
# aiohttp
# yarl
mypy==1.3.0
mypy==1.8.0
# via wipac-file-catalog (setup.py)
mypy-extensions==1.0.0
# via mypy
opentelemetry-api==1.18.0
opentelemetry-api==1.22.0
# via
# opentelemetry-exporter-jaeger-proto-grpc
# opentelemetry-exporter-jaeger-thrift
# opentelemetry-exporter-otlp-proto-http
# opentelemetry-sdk
# wipac-telemetry
opentelemetry-exporter-jaeger==1.18.0
opentelemetry-exporter-jaeger==1.21.0
# via wipac-telemetry
opentelemetry-exporter-jaeger-proto-grpc==1.18.0
opentelemetry-exporter-jaeger-proto-grpc==1.21.0
# via opentelemetry-exporter-jaeger
opentelemetry-exporter-jaeger-thrift==1.18.0
opentelemetry-exporter-jaeger-thrift==1.21.0
# via opentelemetry-exporter-jaeger
opentelemetry-exporter-otlp-proto-common==1.18.0
opentelemetry-exporter-otlp-proto-common==1.22.0
# via opentelemetry-exporter-otlp-proto-http
opentelemetry-exporter-otlp-proto-http==1.18.0
opentelemetry-exporter-otlp-proto-http==1.22.0
# via wipac-telemetry
opentelemetry-proto==1.18.0
opentelemetry-proto==1.22.0
# via
# opentelemetry-exporter-otlp-proto-common
# opentelemetry-exporter-otlp-proto-http
opentelemetry-sdk==1.18.0
opentelemetry-sdk==1.22.0
# via
# opentelemetry-exporter-jaeger-proto-grpc
# opentelemetry-exporter-jaeger-thrift
# opentelemetry-exporter-otlp-proto-http
# wipac-telemetry
opentelemetry-semantic-conventions==0.39b0
opentelemetry-semantic-conventions==0.43b0
# via opentelemetry-sdk
packaging==23.1
packaging==23.2
# via pytest
pluggy==1.0.0
pluggy==1.3.0
# via pytest
protobuf==3.20.3
protobuf==4.25.1
# via
# googleapis-common-protos
# opentelemetry-proto
# wipac-telemetry
pyasn1==0.5.0
pyasn1==0.5.1
# via ldap3
pycodestyle==2.10.0
pycodestyle==2.11.1
# via flake8
pycparser==2.21
# via cffi
pyflakes==3.0.1
pyflakes==3.1.0
# via flake8
pyjwt[crypto]==2.7.0
# via wipac-rest-tools
pyjwt[crypto]==2.8.0
# via
# pyjwt
# wipac-rest-tools
pymongo==3.13.0
# via
# motor
# wipac-file-catalog (setup.py)
pypng==0.20220715.0
# via qrcode
pytest==7.3.1
pytest==7.4.3
# via
# pytest-asyncio
# pytest-cov
# wipac-file-catalog (setup.py)
pytest-asyncio==0.21.0
pytest-asyncio==0.23.2
# via wipac-file-catalog (setup.py)
pytest-cov==4.1.0
# via wipac-file-catalog (setup.py)
Expand All @@ -151,13 +155,13 @@ requests==2.31.0
# wipac-dev-tools
# wipac-file-catalog (setup.py)
# wipac-rest-tools
requests-futures==1.0.0
requests-futures==1.0.1
# via
# wipac-file-catalog (setup.py)
# wipac-rest-tools
requests-toolbelt==1.0.0
# via wipac-file-catalog (setup.py)
ruff==0.0.270
ruff==0.1.8
# via wipac-file-catalog (setup.py)
six==1.16.0
# via thrift
Expand All @@ -168,41 +172,39 @@ tomli==2.0.1
# coverage
# mypy
# pytest
tornado==6.3.2
tornado==6.4
# via
# wipac-file-catalog (setup.py)
# wipac-rest-tools
types-pymysql==1.0.19.7
types-pymysql==1.1.0.1
# via wipac-file-catalog (setup.py)
types-python-dateutil==2.8.19.13
types-python-dateutil==2.8.19.14
# via wipac-file-catalog (setup.py)
types-requests==2.31.0.1
types-requests==2.31.0.10
# via wipac-file-catalog (setup.py)
types-urllib3==1.26.25.13
# via types-requests
typing-extensions==4.6.2
typing-extensions==4.9.0
# via
# mypy
# opentelemetry-sdk
# qrcode
# wipac-dev-tools
# wipac-telemetry
urllib3==2.0.2
# via requests
wipac-dev-tools==1.6.16
urllib3==2.1.0
# via
# requests
# types-requests
# wipac-rest-tools
wipac-dev-tools==1.8.2
# via
# wipac-rest-tools
# wipac-telemetry
wipac-rest-tools[telemetry]==1.4.20
wipac-rest-tools[telemetry]==1.6.0
# via wipac-file-catalog (setup.py)
wipac-telemetry==0.2.7
wipac-telemetry==0.3.0
# via wipac-rest-tools
wrapt==1.15.0
wrapt==1.16.0
# via deprecated
yarl==1.9.2
yarl==1.9.4
# via aiohttp
zipp==3.15.0
zipp==3.17.0
# via importlib-metadata

# The following packages are considered to be unsafe in a requirements file:
# setuptools
Loading

0 comments on commit 12017c0

Please sign in to comment.