Skip to content
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

[OPIK-390]: [SDK] add a project name to creation of traces; #607

Merged
merged 4 commits into from
Nov 14, 2024

Conversation

aadereiko
Copy link
Contributor

Details

  • Now the creation of traces shows a link to a specific project
image image

Issues

Resolves #

Testing

Documentation

@aadereiko aadereiko requested a review from a team as a code owner November 12, 2024 10:18
@aadereiko aadereiko changed the title [OPIK-390]: add a project name to for creation of traces; [OPIK-390]: [SDK] add a project name to for creation of traces; Nov 12, 2024
@aadereiko aadereiko changed the title [OPIK-390]: [SDK] add a project name to for creation of traces; [OPIK-390]: [SDK] add a project name to creation of traces; Nov 12, 2024
@@ -6,6 +6,7 @@
URL_ACCOUNT_DETAILS_POSTFIX: Final[str] = "api/rest/v2/account-details"
URL_WORKSPACE_GET_LIST_POSTFIX: Final[str] = "api/rest/v2/workspaces"
HEALTH_CHECK_URL_POSTFIX: Final[str] = "/is-alive/ping"
SAFE_PARSE_URL: Final[str] = ":/&?="
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's rename it to ALLOWED_URL_CHARACTERS to be more descriptive

ui_url = get_ui_url()

return urllib.parse.quote(
f"{ui_url}/{workspace}/redirect/projects?name={project_name}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's split it in 2 steps:

project_path = urllib.parse.quote(f"{workspace}/redirect/projects?name={project_name}", safe=...)
return urllib.parse.join(ui_url, project_path)

It's safer to use join instead of strings formatting for concatenating url parts, because there are cases when someone adds/doesn't add / in the end or in the beginning of the url part. And it might lead to stuff like https://www.opik.com//my_workspace, join function is quite smart about such stuff.

@aadereiko aadereiko merged commit 6e1bdc1 into main Nov 14, 2024
21 checks passed
@aadereiko aadereiko deleted the sashaa/OPIK-390/redirect-to-project-name branch November 14, 2024 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants