Skip to content

Add span origin provenance#2226

Open
Stephen Belanger (Qard) wants to merge 13 commits into
mainfrom
agent/span-origin-provenance
Open

Add span origin provenance#2226
Stephen Belanger (Qard) wants to merge 13 commits into
mainfrom
agent/span-origin-provenance

Conversation

@Qard

Copy link
Copy Markdown
Collaborator

Summary

Adds span origin provenance to the TypeScript SDK direct logging and OpenTelemetry paths, including .env.braintrust environment detection.

Validation

  • ./node_modules/.bin/vitest run in integrations/otel-js/otel-v1
  • ./node_modules/.bin/vitest run in integrations/otel-js/otel-v2
  • aggregate git diff --check

@Qard Stephen Belanger (Qard) force-pushed the agent/span-origin-provenance branch from a1930f9 to ec05ec1 Compare July 15, 2026 06:45

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: efa7db3e0a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment on lines +284 to +285
const envType = process.env.BRAINTRUST_ENVIRONMENT_TYPE;
const envName = process.env.BRAINTRUST_ENVIRONMENT_NAME;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Read provenance env vars through the SDK env helper

When @braintrust/otel is configured with BRAINTRUST_ENVIRONMENT_TYPE or BRAINTRUST_ENVIRONMENT_NAME only in the nearest .env.braintrust file, this direct process.env lookup misses them because the Braintrust node config reads that file via _internalIso.getEnv without populating process.env. The processor already supports .env.braintrust for API keys, so spans exported through this path will omit span_origin.environment in that same setup unless these reads use the SDK env helper/shared detector.

Useful? React with 👍 / 👎.

@@ -0,0 +1,5 @@
---
"braintrust": minor

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add the @braintrust/otel package to this changeset

This commit changes @braintrust/otel runtime behavior and adds an environment processor option, but the changeset only lists braintrust. Packages not listed in the changeset will not receive a version bump/release, so the new OTEL span provenance code described here would not be published to users of @braintrust/otel.

Useful? React with 👍 / 👎.

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.

1 participant