-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add option sidecar for test on bootstrap
- Loading branch information
Showing
10 changed files
with
204 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[settings] | ||
known_third_party = fastapi,nltk,pydantic,river,statefun,yaml | ||
known_third_party = fastapi,nltk,pydantic,requests,river,statefun,yaml |
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,14 +1,28 @@ | ||
from logging import getLogger | ||
from time import time_ns | ||
|
||
import requests | ||
from fastapi import Request | ||
|
||
from springhead.schemas import SpringheadTimeCreateRequest | ||
|
||
logger = getLogger(__name__) | ||
|
||
|
||
async def get_handler(request: Request): | ||
start_time = time_ns() | ||
handler = request.app.state.bootstrap.handler | ||
end_time = time_ns() | ||
logger.info(f"elapsed get_handler: {end_time-start_time}") | ||
bootstrap_object = request.app.state.bootstrap | ||
if bootstrap_object.benchmark_mode: | ||
elapsed_time = end_time - start_time | ||
requests.post( | ||
bootstrap_object.side_car_address, | ||
json=SpringheadTimeCreateRequest( | ||
time_ns=elapsed_time, | ||
type_test_case=bootstrap_object.type_test_case, | ||
type_timer="get_handler", | ||
).dict(), | ||
) | ||
logger.info(f"elapsed springhead get_handler: {elapsed_time}") | ||
return handler |
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
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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from pydantic import BaseModel | ||
|
||
|
||
class SpringheadTimeCreateRequest(BaseModel): | ||
time_ns: int | ||
type_timer: str | ||
type_test_case: str |