Skip to content

Add Atlas Cloud provider support#4077

Open
lucaszhu-hue wants to merge 3 commits into
traceloop:mainfrom
lucaszhu-hue:feat/atlascloud-provider
Open

Add Atlas Cloud provider support#4077
lucaszhu-hue wants to merge 3 commits into
traceloop:mainfrom
lucaszhu-hue:feat/atlascloud-provider

Conversation

@lucaszhu-hue

@lucaszhu-hue lucaszhu-hue commented May 6, 2026

Copy link
Copy Markdown
  • detect Atlas Cloud from OpenAI-compatible base URLs
  • add sample-app provider config and demo
  • add a provider detection test

Summary by CodeRabbit

  • New Features

    • Detect Atlas Cloud as a provider in OpenAI instrumentation and surface Atlas Cloud support in the sample app.
  • Documentation

    • Expanded sample app README and updated example environment file with Atlas Cloud configuration and usage instructions.
  • New Samples

    • Added a sample demonstrating Atlas Cloud usage and a provider helper to create OpenAI-compatible clients.
  • Tests

    • Added tests verifying provider detection for Atlas Cloud and OpenAI-compatible URLs.

Review Change Stack


🤝 Partnership & contact

This PR comes from the Atlas Cloud team. Beyond the integration above, we'd love to explore a closer collaboration with openllmetry — for example co-marketing or a featured integration.

If that sounds interesting, reach out anytime:

And of course, happy to revise this PR to match your project's conventions — just leave a comment. 🙌

@CLAassistant

CLAassistant commented May 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented May 6, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Hidden review stack artifact

Walkthrough

Adds Atlas Cloud vendor detection to OpenAI instrumentation, a provider factory and client helpers, a new Atlas Cloud sample app, updated .env example and READMEs, and tests verifying vendor detection and fallback.

Changes

Atlas Cloud integration + sample app

Layer / File(s) Summary
Vendor Detection
packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py, packages/opentelemetry-instrumentation-openai/tests/test_provider_detection.py
_get_vendor_from_url() gains a branch that detects atlascloud.ai and returns "atlascloud"; tests assert detection and fallback to "openai".
Provider types & constants
packages/sample-app/sample_app/provider_factory.py
Adds provider factory module skeleton, constants, and OpenAICompatibleProviderConfig dataclass.
Provider resolution & client construction
packages/sample-app/sample_app/provider_factory.py
Adds _get_env_value(), get_provider_config() (resolves atlascloud and openai configs, validates keys), and create_openai_compatible_client() returning (config, client).
Sample app wiring
packages/sample-app/sample_app/atlascloud_openai.py, packages/sample-app/.env.example
New sample script demonstrates initializing tracing, creating an Atlas Cloud client, and issuing a chat completion; .env.example adds ATLASCLOUD_* vars and reorders traceloop env lines.
Docs / Usage
packages/sample-app/README.md, README.md
Expanded sample-app README with environment setup, run instructions, and provider_factory guidance; top-level README gains an Atlas Cloud section.

Sequence Diagram

sequenceDiagram
    participant SampleApp
    participant ProviderFactory
    participant Traceloop
    participant OpenAI_SDK
    participant AtlasCloud

    SampleApp->>Traceloop: init tracing
    SampleApp->>ProviderFactory: create_openai_compatible_client("atlascloud")
    ProviderFactory-->>SampleApp: (config, client)
    SampleApp->>OpenAI_SDK: client.chat.completions.create(...)
    OpenAI_SDK->>AtlasCloud: HTTP request to ATLASCLOUD_BASE_URL
    AtlasCloud-->>OpenAI_SDK: response
    OpenAI_SDK-->>SampleApp: completion response
    Traceloop-->>AtlasCloud: spans/metrics reported
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I nibble bytes beneath the cloud,
I map the URL and sing aloud,
A factory pops keys and base,
Traces hop from place to place,
Small paws, big hops—now logs are proud.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 57.14% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add Atlas Cloud provider support' directly and concisely summarizes the main objective of the changeset, which is to add support for Atlas Cloud as a provider.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/sample-app/sample_app/provider_factory.py`:
- Around line 14-21: The OpenAICompatibleProviderConfig dataclass exposes the
api_key in its autogenerated __repr__, so change the api_key field declaration
to hide it from repr by using dataclasses.field(repr=False) (i.e., set
repr=False for the api_key field in the OpenAICompatibleProviderConfig
dataclass) to prevent accidental secret leakage when printing or logging the
config.
🪄 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: c15321dd-1f05-4896-90ce-00285aeb4843

📥 Commits

Reviewing files that changed from the base of the PR and between abbcc11 and 6915578.

📒 Files selected for processing (6)
  • packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py
  • packages/opentelemetry-instrumentation-openai/tests/test_provider_detection.py
  • packages/sample-app/.env.example
  • packages/sample-app/README.md
  • packages/sample-app/sample_app/atlascloud_openai.py
  • packages/sample-app/sample_app/provider_factory.py

Comment thread packages/sample-app/sample_app/provider_factory.py
@lucaszhu-hue lucaszhu-hue force-pushed the feat/atlascloud-provider branch from bd59d6c to 1449a9e Compare May 6, 2026 09:08

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py (1)

337-350: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize base_url casing before vendor checks.

At Line 349, provider detection is case-sensitive. Mixed/upper-case hostnames can be misclassified as "openai".

Proposed fix
 def _get_vendor_from_url(base_url):
     if not base_url:
         return "openai"
