Skip to content

Conversation

@obinnascale3
Copy link
Contributor

Description

Please include a summary of the changes and the related issue to help is review the PR better and faster.

Checklist for adding new integration:

  • Defined APIS in constants folder.
  • Updated SERVICE_PROVIDERS in common.py
  • Created a folder under instrumentation with the name of the integration with atleast patch.py and instrumentation.py files.
  • Added instrumentation in all_instrumentations in langtrace.py and to the InstrumentationType in types.py files.
  • Added examples for the new integration in the examples folder.
  • Updated pyproject.toml to install new dependencies
  • Updated the README.md of langtrace-python-sdk to include the new integration in the supported integrations table.
  • Updated the README.md of Langtrace's repository to include the new integration in the supported integrations table.
  • Added new integration page to supported integrations in Langtrace Docs

@obinnascale3 obinnascale3 added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 19, 2024
disable_logging = False
):
if disable_logging:
sys.stdout = open(os.devnull, "w")
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you explain what does this do?

print(Fore.BLUE + "Exporting spans to Langtrace cloud.." + Fore.RESET)
provider.add_span_processor(batch_processor_remote)

sys.stdout = sys.__stdout__
Copy link
Collaborator

Choose a reason for hiding this comment

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

can you explain what does this do?

The result of the export SUCCESS or FAILURE
"""
if not self.api_key:
if not self.api_key and not self.disable_logging:
Copy link
Collaborator

Choose a reason for hiding this comment

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

i am thinking a bit about this,

this approach will work fine for now, but it's adding some tech debt to the langtrace and langtrace exporter
i would say a more scalable approach is the following

  1. make the disable logging as an enviroment variable not an option to be passed
  2. abstract all Prints with Fore into a seperate function inside utils, that recieves 2 arguments which are the message and the color
  3. inside the abstracted method just check for the env variable if it's set then return and do not print other wise print normally
Suggested change
if not self.api_key and not self.disable_logging:
def log(message, color):
disable_logging = os.environ['DISABLE_LOGGING']
if disable_logging:
return
print(color, message, FORE.reset)

what do you think?

Base automatically changed from development to main August 20, 2024 11:18
@obinnascale3 obinnascale3 merged commit 29cbec5 into main Aug 20, 2024
@obinnascale3 obinnascale3 deleted the obinna/S3EN-2674-disable-logging branch August 20, 2024 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants