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

Rework initialization, improve logging, and other refactoring #315

Merged
merged 48 commits into from
Jul 31, 2024

Conversation

siyangqiu
Copy link
Contributor

@siyangqiu siyangqiu commented Jul 26, 2024

📥 Pull Request

📘 Description
This change addresses a number of common pain points with the AgentOps SDK:

  • The init() method is expected to be the first entry-point into AgentOps code.
    -- Unexpected behavior is extremely common when this is not the case - often happens because decorators in submodules are called when the submodules are imported.
    -- AgentOps integrations cannot override the default configuration as there is no Client() to set configuration options

  • Log messages are suppressed before init() is called. Some warnings messages are not revealed to users as a result

  • Errors messages can be confusing. The some errors are split up into multiple logs. Some errors are not descriptive enough because when the issue happens, some information is no longer available

** The Change**

  • HTTP Client now throws exceptions so that the calling method can log more descriptive messages
  • Improved error messages in general
  • The Client() now has "initialized" state variable - only set to true when everything is ready when all required info is provided
  • The Client() constructor now only sets default configuration and does not take arguments. Client().configure() is now used to configure the client. init() calls configure() and then initializes the client.

@siyangqiu siyangqiu requested review from bboynton97, areibman and HowieG and removed request for bboynton97 and areibman July 30, 2024 02:32
@siyangqiu siyangqiu changed the title DRAFT: Rework initialization, improve logging, and other refactoring Rework initialization, improve logging, and other refactoring Jul 30, 2024
agentops/client.py Show resolved Hide resolved
agentops/session.py Show resolved Hide resolved
agentops/__init__.py Show resolved Hide resolved
agentops/__init__.py Show resolved Hide resolved
agentops/config.py Show resolved Hide resolved
Copy link

codecov bot commented Jul 30, 2024

Codecov Report

Attention: Patch coverage is 54.39430% with 192 lines in your changes missing coverage. Please review.

Files Patch % Lines
agentops/decorators.py 47.72% 39 Missing and 7 partials ⚠️
agentops/__init__.py 33.33% 31 Missing and 13 partials ⚠️
agentops/client.py 65.48% 28 Missing and 11 partials ⚠️
agentops/session.py 50.76% 20 Missing and 12 partials ⚠️
agentops/config.py 58.33% 15 Missing and 5 partials ⚠️
agentops/http_client.py 40.00% 5 Missing and 1 partial ⚠️
agentops/meta_client.py 0.00% 4 Missing ⚠️
agentops/log_config.py 95.65% 0 Missing and 1 partial ⚠️
Flag Coverage Δ
unittests 44.91% <54.39%> (+1.80%) ⬆️

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

Files Coverage Δ
agentops/exceptions.py 80.00% <100.00%> (-1.82%) ⬇️
agentops/helpers.py 72.04% <100.00%> (-1.43%) ⬇️
agentops/log_config.py 96.96% <95.65%> (-3.04%) ⬇️
agentops/meta_client.py 47.36% <0.00%> (-41.21%) ⬇️
agentops/http_client.py 60.71% <40.00%> (-1.79%) ⬇️
agentops/config.py 58.33% <58.33%> (-24.36%) ⬇️
agentops/session.py 60.42% <50.76%> (-11.52%) ⬇️
agentops/client.py 64.58% <65.48%> (+0.41%) ⬆️
agentops/__init__.py 44.82% <33.33%> (-37.44%) ⬇️
agentops/decorators.py 54.00% <47.72%> (-46.00%) ⬇️

examples/agent.py Outdated Show resolved Hide resolved
examples/temp.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
Copy link
Contributor

@bboynton97 bboynton97 left a comment

Choose a reason for hiding this comment

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

nits but nothing blocking

@siyangqiu siyangqiu merged commit e3ae159 into main Jul 31, 2024
11 checks passed
@siyangqiu siyangqiu deleted the stabilization branch July 31, 2024 00:56
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