Skip to content

fix(observability): improve OTLP ingestion resilience and fix TS/Node examples#3855

Merged
mmabrouk merged 9 commits intorelease/v0.87.2from
feat/fix-ts-otel-exaples
Feb 27, 2026
Merged

fix(observability): improve OTLP ingestion resilience and fix TS/Node examples#3855
mmabrouk merged 9 commits intorelease/v0.87.2from
feat/fix-ts-otel-exaples

Conversation

@mmabrouk
Copy link
Member

@mmabrouk mmabrouk commented Feb 27, 2026

Summary

This PR fixes the TypeScript/Node.js OpenTelemetry quickstart and makes OTLP ag.data.* parsing more resilient.

Problem

OTel JS/TS SDKs send structured attributes as strings because setAttribute() only accepts primitives (string | number | boolean | Array).

Agenta expected structured values under ag.data.*, so stringified JSON could fail validation and lead to dropped span data.

Changes

Backend (api/oss/src/apis/fastapi/tracing/utils.py)

  • Parse JSON-stringified values for all ag.data.* fields except ag.data.outputs
  • Keep outputs untouched because it can legitimately be plain text (LLM completion string)

Example fixes (examples/node/observability-opentelemetry/)

  • Changed gpt-5 -> gpt-4o-mini (non-existent model fix)
  • Removed unused BatchSpanProcessor import
  • Corrected version compatibility notes in README

Docs fixes (docs/docs/observability/03-quick-start-opentelemetry.mdx)

  • Added missing packages: @opentelemetry/sdk-trace-base, dotenv
  • Added missing import \"dotenv/config\";
  • Added explicit AGENTA_HOST/AGENTA_API_KEY extraction
  • Updated model examples from gpt-3.5-turbo to gpt-4o-mini
  • Added safer forceFlush() handling and improved error handling

Why parse everything except outputs?

  • outputs is the only field that commonly needs to remain a raw string
  • Other ag.data.* fields often arrive JSON-stringified from OTEL JS and benefit from best-effort parse

Verification

  • Verified end-to-end example execution and export
  • Confirmed compatibility by running the example with latest dependencies:
    • openai@6.25.0
    • @arizeai/openinference-instrumentation-openai@4.0.5
    • @arizeai/openinference-semantic-conventions@2.1.7

@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Feb 27, 2026 6:28pm

Request Review

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Backend bug Something isn't working documentation Improvements or additions to documentation labels Feb 27, 2026
…/Node examples

- Parse JSON strings for all ag.data.* fields EXCEPT outputs
- Fix Node.js OTel example: gpt-5 -> gpt-4o-mini, remove unused import
- Fix OTel quickstart docs: add missing packages, imports, error handling
@mmabrouk mmabrouk force-pushed the feat/fix-ts-otel-exaples branch from b1160a1 to 635c66d Compare February 27, 2026 11:52
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Feb 27, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
devin-ai-integration[bot]

This comment was marked as resolved.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 27, 2026

Railway Preview Environment

Status Destroyed (PR closed)

Updated at 2026-02-27T19:31:25.388Z

@junaway junaway changed the base branch from main to release/v0.87.2 February 27, 2026 12:37
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Feb 27, 2026
@mmabrouk mmabrouk merged commit 197f8a4 into release/v0.87.2 Feb 27, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend bug Something isn't working documentation Improvements or additions to documentation size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants