docs(integration): add OpenSearch integration guide#164
docs(integration): add OpenSearch integration guide#164maheshbabugorantla wants to merge 3 commits intotraceloop:mainfrom
Conversation
Add documentation for using OpenSearch as an LLM traces destination via Data Prepper pipeline ingestion. Covers setup, configuration, SDK initialization, workflow decorator usage, and captured metadata.
…uide Add a waterfall trace detail screenshot from OpenSearch Dashboards to illustrate the parent/child span relationship visible after instrumenting an LLM workflow with OpenLLMetry.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdded OpenSearch integration docs: a new navigation entry, an integration card in the Integrations Catalog, and a full guide describing routing OpenLLMetry traces via OpenTelemetry Collector → Data Prepper → OpenSearch and viewing them in OpenSearch Dashboards. Changes
Sequence Diagram(s)sequenceDiagram
participant App as Traceloop-enabled App
participant Collector as OpenTelemetry Collector
participant DataPrepper as Data Prepper
participant OpenSearch as OpenSearch
participant Dashboards as OpenSearch Dashboards
App->>Collector: Send OTLP traces (HTTP/gRPC)
Collector->>DataPrepper: Export traces to Data Prepper (OTLP exporter)
DataPrepper->>OpenSearch: Index traces into trace-analytics-* indices
Dashboards->>OpenSearch: Query trace indices for visualization
Dashboards-->>User: Display trace waterfalls and span metadata
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@openllmetry/integrations/opensearch.mdx`:
- Around line 152-168: Update the examples so Traceloop is initialized before
any LLM client is imported: move the Traceloop import and Traceloop.init(...)
call to precede importing OpenAI (or any LLM client) and adjust the prose to
state "Initialize Traceloop (call Traceloop.init) before importing the LLM
client (e.g., OpenAI)" so the example and text consistently show Traceloop.init
occurring prior to the OpenAI import to ensure auto-instrumentation works
correctly.
- Line 262: The <img src="/img/integrations/opensearch-trace-details.png" /> tag
is missing an alt attribute which harms accessibility; update the image element
(the <img ... /> line) to include a concise, descriptive alt text (for example:
alt="OpenSearch trace details screenshot") so screen readers can convey the
image content.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 93902af7-c58b-4e91-9901-f03997477a27
⛔ Files ignored due to path filters (1)
img/integrations/opensearch-trace-details.pngis excluded by!**/*.png
📒 Files selected for processing (3)
mint.jsonopenllmetry/integrations/introduction.mdxopenllmetry/integrations/opensearch.mdx
| Import and initialize Traceloop before any LLM imports: | ||
|
|
||
| ```python | ||
| from os import getenv | ||
|
|
||
| from traceloop.sdk import Traceloop | ||
| from openai import OpenAI | ||
|
|
||
| # Initialize Traceloop with OTLP endpoint | ||
| Traceloop.init( | ||
| app_name="your-service-name", | ||
| api_endpoint="http://localhost:4318" | ||
| ) | ||
|
|
||
| # Traceloop must be initialized before importing the LLM client | ||
| # Traceloop instruments the OpenAI client automatically | ||
| client = OpenAI(api_key=getenv("OPENAI_API_KEY")) |
There was a problem hiding this comment.
Fix contradictory initialization guidance vs example code order.
The page says to initialize Traceloop before LLM imports, but both examples import OpenAI before Traceloop.init(). This can mislead users and break auto-instrumentation expectations.
Suggested doc fix
- from traceloop.sdk import Traceloop
- from openai import OpenAI
+ from traceloop.sdk import Traceloop
@@
Traceloop.init(
app_name="your-service-name",
api_endpoint="http://localhost:4318"
)
+ from openai import OpenAI
@@
-from traceloop.sdk.decorators import workflow, task
-from openai import OpenAI
+from traceloop.sdk.decorators import workflow, task
@@
Traceloop.init(
app_name="recipe-service",
api_endpoint="http://localhost:4318",
)
+from openai import OpenAIAlso applies to: 227-229
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@openllmetry/integrations/opensearch.mdx` around lines 152 - 168, Update the
examples so Traceloop is initialized before any LLM client is imported: move the
Traceloop import and Traceloop.init(...) call to precede importing OpenAI (or
any LLM client) and adjust the prose to state "Initialize Traceloop (call
Traceloop.init) before importing the LLM client (e.g., OpenAI)" so the example
and text consistently show Traceloop.init occurring prior to the OpenAI import
to ensure auto-instrumentation works correctly.
Summary
Adds comprehensive documentation for integrating OpenLLMetry with OpenSearch, enabling users to visualize LLM traces in OpenSearch Dashboards' Trace Analytics using a Data Prepper pipeline for OTLP ingestion.
What's Changed
openllmetry/integrations/opensearch.mdxSupporting screenshots:
img/integrations/opensearch-trace-details.png— Waterfall trace detail view in OpenSearch Dashboards showing parent/child LLM spansKey Features Documented
@workflowand@taskdecorators for complex multi-step applicationsDocumentation Structure
Testing
mint.jsonandintegrations/introduction.mdxSummary by CodeRabbit