the LangChain integration can be enabled programmatically by adding patch_all() or patch(langchain=True) before the first import of langchain in your application.Note that using ddtrace-run or patch_all() will also enable the requests and aiohttp integrations which trace HTTP requests to LLM providers, as well as the openai integration which traces requests to the OpenAI library.from ddtrace import config, patch# Note: be sure to configure the integration before calling ``patch()``!# e.g. config.langchain["logs_enabled"] = Truepatch(langchain=True)# to trace synchronous HTTP requests# patch(langchain=True, requests=True)# to trace asynchronous HTTP requests (to the OpenAI library)# patch(langchain=True, aiohttp=True)# to include underlying OpenAI spans from the OpenAI integration# patch(langchain=True, openai=True)patch_allSee the [APM Python library documentation][https://ddtrace.readthedocs.io/en/stable/installation_quickstart.html] for more advanced usage.Configuration‚ÄãSee the [APM Python library documentation][https://ddtrace.readthedocs.io/en/stable/integrations.html#langchain] for all the available configuration options.Log Prompt & Completion Sampling‚ÄãTo enable log prompt and completion sampling, set the DD_LANGCHAIN_LOGS_ENABLED=1 environment variable. By default, 10% of traced requests will emit logs containing the prompts and completions.To adjust the log sample rate, see the [APM library documentation][https://ddtrace.readthedocs.io/en/stable/integrations.html#langchain].Note: Logs submission requires DD_API_KEY to be specified when running ddtrace-run.Troubleshooting‚ÄãNeed help? Create an issue on ddtrace or contact [Datadog support][https://docs.datadoghq.com/help/].PreviousDatabricksNextDatadog LogsInstallation and SetupConfigurationLog Prompt & Completion SamplingTroubleshootingCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
ddtrace is a Datadog application performance monitoring (APM) library which provides an integration to monitor your LangChain application.
ddtrace is a Datadog application performance monitoring (APM) library which provides an integration to monitor your LangChain application. ->: the LangChain integration can be enabled programmatically by adding patch_all() or patch(langchain=True) before the first import of langchain in your application.Note that using ddtrace-run or patch_all() will also enable the requests and aiohttp integrations which trace HTTP requests to LLM providers, as well as the openai integration which traces requests to the OpenAI library.from ddtrace import config, patch# Note: be sure to configure the integration before calling ``patch()``!# e.g. config.langchain["logs_enabled"] = Truepatch(langchain=True)# to trace synchronous HTTP requests# patch(langchain=True, requests=True)# to trace asynchronous HTTP requests (to the OpenAI library)# patch(langchain=True, aiohttp=True)# to include underlying OpenAI spans from the OpenAI integration# patch(langchain=True, openai=True)patch_allSee the [APM Python library documentation][https://ddtrace.readthedocs.io/en/stable/installation_quickstart.html] for more advanced usage.Configuration‚ÄãSee the [APM Python library documentation][https://ddtrace.readthedocs.io/en/stable/integrations.html#langchain] for all the available configuration options.Log Prompt & Completion Sampling‚ÄãTo enable log prompt and completion sampling, set the DD_LANGCHAIN_LOGS_ENABLED=1 environment variable. By default, 10% of traced requests will emit logs containing the prompts and completions.To adjust the log sample rate, see the [APM library documentation][https://ddtrace.readthedocs.io/en/stable/integrations.html#langchain].Note: Logs submission requires DD_API_KEY to be specified when running ddtrace-run.Troubleshooting‚ÄãNeed help? Create an issue on ddtrace or contact [Datadog support][https://docs.datadoghq.com/help/].PreviousDatabricksNextDatadog LogsInstallation and SetupConfigurationLog Prompt & Completion SamplingTroubleshootingCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.