+    base_url = base_url.lower()

     if "openai.azure.com" in base_url:
         return "azure.ai.openai"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py`
around lines 337 - 350, The vendor detection in _get_vendor_from_url is
case-sensitive and will misclassify URLs with mixed/upper-case hostnames;
normalize base_url to a consistent case (e.g., lower()) at the start of
_get_vendor_from_url (after the falsy check) and run the subsequent substring
checks against that normalized string (still return the same vendor strings),
ensuring all references in the function use the normalized base_url variable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/sample-app/sample_app/provider_factory.py`:
- Around line 29-50: Provider construction currently accepts empty or
whitespace-only env vars; update the provider branches for "atlascloud" and
"openai" in provider_factory.py so that API keys are stripped and treated as
missing if empty/whitespace (raise ValueError using
OpenAICompatibleProviderConfig flow), and base_url/default_model env lookups are
normalized (strip and treat "" or whitespace as unset) so they fall back to
ATLASCLOUD_BASE_URL/ATLASCLOUD_DEFAULT_MODEL or
OPENAI_BASE_URL/OPENAI_DEFAULT_MODEL/None as appropriate; modify the logic
around the OpenAICompatibleProviderConfig calls (the blocks that set api_key,
base_url, default_model) to perform .strip() and truthiness checks before using
or falling back to defaults.

---

Outside diff comments:
In
`@packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py`:
- Around line 337-350: The vendor detection in _get_vendor_from_url is
case-sensitive and will misclassify URLs with mixed/upper-case hostnames;
normalize base_url to a consistent case (e.g., lower()) at the start of
_get_vendor_from_url (after the falsy check) and run the subsequent substring
checks against that normalized string (still return the same vendor strings),
ensuring all references in the function use the normalized base_url variable.
🪄 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: 922e17e3-865c-4488-8fa8-0924a4e723a2

📥 Commits

Reviewing files that changed from the base of the PR and between 6915578 and 1449a9e.

📒 Files selected for processing (6)
  • packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py
  • packages/opentelemetry-instrumentation-openai/tests/test_provider_detection.py
  • packages/sample-app/.env.example
  • packages/sample-app/README.md
  • packages/sample-app/sample_app/atlascloud_openai.py
  • packages/sample-app/sample_app/provider_factory.py

Comment thread packages/sample-app/sample_app/provider_factory.py Outdated
@lucaszhu-hue lucaszhu-hue force-pushed the feat/atlascloud-provider branch from 1449a9e to 2255a20 Compare May 6, 2026 10:13

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/sample-app/sample_app/atlascloud_openai.py (1)

41-42: ⚡ Quick win

Guard response rendering against empty choices.

Direct indexing can crash the sample on atypical responses; a small guard keeps the demo stable.

Proposed fix
 print("\n=== Response ===")
-print(response.choices[0].message.content)
+if not getattr(response, "choices", None):
+    print("No choices returned.")
+    return
+print(response.choices[0].message.content or "")
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/sample-app/sample_app/atlascloud_openai.py` around lines 41 - 42,
The sample prints response.choices[0].message.content without checking for
missing data; update the rendering to guard against empty/invalid choices by
verifying response and response.choices exist and len(response.choices) > 0 and
that response.choices[0].message and response.choices[0].message.content are
present before accessing them (e.g., print the content only if those checks
pass), otherwise print a safe fallback like "No content returned" or log the
full response for debugging; touch the code around the response variable and the
choices/message/content access to implement these checks.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/sample-app/.env.example`:
- Around line 9-11: Reorder the dotenv keys so they satisfy the linter by
placing TRACELOOP_API_ENDPOINT before TRACELOOP_API_KEY; update the .env example
to declare TRACELOOP_API_ENDPOINT first and then TRACELOOP_API_KEY so the
UnorderedKey warning is resolved (look for the TRACELOOP_API_ENDPOINT and
TRACELOOP_API_KEY entries in the current .env example).

---

Nitpick comments:
In `@packages/sample-app/sample_app/atlascloud_openai.py`:
- Around line 41-42: The sample prints response.choices[0].message.content
without checking for missing data; update the rendering to guard against
empty/invalid choices by verifying response and response.choices exist and
len(response.choices) > 0 and that response.choices[0].message and
response.choices[0].message.content are present before accessing them (e.g.,
print the content only if those checks pass), otherwise print a safe fallback
like "No content returned" or log the full response for debugging; touch the
code around the response variable and the choices/message/content access to
implement these checks.
🪄 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: 554d6741-fb15-43b5-9efa-29598f88e023

📥 Commits

Reviewing files that changed from the base of the PR and between 1449a9e and 2255a20.

📒 Files selected for processing (6)
  • packages/opentelemetry-instrumentation-openai/opentelemetry/instrumentation/openai/shared/__init__.py
  • packages/opentelemetry-instrumentation-openai/tests/test_provider_detection.py
  • packages/sample-app/.env.example
  • packages/sample-app/README.md
  • packages/sample-app/sample_app/atlascloud_openai.py
  • packages/sample-app/sample_app/provider_factory.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/sample-app/README.md
  • packages/sample-app/sample_app/provider_factory.py

Comment thread packages/sample-app/.env.example
@lucaszhu-hue lucaszhu-hue force-pushed the feat/atlascloud-provider branch from 2255a20 to e9e1319 Compare May 14, 2026 03:20
@lucaszhu-hue

Copy link
Copy Markdown
Author

Synced with upstream main — the branch is no longer behind. CLA is signed. Please re-trigger CI when convenient, thanks!

@lucaszhu-hue lucaszhu-hue force-pushed the feat/atlascloud-provider branch from 79098ba to b1ed430 Compare June 18, 2026 01:37
@lucaszhu-hue

Copy link
Copy Markdown
Author

Rebased onto the latest main to resolve the BEHIND state. No functional changes — same Atlas Cloud model pool additions as before.

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