-
Notifications
You must be signed in to change notification settings - Fork 6
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: audit tracing improvement #378
base: main
Are you sure you want to change the base?
Conversation
Trivy scanning results. |
@@ -88,7 +88,10 @@ def trace(self, name: str, **inputs: Any) -> Iterator[SimpleNamespace]: # noqa: | |||
self.stop(outputs=vars(outputs), current_span=span) | |||
|
|||
|
|||
def format_attributes(data: dict, prefix: str | None = None) -> dict: | |||
# TODO: check do we need this method. |
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.
What does this mean? Check how?
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've checked it. I needed to run the otel tracer and see how the new formater looks like.
I removed this method.
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.
After discussion I restored the format_attributes the way it was for otel trace handler .
|
||
def shorten_list(lst: list | tuple) -> list: | ||
""" | ||
Shortens a list if it's longer than 3 elements. Shortens list elements if it's long string. |
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.
Shortens a list if it's longer than 3 elements. Shortens list elements if it's long string. | |
Shortens a list if it's longer than opt_list_lenght elements. Shortens list elements if it's long string. |
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.
changed
@@ -119,3 +122,112 @@ def format_attributes(data: dict, prefix: str | None = None) -> dict: | |||
flattened[current_key] = repr(value) | |||
|
|||
return flattened | |||
|
|||
|
|||
def format_attributes(data: dict, prefix: str | None = None) -> dict: |
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.
This function with nested sub-functions that use local variables from the parent function pretty much looks like simulating a class with methods and instance properties. Maybe simply use a class if a class-like functionality is needed?
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've changed the function to the class
Code Coverage Summary
Diff against main
Results for commit: 99800af Minimum allowed coverage is ♻️ This comment has been updated with latest results |
closes #344