Skip to content

Error Logs for failed tranformer requests #360

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

Merged
merged 10 commits into from
Apr 30, 2024
Merged

Conversation

ketan96-m
Copy link
Collaborator

Created a "logs" CLI option under the "tranforms" option
The user is able to select the backend, tranform id and the option to redirect URL to open in the user's browser.

USAGE: servicex transforms logs -b testing4 -t 93713b34-2f0b-4d53-8412-8afa98626516 -o

The link to the kibana url is hardcoded and the transformer id are plugged to give the result.

TODO: Unit test cases - trying to explore how to Mock some request to make it to work with the CLI

@ketan96-m ketan96-m requested a review from BenGalewsky April 18, 2024 12:41
Copy link
Contributor

@BenGalewsky BenGalewsky left a comment

Choose a reason for hiding this comment

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

Getting close, but need to use the kabana URL returned by the service

if single_transform:
rich.print(table)
if open_link:
webbrowser.open(kibana_link.format(t.request_id))
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a nice find! I didn't know about the webbrowser package

Copy link
Collaborator Author

@ketan96-m ketan96-m Apr 19, 2024

Choose a reason for hiding this comment

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

I need help to test this function, I have prepared a test case but it opens the URL in web browser each time I run the test locally. I have not included the tests in this commit, don't know how it will behave with the CI/CD jobs.

url: Optional[str] = url_cli_option,
backend: Optional[str] = backend_cli_option,
transform_id: str = typer.Option(None, "-t", "--transform-id", help="Transform ID"),
open_link: Optional[bool] = typer.Option(False, "-o", "--open-link", help="Open Link in browser")
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we need this option. Let's see what people think about it always opening the link

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed the --open-link

backend: Optional[str] = backend_cli_option,
transform_id: str = typer.Option(None, "-t", "--transform-id", help="Transform ID"),
open_link: Optional[bool] = typer.Option(False, "-o", "--open-link", help="Open Link in browser")
):
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to have an option to select the log level you want to see. It should default to error, but developers might appreciate the full info logs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have added an Enum with two log level: INFO and ERROR.
And the user can use these options while requesting the log

@BenGalewsky
Copy link
Contributor

Need to fix the flake8 errors too

Copy link

codecov bot commented Apr 19, 2024

Codecov Report

Attention: Patch coverage is 88.57143% with 8 lines in your changes are missing coverage. Please review.

Project coverage is 81.16%. Comparing base (332fc3e) to head (c16aff9).

Files Patch % Lines
servicex/app/transforms.py 78.37% 8 Missing ⚠️
Additional details and impacted files
@@                  Coverage Diff                  @@
##           log_url_and_title     #360      +/-   ##
=====================================================
+ Coverage              79.91%   81.16%   +1.24%     
=====================================================
  Files                     41       42       +1     
  Lines                   2255     2325      +70     
=====================================================
+ Hits                    1802     1887      +85     
+ Misses                   453      438      -15     
Flag Coverage Δ
unittests 81.16% <88.57%> (+1.24%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -61,6 +61,14 @@ class Status(str, Enum):
running = "Running"


class LogLevel(str, Enum):
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no reason for this to be in this file. These values are not part of the pydantic model. This can just be local to the app.transforms file

@ketan96-m ketan96-m requested a review from BenGalewsky April 29, 2024 14:12
Copy link
Contributor

@BenGalewsky BenGalewsky left a comment

Choose a reason for hiding this comment

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

This looks great.. Thank you

@BenGalewsky BenGalewsky merged commit 0f50223 into log_url_and_title Apr 30, 2024
34 checks passed
@BenGalewsky BenGalewsky deleted the log_url branch April 30, 2024 15:26
@BenGalewsky BenGalewsky restored the log_url branch May 1, 2024 15:31
BenGalewsky pushed a commit that referenced this pull request May 1, 2024
* Added CLI option "logs" to redirect user to transform ids error logs

* removed the URL optional opening, added info and error level, removed the table

* Added loglevel in models for info and error

* Removed Log Level from models.py

* Logic to add the filters in the URL, _a parameters for request id, log level and g parameters for time frame

* edited the logs cli option to use the log url from transformation status message
BenGalewsky pushed a commit that referenced this pull request May 2, 2024
* Added CLI option "logs" to redirect user to transform ids error logs

* removed the URL optional opening, added info and error level, removed the table

* Added loglevel in models for info and error

* Removed Log Level from models.py

* Logic to add the filters in the URL, _a parameters for request id, log level and g parameters for time frame

* edited the logs cli option to use the log url from transformation status message
@BenGalewsky BenGalewsky deleted the log_url branch September 19, 2024 15:50
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