-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Update API for OpenAPI compliance #2866
feat: Update API for OpenAPI compliance #2866
Conversation
anticorrelator
commented
Apr 11, 2024
•
edited
Loading
edited
- Preserves existing API behavior, but adds an OpenAPI spec which better follows REST conventions
Put deprecated flags on the get calls |
Flesh out V2 API Lint and clean up type annotations
Remove busywait Swap out v2 routes for v1 routes! Update Client API usage Fill out get_spans body schema Change reading spans from GET to POST Update tests for new `/spans` route method Update more tests for new `/spans` route method
aa6fe6f
to
8567699
Compare
# read from headers for backwards compatibility | ||
or request.headers.get("project-name") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to write a small thest for this?
Route("/v1/evaluations", evaluations.post_evaluation, methods=["POST"]), | ||
Route("/v1/evaluations", evaluations.get_evaluations, methods=["GET"]), | ||
Route("/v1/traces", traces.post_traces, methods=["POST"]), | ||
Route("/v1/spans", spans.query_spans_handler, methods=["POST"]), | ||
Route("/v1/spans", spans.get_spans_handler, methods=["GET"]), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there no nested routing? NBD, just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure everything we can accomplish here, this was the pattern I saw recommended to use Starlette's OpenAPI APISpec mechanism, since we want a separate function for each route
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might have inconsistent project-name
vs project_name
?
|
||
async def get_evaluations(request: Request) -> Response: | ||
""" | ||
summary: Get evaluations from Phoenix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
summary: Get evaluations from Phoenix | |
summary: Get evaluations for a given project |
@@ -183,13 +183,13 @@ def log_evaluations(self, *evals: Evaluations, project_name: Optional[str] = Non | |||
table = evaluation.to_pyarrow_table() | |||
sink = pa.BufferOutputStream() | |||
headers = {"content-type": "application/x-pandas-arrow"} | |||
if project_name: | |||
headers["project-name"] = project_name | |||
params = {"project-name": project_name} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test this? because I think it's _ in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, replacing with project-name
everywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving to unblock