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

[Feature] Extract provider to logs #6565

Merged
merged 31 commits into from
Jul 9, 2024
Merged
Changes from 26 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e84379c
remove ultima + althub
jmaslek Feb 27, 2024
8b68f23
move twitter keys
jmaslek Feb 27, 2024
6a8a1ea
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Feb 29, 2024
21cc561
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Mar 11, 2024
9f9cba3
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Mar 12, 2024
2914c7e
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Mar 13, 2024
61400fc
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Mar 14, 2024
19c6371
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Mar 14, 2024
8651771
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Mar 14, 2024
5d6344c
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Mar 14, 2024
853e3fe
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Mar 15, 2024
25536e3
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek May 2, 2024
fea3821
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek May 9, 2024
9d4e054
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek May 14, 2024
926d344
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek May 18, 2024
92f3da4
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek May 31, 2024
ffdf8a6
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Jun 3, 2024
21ba826
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Jun 3, 2024
a8b8a14
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Jun 11, 2024
13b870e
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Jun 12, 2024
61576f4
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Jun 13, 2024
67cefd3
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Jun 14, 2024
2b1a833
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Jun 18, 2024
b3aed17
Merge branch 'develop' of https://github.com/OpenBB-finance/OpenBBTer…
jmaslek Jul 8, 2024
62334ea
Extract provider from kwargs and add to logs
jmaslek Jul 8, 2024
16527d5
pydocstyle
jmaslek Jul 8, 2024
f5cb30c
update test
jmaslek Jul 8, 2024
1575e12
Merge branch 'develop' into feature/add-provoder-to-logs
deeleeramone Jul 8, 2024
ef7467b
fix tests
deeleeramone Jul 8, 2024
8b91803
Merge branch 'develop' into feature/add-provoder-to-logs
IgorWounds Jul 9, 2024
6a164fc
Merge branch 'develop' into feature/add-provoder-to-logs
jmaslek Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion openbb_platform/core/openbb_core/app/logs/logging_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,16 @@
from openbb_core.app.model.abstract.singleton import SingletonMeta
from openbb_core.app.model.system_settings import SystemSettings
from openbb_core.app.model.user_settings import UserSettings
from pydantic import BaseModel
from pydantic_core import to_jsonable_python


class DummyProvider(BaseModel):
"""Dummy Provider for error handling with logs"""

provider: str = "not_passed_to_kwargs"


class LoggingService(metaclass=SingletonMeta):
"""Logging Manager class responsible for managing logging settings and handling logs.

Expand Down Expand Up @@ -221,9 +228,16 @@ def log(
# Remove CommandContext if any
kwargs.pop("cc", None)

# Get provider for posthog logs
passed_model = kwargs.get("provider_choices", DummyProvider())
provider = (
passed_model.provider
if hasattr(passed_model, "provider")
else "not_passed_to_kwargs"
)

# Truncate kwargs if too long
kwargs = {k: str(v)[:100] for k, v in kwargs.items()}

# Get execution info
error = None if all(i is None for i in exec_info) else str(exec_info[1])

Expand All @@ -234,6 +248,7 @@ def log(
"route": route,
"input": kwargs,
"error": error,
"provider": provider,
"custom_headers": custom_headers,
},
default=to_jsonable_python,
Expand Down
Loading